HomeFreeBSD

unionfs: allow vnode lock to be held shared during VOP_OPEN

Description

unionfs: allow vnode lock to be held shared during VOP_OPEN

do_execve() will hold the vnode lock shared when it calls VOP_OPEN(),
but unionfs_open() requires the lock to be held exclusive to
correctly synchronize node status updates. This requirement is
asserted in unionfs_get_node_status().

Change unionfs_open() to temporarily upgrade the lock as is already
done in unionfs_close(). Related to this, fix various cases throughout
unionfs in which vnodes are not checked for reclamation following lock
upgrades that may have temporarily dropped the lock. Also fix another
related issue in which unionfs_lock() can incorrectly add LK_NOWAIT
during a downgrade operation, which trips a lockmgr assertion.

Reviewed by: kib (prior version), markj, pho
Reported by: pho
Differential Revision: https://reviews.freebsd.org/D33729

Details

Provenance
jahAuthored on Jan 3 2022, 2:47 PM
Reviewer
kib
Differential Revision
D33729: unionfs: allow vnode lock to be held shared during VOP_OPEN
Parents
rG8bb9cd271eb4: stand: Fix KASSERT use
Branches
Unknown
Tags
Unknown