Unlock the pseudofs vnode before calling fill method for pfs_readlink().

The fill code may need to lock another vnode, e.g. procfs file
implementation.

Reviewed by:	des
Tested by:	pho
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2009-05-31 15:01:50 +00:00
parent b0f34bb643
commit b00098d164

View File

@ -827,7 +827,7 @@ pfs_readlink(struct vop_readlink_args *va)
struct proc *proc = NULL;
char buf[PATH_MAX];
struct sbuf sb;
int error;
int error, locked;
PFS_TRACE(("%s", pn->pn_name));
pfs_assert_not_owned(pn);
@ -849,6 +849,9 @@ pfs_readlink(struct vop_readlink_args *va)
_PHOLD(proc);
PROC_UNLOCK(proc);
}
vhold(vn);
locked = VOP_ISLOCKED(vn);
VOP_UNLOCK(vn, 0);
/* sbuf_new() can't fail with a static buffer */
sbuf_new(&sb, buf, sizeof buf, 0);
@ -857,6 +860,8 @@ pfs_readlink(struct vop_readlink_args *va)
if (proc != NULL)
PRELE(proc);
vn_lock(vn, locked | LK_RETRY);
vdrop(vn);
if (error) {
sbuf_delete(&sb);