summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2000-12-01 03:42:17 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2000-12-01 03:42:17 +0000
commit472fd56ea581255ced6da5814785db036f1cd3e0 (patch)
tree3164cfa381c759f4a145644d9eafc5091a20159f /sys/kern/kern_exit.c
parent723aebe85e6a25c267db8ff178068f7b2042aa80 (diff)
Notes
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index a57b914441a2..1c03e7bbc52d 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -267,10 +267,16 @@ exit1(p, rv)
lockmgr(&allproc_lock, LK_EXCLUSIVE, NULL, CURPROC);
LIST_REMOVE(p, p_list);
LIST_INSERT_HEAD(&zombproc, p, p_list);
- p->p_stat = SZOMB;
LIST_REMOVE(p, p_hash);
lockmgr(&allproc_lock, LK_RELEASE, NULL, CURPROC);
+ /*
+ * We have to wait until after releasing this lock before
+ * changing p_stat. If we block on a mutex while waiting to
+ * release the allproc_lock, then we will be back at SRUN when
+ * we resume here and our parent will never harvest us.
+ */
+ p->p_stat = SZOMB;
q = LIST_FIRST(&p->p_children);
if (q) /* only need this if any child is S_ZOMB */