From owner-svn-src-all@freebsd.org Thu Oct 6 18:09:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E610BEC725; Thu, 6 Oct 2016 18:09:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E4575952; Thu, 6 Oct 2016 18:09:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u96I9Nkg003543; Thu, 6 Oct 2016 18:09:23 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u96I9Nv5003541; Thu, 6 Oct 2016 18:09:23 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201610061809.u96I9Nv5003541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 6 Oct 2016 18:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306774 - in head/sys: kern sys 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.23 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: Thu, 06 Oct 2016 18:09:24 -0000 Author: bdrewery Date: Thu Oct 6 18:09:22 2016 New Revision: 306774 URL: https://svnweb.freebsd.org/changeset/base/306774 Log: Add vrecyclel() to vrecycle() a vnode with the interlock already held. Obtained from: OneFS Sponsored by: Dell EMC Isilon MFC after: 2 weeks Modified: head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Oct 6 18:05:25 2016 (r306773) +++ head/sys/kern/vfs_subr.c Thu Oct 6 18:09:22 2016 (r306774) @@ -3160,15 +3160,28 @@ vrecycle(struct vnode *vp) { int recycled; - ASSERT_VOP_ELOCKED(vp, "vrecycle"); + VI_LOCK(vp); + recycled = vrecyclel(vp); + VI_UNLOCK(vp); + return (recycled); +} + +/* + * vrecycle, with the vp interlock held. + */ +int +vrecyclel(struct vnode *vp) +{ + int recycled; + + ASSERT_VOP_ELOCKED(vp, __func__); + ASSERT_VI_LOCKED(vp, __func__); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); recycled = 0; - VI_LOCK(vp); if (vp->v_usecount == 0) { recycled = 1; vgonel(vp); } - VI_UNLOCK(vp); return (recycled); } Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu Oct 6 18:05:25 2016 (r306773) +++ head/sys/sys/vnode.h Thu Oct 6 18:09:22 2016 (r306774) @@ -659,6 +659,7 @@ int vtruncbuf(struct vnode *vp, struct u void vunref(struct vnode *); void vn_printf(struct vnode *vp, const char *fmt, ...) __printflike(2,3); int vrecycle(struct vnode *vp); +int vrecyclel(struct vnode *vp); int vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred); int vn_close(struct vnode *vp,