Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
Show First 20 Lines • Show All 2,020 Lines • ▼ Show 20 Lines | zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp) | ||||
*/ | */ | ||||
if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR || | if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR || | ||||
(zfsvfs->z_shares_dir != 0 && ino == zfsvfs->z_shares_dir)) | (zfsvfs->z_shares_dir != 0 && ino == zfsvfs->z_shares_dir)) | ||||
return (EOPNOTSUPP); | return (EOPNOTSUPP); | ||||
ZFS_ENTER(zfsvfs); | ZFS_ENTER(zfsvfs); | ||||
err = zfs_zget(zfsvfs, ino, &zp); | err = zfs_zget(zfsvfs, ino, &zp); | ||||
if (err == 0 && zp->z_unlinked) { | if (err == 0 && zp->z_unlinked) { | ||||
VN_RELE(ZTOV(zp)); | vrele(ZTOV(zp)); | ||||
err = EINVAL; | err = EINVAL; | ||||
} | } | ||||
if (err == 0) | if (err == 0) | ||||
*vpp = ZTOV(zp); | *vpp = ZTOV(zp); | ||||
ZFS_EXIT(zfsvfs); | ZFS_EXIT(zfsvfs); | ||||
if (err == 0) | if (err == 0) | ||||
err = vn_lock(*vpp, flags); | err = vn_lock(*vpp, flags); | ||||
if (err != 0) | if (err != 0) | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | if ((fid_gen == 0 && | ||||
ASSERT(*vpp != NULL); | ASSERT(*vpp != NULL); | ||||
if (object == ZFSCTL_INO_SNAPDIR) { | if (object == ZFSCTL_INO_SNAPDIR) { | ||||
VERIFY(zfsctl_root_lookup(*vpp, "snapshot", vpp, NULL, | VERIFY(zfsctl_root_lookup(*vpp, "snapshot", vpp, NULL, | ||||
0, NULL, NULL, NULL, NULL, NULL) == 0); | 0, NULL, NULL, NULL, NULL, NULL) == 0); | ||||
} else if (object == zfsvfs->z_shares_dir) { | } else if (object == zfsvfs->z_shares_dir) { | ||||
VERIFY(zfsctl_root_lookup(*vpp, "shares", vpp, NULL, | VERIFY(zfsctl_root_lookup(*vpp, "shares", vpp, NULL, | ||||
0, NULL, NULL, NULL, NULL, NULL) == 0); | 0, NULL, NULL, NULL, NULL, NULL) == 0); | ||||
} else { | } else { | ||||
VN_HOLD(*vpp); | vref(*vpp); | ||||
} | } | ||||
ZFS_EXIT(zfsvfs); | ZFS_EXIT(zfsvfs); | ||||
err = vn_lock(*vpp, flags); | err = vn_lock(*vpp, flags); | ||||
if (err != 0) | if (err != 0) | ||||
*vpp = NULL; | *vpp = NULL; | ||||
return (err); | return (err); | ||||
} | } | ||||
gen_mask = -1ULL >> (64 - 8 * i); | gen_mask = -1ULL >> (64 - 8 * i); | ||||
dprintf("getting %llu [%u mask %llx]\n", object, fid_gen, gen_mask); | dprintf("getting %llu [%u mask %llx]\n", object, fid_gen, gen_mask); | ||||
if (err = zfs_zget(zfsvfs, object, &zp)) { | if (err = zfs_zget(zfsvfs, object, &zp)) { | ||||
ZFS_EXIT(zfsvfs); | ZFS_EXIT(zfsvfs); | ||||
return (err); | return (err); | ||||
} | } | ||||
(void) sa_lookup(zp->z_sa_hdl, SA_ZPL_GEN(zfsvfs), &zp_gen, | (void) sa_lookup(zp->z_sa_hdl, SA_ZPL_GEN(zfsvfs), &zp_gen, | ||||
sizeof (uint64_t)); | sizeof (uint64_t)); | ||||
zp_gen = zp_gen & gen_mask; | zp_gen = zp_gen & gen_mask; | ||||
if (zp_gen == 0) | if (zp_gen == 0) | ||||
zp_gen = 1; | zp_gen = 1; | ||||
if (zp->z_unlinked || zp_gen != fid_gen) { | if (zp->z_unlinked || zp_gen != fid_gen) { | ||||
dprintf("znode gen (%u) != fid gen (%u)\n", zp_gen, fid_gen); | dprintf("znode gen (%u) != fid gen (%u)\n", zp_gen, fid_gen); | ||||
VN_RELE(ZTOV(zp)); | vrele(ZTOV(zp)); | ||||
ZFS_EXIT(zfsvfs); | ZFS_EXIT(zfsvfs); | ||||
return (SET_ERROR(EINVAL)); | return (SET_ERROR(EINVAL)); | ||||
} | } | ||||
*vpp = ZTOV(zp); | *vpp = ZTOV(zp); | ||||
ZFS_EXIT(zfsvfs); | ZFS_EXIT(zfsvfs); | ||||
err = vn_lock(*vpp, flags | LK_RETRY); | err = vn_lock(*vpp, flags | LK_RETRY); | ||||
if (err == 0) | if (err == 0) | ||||
▲ Show 20 Lines • Show All 344 Lines • Show Last 20 Lines |