Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103485725
D2602.id5514.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
22 KB
Referenced Files
None
Subscribers
None
D2602.id5514.diff
View Options
Index: sys/compat/linprocfs/linprocfs.c
===================================================================
--- sys/compat/linprocfs/linprocfs.c
+++ sys/compat/linprocfs/linprocfs.c
@@ -340,7 +340,7 @@
error = namei(&nd);
lep = linux_emul_path;
if (error == 0) {
- if (vn_fullpath(td, nd.ni_vp, &dlep, &flep) == 0)
+ if (vn_fullpath(td, nd.ni_vp, 0, &dlep, &flep) == 0)
lep = dlep;
vrele(nd.ni_vp);
}
@@ -884,7 +884,7 @@
char *fullpath = "unknown";
char *freepath = NULL;
- vn_fullpath(td, p->p_fd->fd_cdir, &fullpath, &freepath);
+ vn_fullpath(td, p->p_fd->fd_cdir, 0, &fullpath, &freepath);
sbuf_printf(sb, "%s", fullpath);
if (freepath)
free(freepath, M_TEMP);
@@ -902,7 +902,7 @@
char *freepath = NULL;
rvp = jailed(p->p_ucred) ? p->p_fd->fd_jdir : p->p_fd->fd_rdir;
- vn_fullpath(td, rvp, &fullpath, &freepath);
+ vn_fullpath(td, rvp, 0, &fullpath, &freepath);
sbuf_printf(sb, "%s", fullpath);
if (freepath)
free(freepath, M_TEMP);
@@ -1053,7 +1053,7 @@
shadow_count = obj->shadow_count;
VM_OBJECT_RUNLOCK(obj);
if (vp) {
- vn_fullpath(td, vp, &name, &freename);
+ vn_fullpath(td, vp, 0, &name, &freename);
vn_lock(vp, LK_SHARED | LK_RETRY);
VOP_GETATTR(vp, &vat, td->td_ucred);
ino = vat.va_fileid;
Index: sys/dev/hwpmc/hwpmc_mod.c
===================================================================
--- sys/dev/hwpmc/hwpmc_mod.c
+++ sys/dev/hwpmc/hwpmc_mod.c
@@ -728,7 +728,7 @@
*fullpath = "unknown";
*freepath = NULL;
- vn_fullpath(curthread, v, fullpath, freepath);
+ vn_fullpath(curthread, v, 0, fullpath, freepath);
}
/*
Index: sys/fs/procfs/procfs.c
===================================================================
--- sys/fs/procfs/procfs.c
+++ sys/fs/procfs/procfs.c
@@ -77,7 +77,7 @@
textvp = p->p_textvp;
vhold(textvp);
PROC_UNLOCK(p);
- error = vn_fullpath(td, textvp, &fullpath, &freepath);
+ error = vn_fullpath(td, textvp, 0, &fullpath, &freepath);
vdrop(textvp);
if (error == 0)
sbuf_printf(sb, "%s", fullpath);
Index: sys/fs/procfs/procfs_map.c
===================================================================
--- sys/fs/procfs/procfs_map.c
+++ sys/fs/procfs/procfs_map.c
@@ -188,7 +188,7 @@
shadow_count = obj->shadow_count;
VM_OBJECT_RUNLOCK(obj);
if (vp != NULL) {
- vn_fullpath(td, vp, &fullpath, &freepath);
+ vn_fullpath(td, vp, 0, &fullpath, &freepath);
vrele(vp);
}
} else {
Index: sys/kern/imgact_elf.c
===================================================================
--- sys/kern/imgact_elf.c
+++ sys/kern/imgact_elf.c
@@ -1870,7 +1870,7 @@
sbuf_set_drain(sb, sbuf_drain_count, &size);
sbuf_bcat(sb, &structsize, sizeof(structsize));
PROC_LOCK(p);
- kern_proc_filedesc_out(p, sb, -1);
+ kern_proc_filedesc_out(p, sb, -1, LK_NOWAIT);
sbuf_finish(sb);
sbuf_delete(sb);
*sizep = size;
@@ -1878,7 +1878,7 @@
structsize = sizeof(struct kinfo_file);
sbuf_bcat(sb, &structsize, sizeof(structsize));
PROC_LOCK(p);
- kern_proc_filedesc_out(p, sb, -1);
+ kern_proc_filedesc_out(p, sb, -1, LK_NOWAIT);
}
}
Index: sys/kern/kern_descrip.c
===================================================================
--- sys/kern/kern_descrip.c
+++ sys/kern/kern_descrip.c
@@ -3090,7 +3090,7 @@
static void
export_file_to_kinfo(struct file *fp, int fd, cap_rights_t *rightsp,
- struct kinfo_file *kif, struct filedesc *fdp)
+ struct kinfo_file *kif, struct filedesc *fdp, int lkflags)
{
int error;
@@ -3111,7 +3111,7 @@
* This may drop the filedesc lock, so the 'fp' cannot be
* accessed after this call.
*/
- error = fo_fill_kinfo(fp, kif, fdp);
+ error = fo_fill_kinfo(fp, kif, fdp, lkflags);
if (error == 0)
kif->kf_status |= KF_ATTR_VALID;
pack_kinfo(kif);
@@ -3119,14 +3119,14 @@
static void
export_vnode_to_kinfo(struct vnode *vp, int fd, int fflags,
- struct kinfo_file *kif)
+ struct kinfo_file *kif, int lkflags)
{
int error;
bzero(kif, sizeof(*kif));
kif->kf_type = KF_TYPE_VNODE;
- error = vn_fill_kinfo_vnode(vp, kif);
+ error = vn_fill_kinfo_vnode(vp, kif, lkflags);
if (error == 0)
kif->kf_status |= KF_ATTR_VALID;
kif->kf_flags = xlate_fflags(fflags);
@@ -3164,13 +3164,13 @@
static int
export_file_to_sb(struct file *fp, int fd, cap_rights_t *rightsp,
- struct export_fd_buf *efbuf)
+ struct export_fd_buf *efbuf, int lkflags)
{
int error;
if (efbuf->remainder == 0)
return (0);
- export_file_to_kinfo(fp, fd, rightsp, &efbuf->kif, efbuf->fdp);
+ export_file_to_kinfo(fp, fd, rightsp, &efbuf->kif, efbuf->fdp, lkflags);
FILEDESC_SUNLOCK(efbuf->fdp);
error = export_kinfo_to_sb(efbuf);
FILEDESC_SLOCK(efbuf->fdp);
@@ -3179,7 +3179,7 @@
static int
export_vnode_to_sb(struct vnode *vp, int fd, int fflags,
- struct export_fd_buf *efbuf)
+ struct export_fd_buf *efbuf, int lkflags)
{
int error;
@@ -3187,7 +3187,7 @@
return (0);
if (efbuf->fdp != NULL)
FILEDESC_SUNLOCK(efbuf->fdp);
- export_vnode_to_kinfo(vp, fd, fflags, &efbuf->kif);
+ export_vnode_to_kinfo(vp, fd, fflags, &efbuf->kif, lkflags);
error = export_kinfo_to_sb(efbuf);
if (efbuf->fdp != NULL)
FILEDESC_SLOCK(efbuf->fdp);
@@ -3198,9 +3198,12 @@
* Store a process file descriptor information to sbuf.
*
* Takes a locked proc as argument, and returns with the proc unlocked.
+ *
+ * LK_NOWAIT may be passed in lkflags to avoid sleeping on vnode locks.
*/
int
-kern_proc_filedesc_out(struct proc *p, struct sbuf *sb, ssize_t maxlen)
+kern_proc_filedesc_out(struct proc *p, struct sbuf *sb, ssize_t maxlen,
+ int lkflags)
{
struct file *fp;
struct filedesc *fdp;
@@ -3234,12 +3237,13 @@
efbuf->remainder = maxlen;
if (tracevp != NULL)
export_vnode_to_sb(tracevp, KF_FD_TYPE_TRACE, FREAD | FWRITE,
- efbuf);
+ efbuf, lkflags);
if (textvp != NULL)
- export_vnode_to_sb(textvp, KF_FD_TYPE_TEXT, FREAD, efbuf);
+ export_vnode_to_sb(textvp, KF_FD_TYPE_TEXT, FREAD, efbuf,
+ lkflags);
if (cttyvp != NULL)
export_vnode_to_sb(cttyvp, KF_FD_TYPE_CTTY, FREAD | FWRITE,
- efbuf);
+ efbuf, lkflags);
error = 0;
if (fdp == NULL)
goto fail;
@@ -3248,17 +3252,20 @@
/* working directory */
if (fdp->fd_cdir != NULL) {
vref(fdp->fd_cdir);
- export_vnode_to_sb(fdp->fd_cdir, KF_FD_TYPE_CWD, FREAD, efbuf);
+ export_vnode_to_sb(fdp->fd_cdir, KF_FD_TYPE_CWD, FREAD, efbuf,
+ lkflags);
}
/* root directory */
if (fdp->fd_rdir != NULL) {
vref(fdp->fd_rdir);
- export_vnode_to_sb(fdp->fd_rdir, KF_FD_TYPE_ROOT, FREAD, efbuf);
+ export_vnode_to_sb(fdp->fd_rdir, KF_FD_TYPE_ROOT, FREAD, efbuf,
+ lkflags);
}
/* jail directory */
if (fdp->fd_jdir != NULL) {
vref(fdp->fd_jdir);
- export_vnode_to_sb(fdp->fd_jdir, KF_FD_TYPE_JAIL, FREAD, efbuf);
+ export_vnode_to_sb(fdp->fd_jdir, KF_FD_TYPE_JAIL, FREAD, efbuf,
+ lkflags);
}
for (i = 0; fdp->fd_refcnt > 0 && i <= fdp->fd_lastfile; i++) {
if ((fp = fdp->fd_ofiles[i].fde_file) == NULL)
@@ -3274,7 +3281,7 @@
* re-validate and re-evaluate its properties when the
* loop continues.
*/
- error = export_file_to_sb(fp, i, &rights, efbuf);
+ error = export_file_to_sb(fp, i, &rights, efbuf, lkflags);
if (error != 0 || efbuf->remainder == 0)
break;
}
@@ -3308,7 +3315,7 @@
return (error);
}
maxlen = req->oldptr != NULL ? req->oldlen : -1;
- error = kern_proc_filedesc_out(p, &sb, maxlen);
+ error = kern_proc_filedesc_out(p, &sb, maxlen, 0);
error2 = sbuf_finish(&sb);
sbuf_delete(&sb);
return (error != 0 ? error : error2);
@@ -3348,7 +3355,7 @@
vref(vp);
FILEDESC_SUNLOCK(fdp);
- export_vnode_to_kinfo(vp, type, 0, kif);
+ export_vnode_to_kinfo(vp, type, 0, kif, 0);
kinfo_to_okinfo(kif, okif);
error = SYSCTL_OUT(req, okif, sizeof(*okif));
FILEDESC_SLOCK(fdp);
@@ -3391,7 +3398,7 @@
for (i = 0; fdp->fd_refcnt > 0 && i <= fdp->fd_lastfile; i++) {
if ((fp = fdp->fd_ofiles[i].fde_file) == NULL)
continue;
- export_file_to_kinfo(fp, i, NULL, kif, fdp);
+ export_file_to_kinfo(fp, i, NULL, kif, fdp, 0);
FILEDESC_SUNLOCK(fdp);
kinfo_to_okinfo(kif, okif);
error = SYSCTL_OUT(req, okif, sizeof(*okif));
@@ -3474,7 +3481,7 @@
else {
vref(fdp->fd_cdir);
error = export_vnode_to_sb(fdp->fd_cdir, KF_FD_TYPE_CWD,
- FREAD, efbuf);
+ FREAD, efbuf, 0);
}
FILEDESC_SUNLOCK(fdp);
fddrop(fdp);
@@ -3730,7 +3737,8 @@
}
static int
-badfo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+badfo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp,
+ int lkflags)
{
return (0);
Index: sys/kern/kern_event.c
===================================================================
--- sys/kern/kern_event.c
+++ sys/kern/kern_event.c
@@ -1832,7 +1832,8 @@
}
static int
-kqueue_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+kqueue_fill_kinfo(struct file *fp, struct kinfo_file *kif,
+ struct filedesc *fdp, int lkflags)
{
kif->kf_type = KF_TYPE_KQUEUE;
Index: sys/kern/kern_exec.c
===================================================================
--- sys/kern/kern_exec.c
+++ sys/kern/kern_exec.c
@@ -550,7 +550,7 @@
*/
if (imgp->auxargs != NULL &&
((args->fname != NULL && args->fname[0] == '/') ||
- vn_fullpath(td, imgp->vp, &imgp->execpath, &imgp->freepath) != 0))
+ vn_fullpath(td, imgp->vp, 0, &imgp->execpath, &imgp->freepath) != 0))
imgp->execpath = args->fname;
if (disallow_high_osrel &&
Index: sys/kern/kern_proc.c
===================================================================
--- sys/kern/kern_proc.c
+++ sys/kern/kern_proc.c
@@ -1977,7 +1977,7 @@
vref(vp);
if (*pidp != -1)
PROC_UNLOCK(p);
- error = vn_fullpath(req->td, vp, &retbuf, &freebuf);
+ error = vn_fullpath(req->td, vp, 0, &retbuf, &freebuf);
vrele(vp);
if (error)
return (error);
@@ -2138,7 +2138,7 @@
kve->kve_shadow_count = obj->shadow_count;
VM_OBJECT_RUNLOCK(obj);
if (vp != NULL) {
- vn_fullpath(curthread, vp, &fullpath,
+ vn_fullpath(curthread, vp, 0, &fullpath,
&freepath);
cred = curthread->td_ucred;
vn_lock(vp, LK_SHARED | LK_RETRY);
@@ -2367,7 +2367,7 @@
kve->kve_shadow_count = obj->shadow_count;
VM_OBJECT_RUNLOCK(obj);
if (vp != NULL) {
- vn_fullpath(curthread, vp, &fullpath,
+ vn_fullpath(curthread, vp, 0, &fullpath,
&freepath);
kve->kve_vn_type = vntype_to_kinfo(vp->v_type);
cred = curthread->td_ucred;
Index: sys/kern/sys_pipe.c
===================================================================
--- sys/kern/sys_pipe.c
+++ sys/kern/sys_pipe.c
@@ -1610,12 +1610,13 @@
}
static int
-pipe_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+pipe_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp,
+ int lkflags)
{
struct pipe *pi;
if (fp->f_type == DTYPE_FIFO)
- return (vn_fill_kinfo(fp, kif, fdp));
+ return (vn_fill_kinfo(fp, kif, fdp, lkflags));
kif->kf_type = KF_TYPE_PIPE;
pi = fp->f_data;
kif->kf_un.kf_pipe.kf_pipe_addr = (uintptr_t)pi;
Index: sys/kern/sys_procdesc.c
===================================================================
--- sys/kern/sys_procdesc.c
+++ sys/kern/sys_procdesc.c
@@ -536,7 +536,7 @@
static int
procdesc_fill_kinfo(struct file *fp, struct kinfo_file *kif,
- struct filedesc *fdp)
+ struct filedesc *fdp, int lkflags)
{
struct procdesc *pdp;
Index: sys/kern/sys_process.c
===================================================================
--- sys/kern/sys_process.c
+++ sys/kern/sys_process.c
@@ -412,7 +412,7 @@
if (vp != NULL) {
freepath = NULL;
fullpath = NULL;
- vn_fullpath(td, vp, &fullpath, &freepath);
+ vn_fullpath(td, vp, 0, &fullpath, &freepath);
vn_lock(vp, LK_SHARED | LK_RETRY);
if (VOP_GETATTR(vp, &vattr, td->td_ucred) == 0) {
pve->pve_fileid = vattr.va_fileid;
Index: sys/kern/sys_socket.c
===================================================================
--- sys/kern/sys_socket.c
+++ sys/kern/sys_socket.c
@@ -310,7 +310,8 @@
}
static int
-soo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+soo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp,
+ int lkflags)
{
struct sockaddr *sa;
struct inpcb *inpcb;
Index: sys/kern/tty_pts.c
===================================================================
--- sys/kern/tty_pts.c
+++ sys/kern/tty_pts.c
@@ -585,7 +585,8 @@
}
static int
-ptsdev_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+ptsdev_fill_kinfo(struct file *fp, struct kinfo_file *kif,
+ struct filedesc *fdp, int lkflags)
{
struct tty *tp;
Index: sys/kern/uipc_mqueue.c
===================================================================
--- sys/kern/uipc_mqueue.c
+++ sys/kern/uipc_mqueue.c
@@ -2573,7 +2573,8 @@
}
static int
-mqf_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+mqf_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp,
+ int lkflags)
{
kif->kf_type = KF_TYPE_MQUEUE;
Index: sys/kern/uipc_sem.c
===================================================================
--- sys/kern/uipc_sem.c
+++ sys/kern/uipc_sem.c
@@ -256,7 +256,8 @@
}
static int
-ksem_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+ksem_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp,
+ int lkflags)
{
struct ksem *ks;
Index: sys/kern/uipc_shm.c
===================================================================
--- sys/kern/uipc_shm.c
+++ sys/kern/uipc_shm.c
@@ -1038,7 +1038,7 @@
}
static int
-shm_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+shm_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp, int lkflags)
{
struct shmfd *shmfd;
Index: sys/kern/vfs_cache.c
===================================================================
--- sys/kern/vfs_cache.c
+++ sys/kern/vfs_cache.c
@@ -306,10 +306,10 @@
static void cache_zap(struct namecache *ncp);
-static int vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf,
- u_int *buflen);
+static int vn_vptocnp_locked(struct vnode **vp, struct ucred *cred,
+ int lkflags, char *buf, u_int *buflen);
static int vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir,
- char *buf, char **retbuf, u_int buflen);
+ int lkflags, char *buf, char **retbuf, u_int buflen);
static MALLOC_DEFINE(M_VFSCACHE, "vfscache", "VFS name cache entries");
@@ -1081,7 +1081,7 @@
rdir = fdp->fd_rdir;
VREF(rdir);
FILEDESC_SUNLOCK(fdp);
- error = vn_fullpath1(td, cdir, rdir, tmpbuf, &bp, buflen);
+ error = vn_fullpath1(td, cdir, rdir, 0, tmpbuf, &bp, buflen);
vrele(rdir);
vrele(cdir);
@@ -1125,13 +1125,17 @@
* cache (if available)
*/
int
-vn_fullpath(struct thread *td, struct vnode *vn, char **retbuf, char **freebuf)
+vn_fullpath(struct thread *td, struct vnode *vn, int lkflags, char **retbuf,
+ char **freebuf)
{
char *buf;
struct filedesc *fdp;
struct vnode *rdir;
int error;
+ KASSERT((lkflags & ~LK_NOWAIT) == 0,
+ ("invalid lkflags: %08x", lkflags));
+
if (disablefullpath)
return (ENODEV);
if (vn == NULL)
@@ -1143,7 +1147,7 @@
rdir = fdp->fd_rdir;
VREF(rdir);
FILEDESC_SUNLOCK(fdp);
- error = vn_fullpath1(td, vn, rdir, buf, retbuf, MAXPATHLEN);
+ error = vn_fullpath1(td, vn, rdir, lkflags, buf, retbuf, MAXPATHLEN);
vrele(rdir);
if (!error)
@@ -1171,7 +1175,7 @@
if (vn == NULL)
return (EINVAL);
buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
- error = vn_fullpath1(td, vn, rootvnode, buf, retbuf, MAXPATHLEN);
+ error = vn_fullpath1(td, vn, rootvnode, 0, buf, retbuf, MAXPATHLEN);
if (!error)
*freebuf = buf;
else
@@ -1185,15 +1189,15 @@
int error;
CACHE_RLOCK();
- error = vn_vptocnp_locked(vp, cred, buf, buflen);
+ error = vn_vptocnp_locked(vp, cred, 0, buf, buflen);
if (error == 0)
CACHE_RUNLOCK();
return (error);
}
static int
-vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf,
- u_int *buflen)
+vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, int lkflags,
+ char *buf, u_int *buflen)
{
struct vnode *dvp;
struct namecache *ncp;
@@ -1228,9 +1232,17 @@
SDT_PROBE(vfs, namecache, fullpath, miss, vp, 0, 0, 0, 0);
CACHE_RUNLOCK();
- vn_lock(*vp, LK_SHARED | LK_RETRY);
- error = VOP_VPTOCNP(*vp, &dvp, cred, buf, buflen);
- vput(*vp);
+
+ lkflags |= LK_SHARED;
+ if ((lkflags & LK_NOWAIT) == 0)
+ lkflags |= LK_RETRY;
+ error = vn_lock(*vp, lkflags);
+ if (error)
+ vrele(*vp);
+ else {
+ error = VOP_VPTOCNP(*vp, &dvp, cred, buf, buflen);
+ vput(*vp);
+ }
if (error) {
numfullpathfail2++;
SDT_PROBE(vfs, namecache, fullpath, return, error, vp,
@@ -1261,7 +1273,7 @@
*/
static int
vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir,
- char *buf, char **retbuf, u_int buflen)
+ int lkflags, char *buf, char **retbuf, u_int buflen)
{
int error, slash_prefixed;
#ifdef KDTRACE_HOOKS
@@ -1279,7 +1291,7 @@
vref(vp);
CACHE_RLOCK();
if (vp->v_type != VDIR) {
- error = vn_vptocnp_locked(&vp, td->td_ucred, buf, &buflen);
+ error = vn_vptocnp_locked(&vp, td->td_ucred, lkflags, buf, &buflen);
if (error)
return (error);
if (buflen == 0) {
@@ -1317,7 +1329,7 @@
error, vp, NULL, 0, 0);
break;
}
- error = vn_vptocnp_locked(&vp, td->td_ucred, buf, &buflen);
+ error = vn_vptocnp_locked(&vp, td->td_ucred, lkflags, buf, &buflen);
if (error)
break;
if (buflen == 0) {
Index: sys/kern/vfs_vnops.c
===================================================================
--- sys/kern/vfs_vnops.c
+++ sys/kern/vfs_vnops.c
@@ -2302,7 +2302,8 @@
}
int
-vn_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+vn_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp,
+ int lkflags)
{
struct vnode *vp;
int error;
@@ -2314,23 +2315,26 @@
vp = fp->f_vnode;
vref(vp);
FILEDESC_SUNLOCK(fdp);
- error = vn_fill_kinfo_vnode(vp, kif);
+ error = vn_fill_kinfo_vnode(vp, kif, lkflags);
vrele(vp);
FILEDESC_SLOCK(fdp);
return (error);
}
int
-vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif)
+vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif, int lkflags)
{
struct vattr va;
char *fullpath, *freepath;
int error;
+ KASSERT((lkflags & ~LK_NOWAIT) == 0,
+ ("invalid lkflags: %08x", lkflags));
+
kif->kf_vnode_type = vntype_to_kinfo(vp->v_type);
freepath = NULL;
fullpath = "-";
- error = vn_fullpath(curthread, vp, &fullpath, &freepath);
+ error = vn_fullpath(curthread, vp, lkflags, &fullpath, &freepath);
if (error == 0) {
strlcpy(kif->kf_path, fullpath, sizeof(kif->kf_path));
}
@@ -2342,7 +2346,14 @@
*/
va.va_fsid = VNOVAL;
va.va_rdev = NODEV;
- vn_lock(vp, LK_SHARED | LK_RETRY);
+
+ lkflags |= LK_SHARED;
+ if ((lkflags & LK_NOWAIT) == 0)
+ lkflags |= LK_RETRY;
+
+ error = vn_lock(vp, lkflags);
+ if (error != 0)
+ return (error);
error = VOP_GETATTR(vp, &va, curthread->td_ucred);
VOP_UNLOCK(vp, 0);
if (error != 0)
Index: sys/ofed/include/linux/linux_compat.c
===================================================================
--- sys/ofed/include/linux/linux_compat.c
+++ sys/ofed/include/linux/linux_compat.c
@@ -590,7 +590,7 @@
static int
linux_file_fill_kinfo(struct file *fp, struct kinfo_file *kif,
- struct filedesc *fdp)
+ struct filedesc *fdp, int lkflags)
{
return (0);
Index: sys/opencrypto/cryptodev.c
===================================================================
--- sys/opencrypto/cryptodev.c
+++ sys/opencrypto/cryptodev.c
@@ -300,7 +300,7 @@
struct ucred *, struct thread *);
static int cryptof_close(struct file *, struct thread *);
static int cryptof_fill_kinfo(struct file *, struct kinfo_file *,
- struct filedesc *);
+ struct filedesc *, int);
static struct fileops cryptofops = {
.fo_read = invfo_rdwr,
@@ -1196,7 +1196,8 @@
}
static int
-cryptof_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+cryptof_fill_kinfo(struct file *fp, struct kinfo_file *kif,
+ struct filedesc *fdp, int lkflags)
{
kif->kf_type = KF_TYPE_CRYPTO;
Index: sys/security/audit/audit_bsm_klib.c
===================================================================
--- sys/security/audit/audit_bsm_klib.c
+++ sys/security/audit/audit_bsm_klib.c
@@ -542,7 +542,7 @@
free(fbuf, M_TEMP);
}
if (cvnp != NULL) {
- error = vn_fullpath(td, cvnp, &rbuf, &fbuf);
+ error = vn_fullpath(td, cvnp, 0, &rbuf, &fbuf);
vdrop(cvnp);
if (error) {
cpath[0] = '\0';
Index: sys/sys/file.h
===================================================================
--- sys/sys/file.h
+++ sys/sys/file.h
@@ -113,7 +113,7 @@
typedef int fo_seek_t(struct file *fp, off_t offset, int whence,
struct thread *td);
typedef int fo_fill_kinfo_t(struct file *fp, struct kinfo_file *kif,
- struct filedesc *fdp);
+ struct filedesc *fdp, int lkflags);
typedef int fo_flags_t;
struct fileops {
@@ -246,7 +246,7 @@
fo_sendfile_t vn_sendfile;
fo_seek_t vn_seek;
fo_fill_kinfo_t vn_fill_kinfo;
-int vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif);
+int vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif, int lkflags);
void finit(struct file *, u_int, short, void *, struct fileops *);
int fgetvp(struct thread *td, int fd, cap_rights_t *rightsp,
@@ -384,10 +384,11 @@
}
static __inline int
-fo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+fo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp,
+ int lkflags)
{
- return ((*fp->f_ops->fo_fill_kinfo)(fp, kif, fdp));
+ return ((*fp->f_ops->fo_fill_kinfo)(fp, kif, fdp, lkflags));
}
#endif /* _KERNEL */
Index: sys/sys/user.h
===================================================================
--- sys/sys/user.h
+++ sys/sys/user.h
@@ -529,7 +529,8 @@
* to be locked on enter. On return the process is unlocked.
*/
-int kern_proc_filedesc_out(struct proc *p, struct sbuf *sb, ssize_t maxlen);
+int kern_proc_filedesc_out(struct proc *p, struct sbuf *sb, ssize_t maxlen,
+ int lkflags);
int kern_proc_cwd_out(struct proc *p, struct sbuf *sb, ssize_t maxlen);
int kern_proc_out(struct proc *p, struct sbuf *sb, int flags);
int kern_proc_vmmap_out(struct proc *p, struct sbuf *sb);
Index: sys/sys/vnode.h
===================================================================
--- sys/sys/vnode.h
+++ sys/sys/vnode.h
@@ -630,8 +630,8 @@
int vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf,
u_int *buflen);
#define textvp_fullpath(p, rb, rfb) \
- vn_fullpath(FIRST_THREAD_IN_PROC(p), (p)->p_textvp, rb, rfb)
-int vn_fullpath(struct thread *td, struct vnode *vn,
+ vn_fullpath(FIRST_THREAD_IN_PROC(p), (p)->p_textvp, 0, rb, rfb)
+int vn_fullpath(struct thread *td, struct vnode *vn, int lkflags,
char **retbuf, char **freebuf);
int vn_fullpath_global(struct thread *td, struct vnode *vn,
char **retbuf, char **freebuf);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 3:36 PM (4 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14864025
Default Alt Text
D2602.id5514.diff (22 KB)
Attached To
Mode
D2602: imgact_elf: Make note_procstat_files best-effort to avoid deadlock
Attached
Detach File
Event Timeline
Log In to Comment