Lock the vnode around the call to VOP_GETATTR. Move the locked code
and vn_fullpath (that call malloc(..., M_WAITOK)) from under the vm object lock, since sleep is not allowed while holding the mutex. Being there, wrap VOP_GETATTR call with conditional Giant aquire. Currently this is (almost) noop because pseudofs is Giant-locked. Tested by: kris Approved by: pjd (mentor) MFC after: 2 weeks
This commit is contained in:
parent
7f557ac0a7
commit
1565bf54af
@ -803,6 +803,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
|
|||||||
int error;
|
int error;
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
struct vattr vat;
|
struct vattr vat;
|
||||||
|
int locked;
|
||||||
|
|
||||||
PROC_LOCK(p);
|
PROC_LOCK(p);
|
||||||
error = p_candebug(td, p);
|
error = p_candebug(td, p);
|
||||||
@ -831,18 +832,28 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
|
|||||||
lobj = tobj;
|
lobj = tobj;
|
||||||
ino = 0;
|
ino = 0;
|
||||||
if (lobj) {
|
if (lobj) {
|
||||||
vp = lobj->handle;
|
|
||||||
VM_OBJECT_LOCK(lobj);
|
VM_OBJECT_LOCK(lobj);
|
||||||
off = IDX_TO_OFF(lobj->size);
|
off = IDX_TO_OFF(lobj->size);
|
||||||
if (lobj->type == OBJT_VNODE && lobj->handle) {
|
if (lobj->type == OBJT_VNODE) {
|
||||||
vn_fullpath(td, vp, &name, &freename);
|
vp = lobj->handle;
|
||||||
VOP_GETATTR(vp, &vat, td->td_ucred, td);
|
if (vp)
|
||||||
ino = vat.va_fileid;
|
vref(vp);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
vp = NULL;
|
||||||
flags = obj->flags;
|
flags = obj->flags;
|
||||||
ref_count = obj->ref_count;
|
ref_count = obj->ref_count;
|
||||||
shadow_count = obj->shadow_count;
|
shadow_count = obj->shadow_count;
|
||||||
VM_OBJECT_UNLOCK(lobj);
|
VM_OBJECT_UNLOCK(lobj);
|
||||||
|
if (vp) {
|
||||||
|
vn_fullpath(td, vp, &name, &freename);
|
||||||
|
locked = VFS_LOCK_GIANT(vp->v_mount);
|
||||||
|
vn_lock(vp, LK_SHARED | LK_RETRY, td);
|
||||||
|
VOP_GETATTR(vp, &vat, td->td_ucred, td);
|
||||||
|
ino = vat.va_fileid;
|
||||||
|
vput(vp);
|
||||||
|
VFS_UNLOCK_GIANT(locked);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
flags = 0;
|
flags = 0;
|
||||||
ref_count = 0;
|
ref_count = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user