svn commit: r266482 - head/sys/kern
Benjamin Kaduk
bjk at FreeBSD.org
Wed May 21 03:11:27 UTC 2014
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;
More information about the svn-src-head
mailing list