From 1628f75af1b70ae8381eee2464d739dc9115c98c Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Mon, 29 May 2017 06:30:34 +0000 Subject: [PATCH] zfs_lookup: fix bogus arguments to lookup of "snapshot" directory When a parent directory lookup is done at the root of a snapshot mounted under .zfs/snapshot directory, we need to look up that directory in the parent filesystem. We achieve that by doing a VOP_LOOKUP operation on a .zfs vnode with "snapshot" as a target name. But previously we also passed ISDOTDOT flag to the lookup and, because of that, the lookup actually returned the parent of the .zfs vnode, that is, a root vnode of the parent filesystem. Reported by: lev Tested by: lev MFC after: 3 days --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index e9a61d9c8ae2..90514860e8ba 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -1635,7 +1635,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, cn.cn_nameptr = "snapshot"; cn.cn_namelen = strlen(cn.cn_nameptr); cn.cn_nameiop = cnp->cn_nameiop; - cn.cn_flags = cnp->cn_flags; + cn.cn_flags = cnp->cn_flags & ~ISDOTDOT; cn.cn_lkflags = cnp->cn_lkflags; error = VOP_LOOKUP(zfsctl_vp, vpp, &cn); vput(zfsctl_vp);