From b1cd18ff699cd07fc243c1fe1439a3ab978e622a Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 30 Jul 2002 09:57:37 +0000 Subject: [PATCH] - Add vfs_badlock_{print,panic} support to the remaining VOP_ASSERT_* macros. --- sys/sys/vnode.h | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 15f4bfb58b05..ddcae4199161 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -501,9 +501,13 @@ do { \ struct vnode *_vp = (vp); \ \ if (_vp && !IGNORE_LOCK(_vp) && \ - VOP_ISLOCKED(_vp, curthread) != LK_EXCLUSIVE) \ - panic("%s: %p is not exclusive locked but should be", \ - str, _vp); \ + VOP_ISLOCKED(_vp, curthread) != LK_EXCLUSIVE) { \ + if (vfs_badlock_print) \ + printf("%s: %p is not exclusive locked but should be\n",\ + str, _vp); \ + if (vfs_badlock_panic) \ + Debugger("Lock violation.\n"); \ + } \ } while (0) #define ASSERT_VOP_ELOCKED_OTHER(vp, str) \ @@ -511,9 +515,13 @@ do { \ struct vnode *_vp = (vp); \ \ if (_vp && !IGNORE_LOCK(_vp) && \ - VOP_ISLOCKED(_vp, curthread) != LK_EXCLOTHER) \ - panic("%s: %p is not exclusive locked by another thread", \ - str, _vp); \ + VOP_ISLOCKED(_vp, curthread) != LK_EXCLOTHER) { \ + if (vfs_badlock_print) \ + printf("%s: %p is not exclusive locked by another thread\n",\ + str, _vp); \ + if (vfs_badlock_panic) \ + Debugger("Lock violation.\n"); \ + } \ } while (0) #define ASSERT_VOP_SLOCKED(vp, str) \ @@ -521,9 +529,13 @@ do { \ struct vnode *_vp = (vp); \ \ if (_vp && !IGNORE_LOCK(_vp) && \ - VOP_ISLOCKED(_vp, NULL) != LK_SHARED) \ - panic("%s: %p is not locked shared but should be", \ + VOP_ISLOCKED(_vp, NULL) != LK_SHARED) { \ + if (vfs_badlock_print) \ + printf("%s: %p is not locked shared but should be",\ str, _vp); \ + if (vfs_badlock_panic) \ + Debugger("Lock violation.\n"); \ + } \ } while (0) void vop_rename_pre(void *a);