svn commit: r342226 - releng/11.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Ed Maste emaste at FreeBSD.org
Wed Dec 19 18:05:51 UTC 2018


Author: emaste
Date: Wed Dec 19 18:05:50 2018
New Revision: 342226
URL: https://svnweb.freebsd.org/changeset/base/342226

Log:
  MFS11 r341828: Resolve a hang in ZFS during vnode reclaimation
  
    This is caused by a deadlock between zil_commit() and zfs_zget()
    Add a way for zfs_zget() to break out of the retry loop in the common case
  
  PR:		229614, 231117
  Submitted by:	allanjude
  Approved by:	so
  Security:	FreeBSD-EN-18:18.zfs
  Sponsored by:	Klara Systems, The FreeBSD Foundation

Modified:
  releng/11.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
Directory Properties:
  releng/11.2/   (props changed)

Modified: releng/11.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==============================================================================
--- releng/11.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Wed Dec 19 18:00:58 2018	(r342225)
+++ releng/11.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Wed Dec 19 18:05:50 2018	(r342226)
@@ -1155,15 +1155,27 @@ again:
 		 */
 		ASSERT3P(zp, !=, NULL);
 		ASSERT3U(zp->z_id, ==, obj_num);
-		*zpp = zp;
-		vp = ZTOV(zp);
+		if (zp->z_unlinked) {
+			err = SET_ERROR(ENOENT);
+		} else {
+			vp = ZTOV(zp);
+			/*
+			 * Don't let the vnode disappear after
+			 * ZFS_OBJ_HOLD_EXIT.
+			 */
+			VN_HOLD(vp);
+			*zpp = zp;
+			err = 0;
+		}
 
-		/* Don't let the vnode disappear after ZFS_OBJ_HOLD_EXIT. */
-		VN_HOLD(vp);
-
 		sa_buf_rele(db, NULL);
 		ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
 
+		if (err) {
+			getnewvnode_drop_reserve();
+			return (err);
+		}
+
 		locked = VOP_ISLOCKED(vp);
 		VI_LOCK(vp);
 		if ((vp->v_iflag & VI_DOOMED) != 0 &&
@@ -1196,7 +1208,7 @@ again:
 		}
 		VI_UNLOCK(vp);
 		getnewvnode_drop_reserve();
-		return (0);
+		return (err);
 	}
 
 	/*


More information about the svn-src-releng mailing list