On 05/08/2016 09:23, Andriy Gapon wrote: > - replace ZFS_ENTER mechanism with VFS managed / visible mechanism > - replace zfs_zget with zfs_vget[f] as much as possible
I'd like to add a couple more words about these items. At the moment the operation like rollback and (incremental) receive are protected by z_teardown_lock that is acquired within ZPL and thus after vnode locks acquired by VFS. That has several consequences: - we have to be very careful to not acquire any vnode locks within ZFS_ENTER + ZFS_EXIT delimited blocks and that leads to more complex code - as a consequence we can not lock ZFS vnodes right when we get them, so we have to resort to some tricks - zfs rollback, as an example, may cause trouble for operations like zfs_remove, because the parent and child vnodes are looked up (and locked) before calling zfs_remove and by the time it grabs z_teardown_lock those vnodes may already point to arbitrary nodes as a result of the rollback - there is a LOR between the normal path (e.g. page in or page out) where the vnode and page locks are acquired before z_teardown_lock and the rollback path where ZPL calls vn_pages_remove() while holding the tear-down lock. So, logically we should acquire a lock that protects a filesystem from a rollback (or other out-of-band modification) before acquiring any of its vnode locks. Currently we have a similar but rather FFS-specific mechanism of vn_start_write and vfs_write_suspend. The mechanism is used for blocking writes when taking FFS snapshots, but it could be extended to block reads for rollbacks. -- Andriy Gapon _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"