From owner-svn-src-all@freebsd.org  Fri Aug 30 00:30:04 2019
Return-Path: <owner-svn-src-all@freebsd.org>
Delivered-To: svn-src-all@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id A18F8E4875;
 Fri, 30 Aug 2019 00:30:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 46KL3J3pvhz4R2c;
 Fri, 30 Aug 2019 00:30:04 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6124427FEB;
 Fri, 30 Aug 2019 00:30:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7U0U437071585;
 Fri, 30 Aug 2019 00:30:04 GMT (envelope-from mjg@FreeBSD.org)
Received: (from mjg@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7U0U4Ss071584;
 Fri, 30 Aug 2019 00:30:04 GMT (envelope-from mjg@FreeBSD.org)
Message-Id: <201908300030.x7U0U4Ss071584@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org
 using -f
From: Mateusz Guzik <mjg@FreeBSD.org>
Date: Fri, 30 Aug 2019 00:30:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r351617 - head/sys/fs/nullfs
X-SVN-Group: head
X-SVN-Commit-Author: mjg
X-SVN-Commit-Paths: head/sys/fs/nullfs
X-SVN-Commit-Revision: 351617
X-SVN-Commit-Repository: base
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.29
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Aug 2019 00:30:04 -0000

Author: mjg
Date: Fri Aug 30 00:30:03 2019
New Revision: 351617
URL: https://svnweb.freebsd.org/changeset/base/351617

Log:
  nullfs: use VOP_NEED_INACTIVE
  
  Reviewed by:	kib
  Tested by:	pho (previous version)
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/fs/nullfs/null_vnops.c

Modified: head/sys/fs/nullfs/null_vnops.c
==============================================================================
--- head/sys/fs/nullfs/null_vnops.c	Fri Aug 30 00:05:04 2019	(r351616)
+++ head/sys/fs/nullfs/null_vnops.c	Fri Aug 30 00:30:03 2019	(r351617)
@@ -732,14 +732,13 @@ null_unlock(struct vop_unlock_args *ap)
  * ours.
  */
 static int
-null_inactive(struct vop_inactive_args *ap __unused)
+null_want_recycle(struct vnode *vp)
 {
-	struct vnode *vp, *lvp;
+	struct vnode *lvp;
 	struct null_node *xp;
 	struct mount *mp;
 	struct null_mount *xmp;
 
-	vp = ap->a_vp;
 	xp = VTONULL(vp);
 	lvp = NULLVPTOLOWERVP(vp);
 	mp = vp->v_mount;
@@ -753,12 +752,31 @@ null_inactive(struct vop_inactive_args *ap __unused)
 		 * deleted, then free up the vnode so as not to tie up
 		 * the lower vnodes.
 		 */
+		return (1);
+	}
+	return (0);
+}
+
+static int
+null_inactive(struct vop_inactive_args *ap)
+{
+	struct vnode *vp;
+
+	vp = ap->a_vp;
+	if (null_want_recycle(vp)) {
 		vp->v_object = NULL;
 		vrecycle(vp);
 	}
 	return (0);
 }
 
+static int
+null_need_inactive(struct vop_need_inactive_args *ap)
+{
+
+	return (null_want_recycle(ap->a_vp));
+}
+
 /*
  * Now, the nullfs vnode and, due to the sharing lock, the lower
  * vnode, are exclusively locked, and we shall destroy the null vnode.
@@ -907,7 +925,7 @@ struct vop_vector null_vnodeops = {
 	.vop_getattr =		null_getattr,
 	.vop_getwritemount =	null_getwritemount,
 	.vop_inactive =		null_inactive,
-	.vop_need_inactive =	vop_stdneed_inactive,
+	.vop_need_inactive =	null_need_inactive,
 	.vop_islocked =		vop_stdislocked,
 	.vop_lock1 =		null_lock,
 	.vop_lookup =		null_lookup,