Page MenuHomeFreeBSD

zfs_mount(MS_REMOUNT): protect zfs_(un)register_callbacks calls

Authored by avg on Jun 19 2015, 7:30 AM.



We now take z_teardown_lock as a writer to ensure that there is no
I/O while the filesystem state is in a flux.
Also, zfs_suspend_fs() -> zfsvfs_teardown() call zfs_unregister_callbacks()
and zfs_resume_fs() -> zfsvfs_setup() call zfs_unregister_callbacks().
Previously there was no synchronization between those calls and the calls
in the re-mounting case. That could lead to concurrent execution
and a crash.

Diff Detail

rS FreeBSD src repository - subversion
No Linters Available
No Unit Test Coverage

Event Timeline

avg retitled this revision from to zfs_mount(MS_REMOUNT): protect zfs_(un)register_callbacks calls.
avg updated this object.
avg edited the test plan for this revision. (Show Details)
avg added a reviewer: mahrens.
avg added a subscriber: ZFS.

I wonder if we should mark zfs_unregister_callbacks static, just like zfs_register_callbacks? (Or is this intentional to make them DTrace proble eligible?)


I'm not very convinced that we can safely do unregister without having z_teardown_lock held here... If it's safe, maybe we should document it in the comment?


It looks like this function can be made static, but I'd do it as a separate commit.


If !unmounting we, in fact, do hold the lock here.
And if unmounting then no other thread can operate on the filesystem because of z_unmounted.
See line 1886 above and 1918 too.

delphij edited edge metadata.
This revision is now accepted and ready to land.Jun 19 2015, 6:42 PM
pho edited edge metadata.

No problems seen with the few zfs tests I have.

mahrens edited edge metadata.
will edited edge metadata.