]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
unionfs: Improve locking assertions
authorJason A. Harmening <jah@FreeBSD.org>
Thu, 28 Oct 2021 05:31:16 +0000 (22:31 -0700)
committerJason A. Harmening <jah@FreeBSD.org>
Sat, 6 Nov 2021 14:08:33 +0000 (07:08 -0700)
commit66191a76ace56af6603b343ad2e9a003e0589d70
treef0ee4abc2d8491842affcae5f78adb4d0c41b045
parent3ecefc4a61cc3df506b38bfdf2dac843859a23a7
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
sys/fs/unionfs/union_subr.c