HomeFreeBSD

vn_lock_pair(): allow lkflags1/lkflags2 to be 0 if vp1/vp2 is NULL

Description

vn_lock_pair(): allow lkflags1/lkflags2 to be 0 if vp1/vp2 is NULL

It's a bit strange to require the caller to pass contrived lock flags
if the corresponding vnode is NULL, simply to appease the assertion
that exactly one of LK_SHARED or LK_EXCLUSIVE must be set. On the
other hand, we still want to catch cases in which completely bogus
or corrupt flags are passed even if the corresponding vnode is NULL.
Therefore, specifically allow empty flags for lkflags1/lkflags2 iff
the respective vp1/vp2 param is NULL.

Reviewed by: kib, olce
Differential Revision: https://reviews.freebsd.org/D44046

(cherry picked from commit fa26f46dc29f5ee1ac8e7b10fc12aa1f93cce702)

Details

Provenance
jahAuthored on Feb 23 2024, 5:31 PM
Reviewer
kib
Differential Revision
D44046: vn_lock_pair(): only assert on lkflags1/lkflags2 vp1/vp2 is non-NULL
Parents
rG66f60770fd7d: unbound: Vendor import 1.19.3
Branches
Unknown
Tags
Unknown