Reduce the scope of the vnode lock such that it does not cover

the various copyouts associated with initializing the process's
argv/env data in userspace.  It is possible that these copyout
operations can fault under memory pressure, possibly resulting
in dead locks.  This is believed to be safe since none of the
copyout_strings() operations need to interact with the vnode here.

Submitted by:	Zhouyi Zhou
PR:		kern/111260
Discussed with:	kib
MFC after:	3 weeks
This commit is contained in:
csjp 2008-08-12 21:27:48 +00:00
parent 664b89e716
commit 0cdadff20e

View File

@ -513,6 +513,11 @@ do_execve(td, args, mac_p)
goto interpret;
}
/*
* NB: We unlock the vnode here because it is believed that none
* of the sv_copyout_strings/sv_fixup operations require the vnode.
*/
VOP_UNLOCK(imgp->vp, 0);
/*
* Copy out strings (args and env) and initialize stack base
*/
@ -550,7 +555,6 @@ do_execve(td, args, mac_p)
}
/* close files on exec */
VOP_UNLOCK(imgp->vp, 0);
fdcloseexec(td);
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY);