Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Oct 2008 10:11:33 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r184074 - in head/sys: kern ufs/ffs
Message-ID:  <200810201011.m9KABXLf066267@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Oct 20 10:11:33 2008
New Revision: 184074
URL: http://svn.freebsd.org/changeset/base/184074

Log:
  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

Modified:
  head/sys/kern/vfs_vnops.c
  head/sys/ufs/ffs/ffs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c	Mon Oct 20 10:07:28 2008	(r184073)
+++ head/sys/kern/vfs_vnops.c	Mon Oct 20 10:11:33 2008	(r184074)
@@ -873,6 +873,10 @@ _vn_lock(struct vnode *vp, int flags, ch
 	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,

Modified: head/sys/ufs/ffs/ffs_vnops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vnops.c	Mon Oct 20 10:07:28 2008	(r184073)
+++ head/sys/ufs/ffs/ffs_vnops.c	Mon Oct 20 10:11:33 2008	(r184074)
@@ -361,6 +361,10 @@ ffs_lock(ap)
 		vp = ap->a_vp;
 		flags = ap->a_flags;
 		for (;;) {
+#ifdef DEBUG_VFS_LOCKS
+			KASSERT(vp->v_holdcnt != 0,
+			    ("ffs_lock %p: zero hold count", vp));
+#endif
 			lkp = vp->v_vnlock;
 			result = _lockmgr_args(lkp, flags, VI_MTX(vp),
 			    LK_WMESG_DEFAULT, LK_PRIO_DEFAULT, LK_TIMO_DEFAULT,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810201011.m9KABXLf066267>