Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Show First 20 Lines • Show All 1,606 Lines • ▼ Show 20 Lines | #endif | ||||
* First handle the special cases. | * First handle the special cases. | ||||
*/ | */ | ||||
if ((cnp->cn_flags & ISDOTDOT) != 0) { | if ((cnp->cn_flags & ISDOTDOT) != 0) { | ||||
/* | /* | ||||
* If we are a snapshot mounted under .zfs, return | * If we are a snapshot mounted under .zfs, return | ||||
* the vp for the snapshot directory. | * the vp for the snapshot directory. | ||||
*/ | */ | ||||
if (zdp->z_id == zfsvfs->z_root && zfsvfs->z_parent != zfsvfs) { | if (zdp->z_id == zfsvfs->z_root && zfsvfs->z_parent != zfsvfs) { | ||||
error = zfsctl_root_lookup(zfsvfs->z_parent->z_ctldir, | struct componentname cn; | ||||
"snapshot", vpp, NULL, 0, NULL, kcred, | vnode_t *zfsctl_vp; | ||||
NULL, NULL, NULL); | int ltype; | ||||
ZFS_EXIT(zfsvfs); | ZFS_EXIT(zfsvfs); | ||||
ltype = VOP_ISLOCKED(dvp); | |||||
VOP_UNLOCK(dvp, 0); | |||||
error = zfsctl_root(zfsvfs->z_parent, LK_SHARED, | |||||
&zfsctl_vp); | |||||
if (error == 0) { | if (error == 0) { | ||||
error = zfs_lookup_lock(dvp, *vpp, nm, | cn.cn_nameptr = "snapshot"; | ||||
cnp->cn_lkflags); | 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) { | 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); | ZFS_EXIT(zfsvfs); | ||||
if (error == 0) | if ((cnp->cn_flags & ISLASTCN) != 0 && nameiop != LOOKUP) | ||||
error = zfs_lookup_lock(dvp, *vpp, nm, cnp->cn_lkflags); | return (SET_ERROR(ENOTSUP)); | ||||
goto out; | error = zfsctl_root(zfsvfs, cnp->cn_lkflags, vpp); | ||||
smh: redundant assignment | |||||
avgAuthorUnsubmitted Not Done Inline Actionssame as above :) avg: same as above :) | |||||
return (error); | |||||
} | } | ||||
/* | /* | ||||
* The loop is retry the lookup if the parent-child relationship | * The loop is retry the lookup if the parent-child relationship | ||||
* changes during the dot-dot locking complexities. | * changes during the dot-dot locking complexities. | ||||
*/ | */ | ||||
for (;;) { | for (;;) { | ||||
uint64_t parent; | uint64_t parent; | ||||
▲ Show 20 Lines • Show All 4,307 Lines • ▼ Show 20 Lines | if (zp->z_id != parent || zfsvfs->z_parent == zfsvfs) { | ||||
return (error); | return (error); | ||||
} | } | ||||
ZFS_EXIT(zfsvfs); | ZFS_EXIT(zfsvfs); | ||||
covered_vp = vp->v_mount->mnt_vnodecovered; | covered_vp = vp->v_mount->mnt_vnodecovered; | ||||
vhold(covered_vp); | vhold(covered_vp); | ||||
ltype = VOP_ISLOCKED(vp); | ltype = VOP_ISLOCKED(vp); | ||||
VOP_UNLOCK(vp, 0); | VOP_UNLOCK(vp, 0); | ||||
error = vget(covered_vp, LK_EXCLUSIVE | LK_VNHELD, curthread); | error = vget(covered_vp, LK_SHARED | LK_VNHELD, curthread); | ||||
if (error == 0) { | if (error == 0) { | ||||
error = VOP_VPTOCNP(covered_vp, ap->a_vpp, ap->a_cred, | error = VOP_VPTOCNP(covered_vp, ap->a_vpp, ap->a_cred, | ||||
ap->a_buf, ap->a_buflen); | ap->a_buf, ap->a_buflen); | ||||
vput(covered_vp); | vput(covered_vp); | ||||
} | } | ||||
vn_lock(vp, ltype | LK_RETRY); | vn_lock(vp, ltype | LK_RETRY); | ||||
if ((vp->v_iflag & VI_DOOMED) != 0) | if ((vp->v_iflag & VI_DOOMED) != 0) | ||||
error = SET_ERROR(ENOENT); | error = SET_ERROR(ENOENT); | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |
redundant assignment