Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 2014 03:11:27 +0000 (UTC)
From:      Benjamin Kaduk <bjk@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266482 - head/sys/kern
Message-ID:  <201405210311.s4L3BROu047001@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bjk (doc committer)
Date: Wed May 21 03:11:27 2014
New Revision: 266482
URL: http://svnweb.freebsd.org/changeset/base/266482

Log:
  Check for mismatched vref()/vdrop()
  
  Assert that the hold count has not fallen below the use count, a situation
  that would only happen when a vref() (or similar) is erroneously paired
  with a vdrop().  This situation has not been observed in the wild, but
  could be helpful for someone implementing a new filesystem.
  
  Reviewed by:	kib
  Approved by:	hrs (mentor)

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Tue May 20 22:43:17 2014	(r266481)
+++ head/sys/kern/vfs_subr.c	Wed May 21 03:11:27 2014	(r266482)
@@ -2343,6 +2343,8 @@ vdropl(struct vnode *vp)
 	if (vp->v_holdcnt <= 0)
 		panic("vdrop: holdcnt %d", vp->v_holdcnt);
 	vp->v_holdcnt--;
+	VNASSERT(vp->v_holdcnt >= vp->v_usecount, vp,
+	    ("hold count less than use count"));
 	if (vp->v_holdcnt > 0) {
 		VI_UNLOCK(vp);
 		return;



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