git: 19f2755d9ed1 - stable/13 - DEBUG_VFS_LOCKS: stop excluding devfs and doomed vnode from asserts
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Nov 2021 04:36:54 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=19f2755d9ed1890c8c6a3a66b2493d69c6e0d0ee commit 19f2755d9ed1890c8c6a3a66b2493d69c6e0d0ee Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-10-31 21:34:57 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-11-19 04:25:29 +0000 DEBUG_VFS_LOCKS: stop excluding devfs and doomed vnode from asserts (cherry picked from commit d032cda0d047869139f03cb6d34a18216a166735) --- sys/kern/vfs_subr.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index ff208926be16..f56bedecaf15 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -5407,13 +5407,6 @@ extattr_check_cred(struct vnode *vp, int attrnamespace, struct ucred *cred, } #ifdef DEBUG_VFS_LOCKS -/* - * This only exists to suppress warnings from unlocked specfs accesses. It is - * no longer ok to have an unlocked VFS. - */ -#define IGNORE_LOCK(vp) (KERNEL_PANICKED() || (vp) == NULL || \ - (vp)->v_type == VCHR || (vp)->v_type == VBAD) - int vfs_badlock_ddb = 1; /* Drop into debugger on violation. */ SYSCTL_INT(_debug, OID_AUTO, vfs_badlock_ddb, CTLFLAG_RW, &vfs_badlock_ddb, 0, "Drop into debugger on lock violation"); @@ -5473,26 +5466,31 @@ assert_vop_locked(struct vnode *vp, const char *str) { int locked; - if (!IGNORE_LOCK(vp)) { - locked = VOP_ISLOCKED(vp); - if (locked == 0 || locked == LK_EXCLOTHER) - vfs_badlock("is not locked but should be", str, vp); - } + if (KERNEL_PANICKED() || vp == NULL) + return; + + locked = VOP_ISLOCKED(vp); + if (locked == 0 || locked == LK_EXCLOTHER) + vfs_badlock("is not locked but should be", str, vp); } void assert_vop_unlocked(struct vnode *vp, const char *str) { + if (KERNEL_PANICKED() || vp == NULL) + return; - if (!IGNORE_LOCK(vp) && VOP_ISLOCKED(vp) == LK_EXCLUSIVE) + if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) vfs_badlock("is locked but should not be", str, vp); } void assert_vop_elocked(struct vnode *vp, const char *str) { + if (KERNEL_PANICKED() || vp == NULL) + return; - if (!IGNORE_LOCK(vp) && VOP_ISLOCKED(vp) != LK_EXCLUSIVE) + if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) vfs_badlock("is not exclusive locked but should be", str, vp); } #endif /* DEBUG_VFS_LOCKS */