PERFORCE change 91933 for review
John Baldwin
jhb at FreeBSD.org
Fri Feb 17 08:49:33 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=91933
Change 91933 by jhb at jhb_slimer on 2006/02/17 16:49:17
- Note the S_EXIT stop event before setting P_WEXIT so processes
that are watching us can notice the exit w/o getting EIO back.
- Do set P_WEXIT before the next wakeup of any waiting processes.
They will get EIO, but they weren't listening for exits, so this
matches previous behavior. Note that we don't handle multiple
listeners at all. (And have never done so it seems)
- Move the STOPEVENT and friends up to where we set P_WEXIT to
avoid one more set of proc lock / unlock.
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_exit.c#111 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_exit.c#111 (text+ko) ====
@@ -173,8 +173,30 @@
*/
}
+ /*
+ * Wakeup anyone in procfs' PIOCWAIT. They should have a hold
+ * on our vmspace, so we should block below until they have
+ * released their reference to us. Note that if they have
+ * requested S_EXIT stops we will block here until they ack
+ * via PIOCCONT.
+ */
+ _STOPEVENT(p, S_EXIT, rv);
+
+ /*
+ * Note that we are exiting and do another wakeup of anyone in
+ * PIOCWAIT in case they aren't listening for S_EXIT stops or
+ * decided to wait again after we told them we are exiting.
+ */
p->p_flag |= P_WEXIT;
+ wakeup(&p->p_stype);
+ /*
+ * Wait for any processes that have a hold on our vmspace to
+ * release their reference.
+ */
+ while (p->p_lock > 0)
+ msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0);
+
PROC_LOCK(p->p_pptr);
sigqueue_take(p->p_ksi);
PROC_UNLOCK(p->p_pptr);
@@ -196,25 +218,6 @@
mtx_unlock(&ppeers_lock);
}
- PROC_LOCK(p);
- _STOPEVENT(p, S_EXIT, rv);
-
- /*
- * Wakeup anyone in procfs' PIOCWAIT. They should have a hold
- * on our vmspace, so we should block below until they have
- * released their reference to us.
- */
- wakeup(&p->p_stype);
-
- /*
- * Wait for any processes that have a hold on our vmspace to
- * release their reference.
- */
- while (p->p_lock > 0)
- msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0);
-
- PROC_UNLOCK(p);
-
/*
* Check if any loadable modules need anything done at process exit.
* E.g. SYSV IPC stuff
More information about the p4-projects
mailing list