From owner-svn-src-all@FreeBSD.ORG Wed May 21 03:11:27 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B57B8955; Wed, 21 May 2014 03:11:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1DC720B5; Wed, 21 May 2014 03:11:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4L3BRJJ047002; Wed, 21 May 2014 03:11:27 GMT (envelope-from bjk@svn.freebsd.org) Received: (from bjk@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4L3BROu047001; Wed, 21 May 2014 03:11:27 GMT (envelope-from bjk@svn.freebsd.org) Message-Id: <201405210311.s4L3BROu047001@svn.freebsd.org> From: Benjamin Kaduk Date: Wed, 21 May 2014 03:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266482 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 May 2014 03:11:27 -0000 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;