diff options
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r-- | sys/kern/kern_exit.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 5fec31b..2d35ed5 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -903,15 +903,19 @@ loop: void proc_reparent(struct proc *child, struct proc *parent) { + int locked; sx_assert(&proctree_lock, SX_XLOCKED); PROC_LOCK_ASSERT(child, MA_OWNED); if (child->p_pptr == parent) return; - PROC_LOCK(parent); + locked = PROC_LOCKED(parent); + if (!locked) + PROC_LOCK(parent); racct_add_force(parent, RACCT_NPROC, 1); - PROC_UNLOCK(parent); + if (!locked) + PROC_UNLOCK(parent); PROC_LOCK(child->p_pptr); racct_sub(child->p_pptr, RACCT_NPROC, 1); sigqueue_take(child->p_ksi); |