diff options
author | avg <avg@FreeBSD.org> | 2017-03-23 08:16:29 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2017-03-23 08:16:29 +0000 |
commit | fa225268a01ab93c33cbfd59dbae30840795e930 (patch) | |
tree | 0faeff73e4f659bac9ab0c1b903929473fa31dda /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | |
parent | 081727b69c5da8348dfb201c7bc8340360368fbe (diff) | |
download | FreeBSD-src-fa225268a01ab93c33cbfd59dbae30840795e930.zip FreeBSD-src-fa225268a01ab93c33cbfd59dbae30840795e930.tar.gz |
MFC r314048,r314194: reimplement zfsctl (.zfs) support
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 37 |
1 files changed, 22 insertions, 15 deletions
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 d0c506e..7208b19 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 @@ -1616,27 +1616,34 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, * the vp for the snapshot directory. */ if (zdp->z_id == zfsvfs->z_root && zfsvfs->z_parent != zfsvfs) { - error = zfsctl_root_lookup(zfsvfs->z_parent->z_ctldir, - "snapshot", vpp, NULL, 0, NULL, kcred, - NULL, NULL, NULL); + struct componentname cn; + vnode_t *zfsctl_vp; + int ltype; + ZFS_EXIT(zfsvfs); + ltype = VOP_ISLOCKED(dvp); + VOP_UNLOCK(dvp, 0); + error = zfsctl_root(zfsvfs->z_parent, LK_SHARED, + &zfsctl_vp); if (error == 0) { - error = zfs_lookup_lock(dvp, *vpp, nm, - cnp->cn_lkflags); + 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_lkflags = cnp->cn_lkflags; + error = VOP_LOOKUP(zfsctl_vp, vpp, &cn); + vput(zfsctl_vp); } - goto out; + vn_lock(dvp, ltype | LK_RETRY); + return (error); } } if (zfs_has_ctldir(zdp) && strcmp(nm, ZFS_CTLDIR_NAME) == 0) { - error = 0; - if ((cnp->cn_flags & ISLASTCN) != 0 && nameiop != LOOKUP) - error = SET_ERROR(ENOTSUP); - else - *vpp = zfsctl_root(zdp); ZFS_EXIT(zfsvfs); - if (error == 0) - error = zfs_lookup_lock(dvp, *vpp, nm, cnp->cn_lkflags); - goto out; + if ((cnp->cn_flags & ISLASTCN) != 0 && nameiop != LOOKUP) + return (SET_ERROR(ENOTSUP)); + error = zfsctl_root(zfsvfs, cnp->cn_lkflags, vpp); + return (error); } /* @@ -6004,7 +6011,7 @@ zfs_vptocnp(struct vop_vptocnp_args *ap) vhold(covered_vp); ltype = VOP_ISLOCKED(vp); VOP_UNLOCK(vp, 0); - error = vget(covered_vp, LK_EXCLUSIVE, curthread); + error = vget(covered_vp, LK_SHARED, curthread); vdrop(covered_vp); if (error == 0) { error = VOP_VPTOCNP(covered_vp, ap->a_vpp, ap->a_cred, |