git: 99da9d65a5e0 - stable/13 - DEBUG_VFS_LOCKS: restore diagnostic for the witness use case
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 16 Apr 2023 10:57:42 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=99da9d65a5e0db8f6563fee7fc576c1de4f84363 commit 99da9d65a5e0db8f6563fee7fc576c1de4f84363 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-04-10 08:52:43 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-04-16 10:45:58 +0000 DEBUG_VFS_LOCKS: restore diagnostic for the witness use case (cherry picked from commit c53e990b8d0444b5ad59ddb18742a71434e30ee2) --- sys/kern/vfs_subr.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index c4d8ceac7e2b..7ebd63447caa 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -5530,14 +5530,13 @@ assert_vop_locked(struct vnode *vp, const char *str) return; #ifdef WITNESS - if ((vp->v_irflag & VIRF_CROSSMP) == 0) - witness_assert(&vp->v_vnlock->lock_object, LA_LOCKED, - __FILE__, __LINE__); + if ((vp->v_irflag & VIRF_CROSSMP) == 0 && + witness_is_owned(&vp->v_vnlock->lock_object) == -1) #else int locked = VOP_ISLOCKED(vp); if (locked == 0 || locked == LK_EXCLOTHER) - vfs_badlock("is not locked but should be", str, vp); #endif + vfs_badlock("is not locked but should be", str, vp); } void @@ -5547,13 +5546,12 @@ assert_vop_unlocked(struct vnode *vp, const char *str) return; #ifdef WITNESS - if ((vp->v_irflag & VIRF_CROSSMP) == 0) - witness_assert(&vp->v_vnlock->lock_object, LA_UNLOCKED, - __FILE__, __LINE__); + if ((vp->v_irflag & VIRF_CROSSMP) == 0 && + witness_is_owned(&vp->v_vnlock->lock_object) == 1) #else if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) - vfs_badlock("is locked but should not be", str, vp); #endif + vfs_badlock("is locked but should not be", str, vp); } void