diff options
author | peter <peter@FreeBSD.org> | 2004-03-08 00:32:34 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2004-03-08 00:32:34 +0000 |
commit | 836666b0d7cc612f961d25108685a66627464b68 (patch) | |
tree | 625080582047b5a5afc45ce13753bac4859d09b1 /sys | |
parent | 8da7b98c54b09d30fbd6d781f752611de18efae1 (diff) | |
download | FreeBSD-src-836666b0d7cc612f961d25108685a66627464b68.zip FreeBSD-src-836666b0d7cc612f961d25108685a66627464b68.tar.gz |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_fork.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 1c39c42..34a1bfd 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -474,7 +474,6 @@ again: 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 @@ again: 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 @@ again: 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. */ |