From owner-svn-src-stable@FreeBSD.ORG Tue Aug 5 05:00:23 2014 Return-Path: Delivered-To: svn-src-stable@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 718C5D40 for ; Tue, 5 Aug 2014 05:00:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52EF62C90 for ; Tue, 5 Aug 2014 05:00:23 +0000 (UTC) Received: from kib (uid 1100) (envelope-from kib@FreeBSD.org) id 5bd5 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Tue, 05 Aug 2014 05:00:23 +0000 From: Konstantin Belousov Date: Tue, 5 Aug 2014 05:00:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269562 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e064e7.5bd5.5e1952a4@svn.freebsd.org> X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Aug 2014 05:00:23 -0000 Author: kib Date: Tue Aug 5 05:00:22 2014 New Revision: 269562 URL: http://svnweb.freebsd.org/changeset/base/269562 Log: MFC r269244: Remove one-time use macros which check for the vnode lifecycle. Modified: stable/10/sys/kern/vfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_subr.c ============================================================================== --- stable/10/sys/kern/vfs_subr.c Tue Aug 5 02:22:58 2014 (r269561) +++ stable/10/sys/kern/vfs_subr.c Tue Aug 5 05:00:22 2014 (r269562) @@ -275,14 +275,6 @@ static int vnlru_nowhere; SYSCTL_INT(_debug, OID_AUTO, vnlru_nowhere, CTLFLAG_RW, &vnlru_nowhere, 0, "Number of times the vnlru process ran without success"); -/* - * Macros to control when a vnode is freed and recycled. All require - * the vnode interlock. - */ -#define VCANRECYCLE(vp) (((vp)->v_iflag & VI_FREE) && !(vp)->v_holdcnt) -#define VSHOULDFREE(vp) (!((vp)->v_iflag & VI_FREE) && !(vp)->v_holdcnt) -#define VSHOULDBUSY(vp) (((vp)->v_iflag & VI_FREE) && (vp)->v_holdcnt) - /* Shift count for (uintptr_t)vp to initialize vp->v_hash. */ static int vnsz2log; @@ -849,11 +841,21 @@ vnlru_free(int count) TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_actfreelist); continue; } - VNASSERT(VCANRECYCLE(vp), vp, - ("vp inconsistent on freelist")); + VNASSERT((vp->v_iflag & VI_FREE) != 0 && vp->v_holdcnt == 0, + vp, ("vp inconsistent on freelist")); + + /* + * The clear of VI_FREE prevents activation of the + * vnode. There is no sense in putting the vnode on + * the mount point active list, only to remove it + * later during recycling. Inline the relevant part + * of vholdl(), to avoid triggering assertions or + * activating. + */ freevnodes--; vp->v_iflag &= ~VI_FREE; - vholdl(vp); + vp->v_holdcnt++; + mtx_unlock(&vnode_free_list_mtx); VI_UNLOCK(vp); vtryrecycle(vp); @@ -2042,13 +2044,13 @@ v_incr_usecount(struct vnode *vp) { CTR2(KTR_VFS, "%s: vp %p", __func__, vp); + vholdl(vp); vp->v_usecount++; if (vp->v_type == VCHR && vp->v_rdev != NULL) { dev_lock(); vp->v_rdev->si_usecount++; dev_unlock(); } - vholdl(vp); } /* @@ -2325,11 +2327,18 @@ vholdl(struct vnode *vp) struct mount *mp; CTR2(KTR_VFS, "%s: vp %p", __func__, vp); +#ifdef INVARIANTS + /* getnewvnode() calls v_incr_usecount() without holding interlock. */ + if (vp->v_type != VNON || vp->v_data != NULL) { + ASSERT_VI_LOCKED(vp, "vholdl"); + VNASSERT(vp->v_holdcnt > 0 || (vp->v_iflag & VI_FREE) != 0, + vp, ("vholdl: free vnode is held")); + } +#endif vp->v_holdcnt++; - if (!VSHOULDBUSY(vp)) + if ((vp->v_iflag & VI_FREE) == 0) return; - ASSERT_VI_LOCKED(vp, "vholdl"); - VNASSERT((vp->v_iflag & VI_FREE) != 0, vp, ("vnode not free")); + VNASSERT(vp->v_holdcnt == 1, vp, ("vholdl: wrong hold count")); VNASSERT(vp->v_op != NULL, vp, ("vholdl: vnode already reclaimed.")); /* * Remove a vnode from the free list, mark it as in use, @@ -2390,7 +2399,7 @@ vdropl(struct vnode *vp) ("vdropl: vnode already reclaimed.")); VNASSERT((vp->v_iflag & VI_FREE) == 0, vp, ("vnode already free")); - VNASSERT(VSHOULDFREE(vp), vp, + VNASSERT(vp->v_holdcnt == 0, vp, ("vdropl: freeing when we shouldn't")); active = vp->v_iflag & VI_ACTIVE; vp->v_iflag &= ~VI_ACTIVE;