Move a vref call outside of proc locks and Giant. By virtue of the fact
that we (p1) are currently running, we hold a reference on p_textvp which means the vnode cannot go away. p2 cannot run yet (and hence cannot exit) so this should be safe to do at this point. As a bonus, it removes a block of under-Giant code that was there to support the vref.
This commit is contained in:
parent
b8f8da5d90
commit
a69d88af52
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126737
@ -474,7 +474,6 @@ fork1(td, flags, pages, procp)
|
||||
if (pages != 0)
|
||||
vm_thread_new_altkstack(td2, pages);
|
||||
|
||||
mtx_lock(&Giant); /* XXX: for VREF() */
|
||||
PROC_LOCK(p2);
|
||||
PROC_LOCK(p1);
|
||||
|
||||
@ -537,11 +536,7 @@ fork1(td, flags, pages, procp)
|
||||
else
|
||||
p2->p_sigparent = SIGCHLD;
|
||||
|
||||
/* Bump references to the text vnode (for procfs) */
|
||||
p2->p_textvp = p1->p_textvp;
|
||||
if (p2->p_textvp)
|
||||
VREF(p2->p_textvp);
|
||||
mtx_unlock(&Giant); /* XXX: for VREF() */
|
||||
p2->p_fd = fd;
|
||||
p2->p_fdtol = fdtol;
|
||||
|
||||
@ -552,6 +547,10 @@ fork1(td, flags, pages, procp)
|
||||
PROC_UNLOCK(p1);
|
||||
PROC_UNLOCK(p2);
|
||||
|
||||
/* Bump references to the text vnode (for procfs) */
|
||||
if (p2->p_textvp)
|
||||
vref(p2->p_textvp);
|
||||
|
||||
/*
|
||||
* Set up linkage for kernel based threading.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user