diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 4cafb9fdea94..461ecc2270c7 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -448,7 +448,6 @@ exit1(struct thread *td, int rval, int signo) WITNESS_WARN(WARN_PANIC, NULL, "process (pid %d) exiting", p->p_pid); - sx_xlock(&proctree_lock); /* * Move proc from allproc queue to zombproc. */ @@ -459,6 +458,8 @@ exit1(struct thread *td, int rval, int signo) sx_xunlock(&zombproc_lock); sx_xunlock(&allproc_lock); + sx_xlock(&proctree_lock); + /* * Reparent all children processes: * - traced ones to the original parent (or init if we are that parent)