Date: Tue, 11 Dec 2018 19:34:25 +0000 (UTC) From: Allan Jude <allanjude@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341828 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <201812111934.wBBJYP8i070060@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: allanjude Date: Tue Dec 11 19:34:25 2018 New Revision: 341828 URL: https://svnweb.freebsd.org/changeset/base/341828 Log: MFC: r339289: 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 Reported by: grembo, jhb, Andreas Sommer, others Relnotes: yes Sponsored by: Klara Systems Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue Dec 11 19:32:16 2018 (r341827) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue Dec 11 19:34:25 2018 (r341828) @@ -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); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812111934.wBBJYP8i070060>