HomeFreeBSD

Generalize the VV_CROSSLOCK logic in vfs_lookup()

Description

Generalize the VV_CROSSLOCK logic in vfs_lookup()

When VV_CROSSLOCK is present, the lock for the vnode at the current
stage of lookup must be held across the VFS_ROOT() call for the
filesystem mounted at the vnode. Since VV_CROSSLOCK implies that
the root vnode reuses the already-held lock, the possibility for
recursion should be made clear in the flags passed to VFS_ROOT().

For cases in which the lock is held exclusive, this means passing
LK_CANRECURSE. For cases in which the lock is held shared, it
means clearing LK_NODDLKTREAT to allow VFS_ROOT() to potentially
recurse on the shared lock even in the presence of an exclusive
waiter.

That the existing code works for unionfs is due to a coincidence
of the current unionfs implementation.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D37458

Details

Provenance
jahAuthored on Oct 26 2022, 10:25 PM
Reviewer
kib
Differential Revision
D37458: Various fixes related to VV_CROSSLOCK handling
Parents
rGbc2ccf0e4f8f: mtx: retire PARTIAL_PICKUP_GIANT
Branches
Unknown
Tags
Unknown