HomeFreeBSD

unionfs: Improve locking assertions

Description

unionfs: Improve locking assertions

Add an assertion to unionfs_node_update() that the upper vnode is
exclusively locked; we already make the same assertion for the lower
vnode.
Also, assert in unionfs_noderem() that the vnode lock is not recursed
and acquire v_lock with LK_NOWAIT. Since v_lock is not the active
lock for the vnode at this point, it should not be contended.
Finally, remove VDIR assertions from unionfs_get_cached_vnode().
lvp/uvp will be referenced but not locked at this point, so v_type
may concurrently change due to vgonel(). The cached unionfs node,
if one exists, would only have made it into the cache if lvp/uvp
were of type VDIR at the time of insertion; the corresponding
VDIR assert in unionfs_ins_cached_vnode() should be safe because
lvp/uvp will be locked by that time and will not be used if either
is doomed.

Noted by: kib
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D32629

Details

Provenance
jahAuthored on Oct 28 2021, 5:31 AM
Reviewer
kib
Differential Revision
D32629: unionfs: various locking fixes
Parents
rG3ecefc4a61cc: unionfs: assorted style fixes
Branches
Unknown
Tags
Unknown