Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Mar 2018 11:04:30 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r330989 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201803151104.w2FB4Uww010412@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Thu Mar 15 11:04:30 2018
New Revision: 330989
URL: https://svnweb.freebsd.org/changeset/base/330989

Log:
  MFC r330057: add ZFS_ENTER protection to .zfs/snapshot vnode operations that need it

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	Thu Mar 15 11:03:39 2018	(r330988)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	Thu Mar 15 11:04:30 2018	(r330989)
@@ -1071,6 +1071,7 @@ zfsctl_snapdir_readdir(ap)
 		return (error);
 	}
 
+	ZFS_ENTER(zfsvfs);
 	for (;;) {
 		uint64_t cookie;
 		uint64_t id;
@@ -1087,6 +1088,7 @@ zfsctl_snapdir_readdir(ap)
 					*eofp = 1;
 				error = 0;
 			}
+			ZFS_EXIT(zfsvfs);
 			return (error);
 		}
 
@@ -1099,6 +1101,7 @@ zfsctl_snapdir_readdir(ap)
 		if (error != 0) {
 			if (error == ENAMETOOLONG)
 				error = 0;
+			ZFS_EXIT(zfsvfs);
 			return (SET_ERROR(error));
 		}
 		uio->uio_offset = cookie + dots_offset;
@@ -1122,6 +1125,7 @@ zfsctl_snapdir_getattr(ap)
 	uint64_t snap_count;
 	int err;
 
+	ZFS_ENTER(zfsvfs);
 	zfsctl_common_getattr(vp, vap);
 	vap->va_ctime = dmu_objset_snap_cmtime(zfsvfs->z_os);
 	vap->va_mtime = vap->va_ctime;
@@ -1129,12 +1133,15 @@ zfsctl_snapdir_getattr(ap)
 	if (dsl_dataset_phys(ds)->ds_snapnames_zapobj != 0) {
 		err = zap_count(dmu_objset_pool(ds->ds_objset)->dp_meta_objset,
 		    dsl_dataset_phys(ds)->ds_snapnames_zapobj, &snap_count);
-		if (err != 0)
+		if (err != 0) {
+			ZFS_EXIT(zfsvfs);
 			return (err);
+		}
 		vap->va_nlink += snap_count;
 	}
 	vap->va_size = vap->va_nlink;
 
+	ZFS_EXIT(zfsvfs);
 	return (0);
 }
 



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