changeset 4736:f8714efb3e12

6509628 unmount of a snapshot (from 'zfs destroy') is slow
author ek110237
date Thu, 26 Jul 2007 09:37:15 -0700
parents a8f42b34829b
children 56a3be29f72c
files usr/src/uts/common/fs/zfs/zfs_ctldir.c usr/src/uts/common/fs/zfs/zfs_vfsops.c
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/zfs_ctldir.c	Thu Jul 26 09:16:35 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/zfs_ctldir.c	Thu Jul 26 09:37:15 2007 -0700
@@ -719,6 +719,10 @@
 	if (err == 0) {
 		/*
 		 * Fix up the root vnode.
+		 *
+		 * This is where we lie about our v_vfsp in order to
+		 * make .zfs/snapshot/<snapdir> accessible over NFS
+		 * without requiring manual mounts of <snapdir>.
 		 */
 		ASSERT(VTOZ(*vpp)->z_zfsvfs != zfsvfs);
 		VTOZ(*vpp)->z_zfsvfs->z_parent = zfsvfs;
--- a/usr/src/uts/common/fs/zfs/zfs_vfsops.c	Thu Jul 26 09:16:35 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/zfs_vfsops.c	Thu Jul 26 09:37:15 2007 -0700
@@ -1019,7 +1019,13 @@
 			return (ret);
 	}
 
-	(void) dnlc_purge_vfsp(vfsp, 0);
+	/*
+	 * We purge the parent filesystem's vfsp as the parent filesystem
+	 * and all of its snapshots have their vnode's v_vfsp set to the
+	 * parent's filesystem's vfsp.  Note, 'z_parent' is self
+	 * referential for non-snapshots.
+	 */
+	(void) dnlc_purge_vfsp(zfsvfs->z_parent->z_vfs, 0);
 
 	/*
 	 * Unmount any snapshots mounted under .zfs before unmounting the