Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
Show First 20 Lines • Show All 1,159 Lines • ▼ Show 20 Lines | if (hdl != NULL) { | ||||
/* | /* | ||||
* Since "SA" does immediate eviction we | * Since "SA" does immediate eviction we | ||||
* should never find a sa handle that doesn't | * should never find a sa handle that doesn't | ||||
* know about the znode. | * know about the znode. | ||||
*/ | */ | ||||
ASSERT3P(zp, !=, NULL); | ASSERT3P(zp, !=, NULL); | ||||
ASSERT3U(zp->z_id, ==, obj_num); | ASSERT3U(zp->z_id, ==, obj_num); | ||||
*zpp = zp; | if (zp->z_unlinked) { | ||||
err = SET_ERROR(ENOENT); | |||||
} else { | |||||
vp = ZTOV(zp); | vp = ZTOV(zp); | ||||
/* | |||||
/* Don't let the vnode disappear after ZFS_OBJ_HOLD_EXIT. */ | * Don't let the vnode disappear after | ||||
* ZFS_OBJ_HOLD_EXIT. | |||||
*/ | |||||
VN_HOLD(vp); | VN_HOLD(vp); | ||||
*zpp = zp; | |||||
err = 0; | |||||
} | |||||
sa_buf_rele(db, NULL); | sa_buf_rele(db, NULL); | ||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); | ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); | ||||
if (err) { | |||||
getnewvnode_drop_reserve(); | |||||
return (err); | |||||
} | |||||
locked = VOP_ISLOCKED(vp); | locked = VOP_ISLOCKED(vp); | ||||
VI_LOCK(vp); | VI_LOCK(vp); | ||||
if ((vp->v_iflag & VI_DOOMED) != 0 && | if ((vp->v_iflag & VI_DOOMED) != 0 && | ||||
locked != LK_EXCLUSIVE) { | locked != LK_EXCLUSIVE) { | ||||
/* | /* | ||||
* The vnode is doomed and this thread doesn't | * The vnode is doomed and this thread doesn't | ||||
* hold the exclusive lock on it, so the vnode | * hold the exclusive lock on it, so the vnode | ||||
* must be being reclaimed by another thread. | * must be being reclaimed by another thread. | ||||
Show All 16 Lines | if ((vp->v_iflag & VI_DOOMED) != 0 && | ||||
* should also have a refrence to the vnode and thus | * should also have a refrence to the vnode and thus | ||||
* our reference is not last. | * our reference is not last. | ||||
*/ | */ | ||||
VN_RELE(vp); | VN_RELE(vp); | ||||
goto again; | goto again; | ||||
} | } | ||||
VI_UNLOCK(vp); | VI_UNLOCK(vp); | ||||
getnewvnode_drop_reserve(); | getnewvnode_drop_reserve(); | ||||
return (0); | return (err); | ||||
} | } | ||||
/* | /* | ||||
* Not found create new znode/vnode | * Not found create new znode/vnode | ||||
* but only if file exists. | * but only if file exists. | ||||
* | * | ||||
* There is a small window where zfs_vget() could | * There is a small window where zfs_vget() could | ||||
* find this object while a file create is still in | * find this object while a file create is still in | ||||
▲ Show 20 Lines • Show All 1,060 Lines • Show Last 20 Lines |