summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index a29dc17..ebd4e6d 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -630,12 +630,13 @@ do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2,
/*
* Set the child start time and mark the process as being complete.
*/
+ PROC_LOCK(p2);
+ PROC_LOCK(p1);
microuptime(&p2->p_stats->p_start);
PROC_SLOCK(p2);
p2->p_state = PRS_NORMAL;
PROC_SUNLOCK(p2);
- PROC_LOCK(p1);
#ifdef KDTRACE_HOOKS
/*
* Tell the DTrace fasttrap provider about the new process
@@ -643,11 +644,8 @@ do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2,
* p_state is PRS_NORMAL since the fasttrap module will use pfind()
* later on.
*/
- if (dtrace_fasttrap_fork) {
- PROC_LOCK(p2);
+ if (dtrace_fasttrap_fork)
dtrace_fasttrap_fork(p1, p2);
- PROC_UNLOCK(p2);
- }
#endif
if ((p1->p_flag & (P_TRACED | P_FOLLOWFORK)) == (P_TRACED |
P_FOLLOWFORK)) {
@@ -660,12 +658,11 @@ do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2,
*/
td->td_dbgflags |= TDB_FORK;
td->td_dbg_forked = p2->p_pid;
- PROC_LOCK(p2);
td2->td_dbgflags |= TDB_STOPATFORK;
_PHOLD(p2);
p2_held = 1;
- PROC_UNLOCK(p2);
}
+ PROC_UNLOCK(p2);
if ((flags & RFSTOPPED) == 0) {
/*
* If RFSTOPPED not requested, make child runnable and
OpenPOWER on IntegriCloud