git: 706f15c5fa6b - main - Remove witness directives from crossmp locking VOPs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 27 Oct 2022 00:24:30 UTC
The branch main has been updated by jah:
URL: https://cgit.FreeBSD.org/src/commit/?id=706f15c5fa6b4b9e6845b8d65a3acf23a79b115e
commit 706f15c5fa6b4b9e6845b8d65a3acf23a79b115e
Author: Jason A. Harmening <jah@FreeBSD.org>
AuthorDate: 2022-08-05 05:39:04 +0000
Commit: Jason A. Harmening <jah@FreeBSD.org>
CommitDate: 2022-10-27 00:33:18 +0000
Remove witness directives from crossmp locking VOPs
These are of limited use since the crossmp vnode locking ops have not
actually used a lock since commit
a2d35545429117e68fbcbc68e14ad55e84265d69. We in fact require that
these operations are always issued with LK_SHARED. Additionally,
these directives can produce a false positive in certain VV_CROSSLOCK
cases which require upgrading of the covered vnode lock from shared
to exclusive.
While here, replace the runtime check of LK_SHARED with a KASSERT and
expand the check to include LK_NOWAIT, which all callers pass.
Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D35054
---
sys/kern/vfs_lookup.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 589decb14fc2..318dcf6fb72b 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -105,21 +105,15 @@ crossmp_vop_lock1(struct vop_lock1_args *ap)
{
struct vnode *vp;
struct lock *lk __diagused;
- const char *file __witness_used;
- int flags, line __witness_used;
+ int flags;
vp = ap->a_vp;
lk = vp->v_vnlock;
flags = ap->a_flags;
- file = ap->a_file;
- line = ap->a_line;
- if ((flags & LK_SHARED) == 0)
- panic("invalid lock request for crossmp");
+ KASSERT((flags & (LK_SHARED | LK_NOWAIT)) == (LK_SHARED | LK_NOWAIT),
+ ("%s: invalid lock request 0x%x for crossmp", __func__, flags));
- WITNESS_CHECKORDER(&lk->lock_object, LOP_NEWORDER, file, line,
- flags & LK_INTERLOCK ? &VI_MTX(vp)->lock_object : NULL);
- WITNESS_LOCK(&lk->lock_object, 0, file, line);
if ((flags & LK_INTERLOCK) != 0)
VI_UNLOCK(vp);
LOCK_LOG_LOCK("SLOCK", &lk->lock_object, 0, 0, ap->a_file, ap->a_line);
@@ -135,7 +129,6 @@ crossmp_vop_unlock(struct vop_unlock_args *ap)
vp = ap->a_vp;
lk = vp->v_vnlock;
- WITNESS_UNLOCK(&lk->lock_object, 0, LOCK_FILE, LOCK_LINE);
LOCK_LOG_LOCK("SUNLOCK", &lk->lock_object, 0, 0, LOCK_FILE,
LOCK_LINE);
return (0);