git: c63c77b3a531 - main - vp_crossmp: weaken the assert and make it more precise
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 07 Sep 2026 15:47:03 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=c63c77b3a5312dfd00f7749a07269119da886609
commit c63c77b3a5312dfd00f7749a07269119da886609
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-09-06 15:11:41 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-09-07 15:46:03 +0000
vp_crossmp: weaken the assert and make it more precise
Since the vp_crossmp vnode can leak into vn_vptocnp() calls due to
nullfs file mounting, not all lock requests are non-sleeping. The
requirement for the crossmp locking is that all lock requests should be
shared. Then, it does not matter if the requests allow sleeping, since
all locks are shared.
Also, check the lock type by correctly masking it with LK_TYPE_MASK.
Reported and tested by: pho
Reviewed by: jah, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59468
---
sys/kern/vfs_lookup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 57b536eab6ea..71d4d3f75721 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -133,7 +133,7 @@ crossmp_vop_lock1(struct vop_lock1_args *ap)
lk = vp->v_vnlock;
flags = ap->a_flags;
- KASSERT((flags & (LK_SHARED | LK_NOWAIT)) == (LK_SHARED | LK_NOWAIT),
+ KASSERT((flags & LK_TYPE_MASK) == LK_SHARED,
("%s: invalid lock request 0x%x for crossmp", __func__, flags));
if ((flags & LK_INTERLOCK) != 0)