Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 May 2016 15:37:41 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299949 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201605161537.u4GFbfs5030525@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Mon May 16 15:37:41 2016
New Revision: 299949
URL: https://svnweb.freebsd.org/changeset/base/299949

Log:
  try to recycle "snap" vnodes as soon as possible
  
  Those vnodes should not linger.  "Stale" nodes may get out of
  synchronization with actual snapshots.  For example if we destroy a
  snapshot and create a new one with the same name.  Or when we rename a
  snapshot.
  
  While there fix the argument type for zfsctl_snapshot_reclaim().
  Also, its original argument can be passed to gfs_vop_reclaim() directly.
  
  Bug 209093 could be related although I have not specifically verified
  that.  Referencing just in case.
  
  PR:		209093
  MFC after:	5 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	Mon May 16 15:32:02 2016	(r299948)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	Mon May 16 15:37:41 2016	(r299949)
@@ -1490,17 +1490,28 @@ zfsctl_snapshot_mknode(vnode_t *pvp, uin
 	return (vp);
 }
 
+static int
+zfsctl_snapshot_inactive(ap)
+	struct vop_inactive_args /* {
+		struct vnode *a_vp;
+		struct thread *a_td;
+	} */ *ap;
+{
+	vnode_t *vp = ap->a_vp;
+
+	vrecycle(vp);
+	return (0);
+}
 
 static int
 zfsctl_snapshot_reclaim(ap)
-	struct vop_inactive_args /* {
+	struct vop_reclaim_args /* {
 		struct vnode *a_vp;
 		struct thread *a_td;
 	} */ *ap;
 {
 	vnode_t *vp = ap->a_vp;
 	cred_t *cr = ap->a_td->td_ucred;
-	struct vop_reclaim_args iap;
 	zfsctl_snapdir_t *sdp;
 	zfs_snapentry_t *sep, *next;
 	int locked;
@@ -1543,8 +1554,7 @@ zfsctl_snapshot_reclaim(ap)
 	 * "active".  If we lookup the same name again we will end up
 	 * creating a new vnode.
 	 */
-	iap.a_vp = vp;
-	gfs_vop_reclaim(&iap);
+	gfs_vop_reclaim(ap);
 	return (0);
 
 }
@@ -1597,7 +1607,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptoc
  */
 static struct vop_vector zfsctl_ops_snapshot = {
 	.vop_default =	&default_vnodeops,
-	.vop_inactive =	VOP_NULL,
+	.vop_inactive =	zfsctl_snapshot_inactive,
 	.vop_reclaim =	zfsctl_snapshot_reclaim,
 	.vop_vptocnp =	zfsctl_snapshot_vptocnp,
 };



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605161537.u4GFbfs5030525>