summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_vnops.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-10-20 10:11:33 +0000
committerkib <kib@FreeBSD.org>2008-10-20 10:11:33 +0000
commite4785f6af46f6a5f0dc78c7eeb246a7d300652bb (patch)
tree19e1a3741bbd1de5ea7c4c9b19df66c5f0e37a4b /sys/kern/vfs_vnops.c
parent015479d466a4e5609bed16fe5bc0d7c02cd1a239 (diff)
downloadFreeBSD-src-e4785f6af46f6a5f0dc78c7eeb246a7d300652bb.zip
FreeBSD-src-e4785f6af46f6a5f0dc78c7eeb246a7d300652bb.tar.gz
Assert that v_holdcnt is non-zero before entering lockmgr in vn_lock
and ffs_lock. This cannot catch situations where holdcnt is incremented not by curthread, but I think it is useful. Reviewed by: tegge, attilio Tested by: pho MFC after: 2 weeks
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r--sys/kern/vfs_vnops.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 2301a34..c730781 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -873,6 +873,10 @@ _vn_lock(struct vnode *vp, int flags, char *file, int line)
VNASSERT((flags & LK_TYPE_MASK) != 0, vp,
("vn_lock called with no locktype."));
do {
+#ifdef DEBUG_VFS_LOCKS
+ KASSERT(vp->v_holdcnt != 0,
+ ("vn_lock %p: zero hold count", vp));
+#endif
error = VOP_LOCK1(vp, flags, file, line);
flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */
KASSERT((flags & LK_RETRY) == 0 || error == 0,
OpenPOWER on IntegriCloud