Page MenuHomeFreeBSD

zfs: use VOP_NEED_INACTIVE
ClosedPublic

Authored by mjg on Oct 23 2019, 5:59 PM.

Details

Summary

See r351584 for reasoning.

Sample results from make -j 40 bzImage:

beforeafter
96630750 (lockmgr:zfs)17400445 (rw:vm object)
19971882 (rw:vm object)9008902 (sleep mutex:zio_write_issue)
10328270 (spin mutex:sleepq chain)8802655 (spin mutex:sleepq chain)
6159891 (sleep mutex:vnode interlock)4737875 (sx:zp->z_acl_lock)
5128765 (spin mutex:sched lock 33)4459105 (rw:pmap pv list)
4995571 (spin mutex:sched lock 11)4343860 (sx:rrl->rr_lock)
4942302 (rw:pmap pv list)2906398 (lockmgr:zfs)

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mjg created this revision.Oct 23 2019, 5:59 PM

I've been testing this patch for a while and it seems like…

it causes files written by LLD >= 9.0 (which uses ftruncate→mmap→rename→close)…

to become all zeroes after reboot.

(and possibly hangs on poweroff/reboot after the bufspacethings are done)

mjg added a comment.EditedDec 29 2019, 3:50 PM

I see why, it misses one check. I'm probably going to fix this in a very different manner though. Thanks for the report!

mjg updated this revision to Diff 66167.Dec 30 2019, 10:42 PM
  • perform a locked check for all conditions
mjg added a comment.Dec 30 2019, 10:42 PM

@greg_unrelenting.technology does the updated patch work for you?

mjg updated this revision to Diff 66169.Dec 30 2019, 11:37 PM
  • trylock since the routine is called with the interlock held

Same issues on the latest version.

mjg added a comment.Jan 25 2020, 9:26 PM

@greg_unrelenting.technology can you please retest on top fresh head? (specifically after r357070)

In D22130#512307, @mjg wrote:

@greg_unrelenting.technology can you please retest on top fresh head? (specifically after r357070)

No longer hangs on reboot, but zeroed files still happen :(

mjg added a comment.EditedJan 26 2020, 5:24 AM

Can you prepare a short reproducer? Preferably few commands in total.

I ran into problems with previous of the patch but everything works fine for me with this one.

In D22130#512369, @mjg wrote:

Can you prepare a short reproducer? Preferably few commands in total.

echo 'int main() {}' > hello.c
clang90 -o hello hello.c
./hello # should work
reboot
# cd to same directory
./hello # should report an exec format error or whatever it is, the file will be all zeros

(cc should work as well, current has clang 9.x in base)

mjg added a comment.Jan 26 2020, 10:54 AM

Thanks a lot, I'll look into it.

mjg updated this revision to Diff 67309.Jan 26 2020, 12:42 PM
  • handle mmap

The problem was that the following was not taken into consideration:

if ((obj = vp->v_object) != NULL && (vp->v_vflag & VV_NOSYNC) == 0 &&
    vm_object_mightbedirty(obj)) {
        VM_OBJECT_WLOCK(obj);
        vm_object_page_clean(obj, 0, 0, 0);
        VM_OBJECT_WUNLOCK(obj);
}

Now the testcase passes. Thanks a lot for testing.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 30 2020, 2:14 AM
Closed by commit rS357281: zfs: use VOP_NEED_INACTIVE (authored by mjg). · Explain Why
This revision was automatically updated to reflect the committed changes.