Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/fdescfs/fdesc_vnops.c
Show First 20 Lines • Show All 249 Lines • ▼ Show 20 Lines | loop: | ||||
*vpp = vp; | *vpp = vp; | ||||
return (0); | return (0); | ||||
} | } | ||||
struct fdesc_get_ino_args { | struct fdesc_get_ino_args { | ||||
fdntype ftype; | fdntype ftype; | ||||
unsigned fd_fd; | unsigned fd_fd; | ||||
int ix; | int ix; | ||||
bool use_real_vp; | |||||
struct file *fp; | struct file *fp; | ||||
struct thread *td; | struct thread *td; | ||||
}; | }; | ||||
static int | static int | ||||
fdesc_get_ino_alloc(struct mount *mp, void *arg, int lkflags, | fdesc_get_ino_alloc(struct mount *mp, void *arg, int lkflags, | ||||
struct vnode **rvp) | struct vnode **rvp) | ||||
{ | { | ||||
struct fdesc_get_ino_args *a; | struct fdesc_get_ino_args *a; | ||||
struct vnode *vp; | |||||
int error; | int error; | ||||
a = arg; | a = arg; | ||||
if (a->use_real_vp && a->fp->f_type == DTYPE_VNODE) { | |||||
vp = a->fp->f_vnode; | |||||
vget(vp, lkflags | LK_RETRY); | |||||
*rvp = vp; | |||||
error = 0; | |||||
} else { | |||||
error = fdesc_allocvp(a->ftype, a->fd_fd, a->ix, mp, rvp); | error = fdesc_allocvp(a->ftype, a->fd_fd, a->ix, mp, rvp); | ||||
} | |||||
fdrop(a->fp, a->td); | fdrop(a->fp, a->td); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* vp is the current namei directory | * vp is the current namei directory | ||||
* ndp is the name to locate in that directory... | * ndp is the name to locate in that directory... | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | if (VTOFDESC(dvp)->fd_ix == FD_DESC + fd) { | ||||
* and the root vnode lock will be obtained afterwards (in case | * and the root vnode lock will be obtained afterwards (in case | ||||
* we're looking up the fd of the root vnode), which will be the | * we're looking up the fd of the root vnode), which will be the | ||||
* opposite lock order. Vhold the root vnode first so we don't | * opposite lock order. Vhold the root vnode first so we don't | ||||
* lose it. | * lose it. | ||||
*/ | */ | ||||
arg.ftype = Fdesc; | arg.ftype = Fdesc; | ||||
arg.fd_fd = fd; | arg.fd_fd = fd; | ||||
arg.ix = FD_DESC + fd; | arg.ix = FD_DESC + fd; | ||||
arg.use_real_vp = cnp->cn_nameiop == LOOKUP && | |||||
(cnp->cn_flags & ISOPEN) == 0; | |||||
arg.fp = fp; | arg.fp = fp; | ||||
arg.td = td; | arg.td = td; | ||||
error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg, | error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg, | ||||
LK_EXCLUSIVE, &fvp); | LK_EXCLUSIVE, &fvp); | ||||
} | } | ||||
if (error) | if (error) | ||||
goto bad; | goto bad; | ||||
▲ Show 20 Lines • Show All 289 Lines • Show Last 20 Lines |