Date: Sat, 1 Dec 2012 19:12:44 +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-9@freebsd.org Subject: svn commit: r243767 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <201212011912.qB1JCipk073775@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Sat Dec 1 19:12:43 2012 New Revision: 243767 URL: http://svnweb.freebsd.org/changeset/base/243767 Log: MFC r242575: zfs_dirlook: bailout early if directory is unlinked Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Sat Dec 1 19:05:47 2012 (r243766) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Sat Dec 1 19:12:43 2012 (r243767) @@ -374,8 +374,15 @@ zfs_dirlook(znode_t *dzp, char *name, vn znode_t *zp; int error = 0; uint64_t parent; + int unlinked; if (name[0] == 0 || (name[0] == '.' && name[1] == 0)) { + mutex_enter(&dzp->z_lock); + unlinked = dzp->z_unlinked; + mutex_exit(&dzp->z_lock); + if (unlinked) + return (ENOENT); + *vpp = ZTOV(dzp); VN_HOLD(*vpp); } else if (name[0] == '.' && name[1] == '.' && name[2] == 0) { @@ -394,6 +401,13 @@ zfs_dirlook(znode_t *dzp, char *name, vn NULL, NULL, NULL); return (error); } + + mutex_enter(&dzp->z_lock); + unlinked = dzp->z_unlinked; + mutex_exit(&dzp->z_lock); + if (unlinked) + return (ENOENT); + rw_enter(&dzp->z_parent_lock, RW_READER); error = zfs_zget(zfsvfs, parent, &zp); if (error == 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212011912.qB1JCipk073775>