Sat Nov 7 20:49:19 2015 UTC ()
Pull up following revision(s) (requested by pgoyette in ticket #1981):
	sys/kern/kern_exit.c: revision 1.248
Update value of p_stat before we release the proc_lock.  Thanks to
Robert Elz.


(snj)
diff -r1.214.4.2.2.1 -r1.214.4.2.2.2 src/sys/kern/kern_exit.c

cvs diff -r1.214.4.2.2.1 -r1.214.4.2.2.2 src/sys/kern/kern_exit.c (expand / switch to unified diff)

--- src/sys/kern/kern_exit.c 2015/11/07 20:42:59 1.214.4.2.2.1
+++ src/sys/kern/kern_exit.c 2015/11/07 20:49:19 1.214.4.2.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_exit.c,v 1.214.4.2.2.1 2015/11/07 20:42:59 snj Exp $ */ 1/* $NetBSD: kern_exit.c,v 1.214.4.2.2.2 2015/11/07 20:49:19 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center, and by Andrew Doran. 9 * NASA Ames Research Center, and by Andrew Doran.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -57,27 +57,27 @@ @@ -57,27 +57,27 @@
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE. 64 * SUCH DAMAGE.
65 * 65 *
66 * @(#)kern_exit.c 8.10 (Berkeley) 2/23/95 66 * @(#)kern_exit.c 8.10 (Berkeley) 2/23/95
67 */ 67 */
68 68
69#include <sys/cdefs.h> 69#include <sys/cdefs.h>
70__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.214.4.2.2.1 2015/11/07 20:42:59 snj Exp $"); 70__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.214.4.2.2.2 2015/11/07 20:49:19 snj Exp $");
71 71
72#include "opt_ktrace.h" 72#include "opt_ktrace.h"
73#include "opt_perfctrs.h" 73#include "opt_perfctrs.h"
74#include "opt_sa.h" 74#include "opt_sa.h"
75#include "opt_sysv.h" 75#include "opt_sysv.h"
76 76
77#include <sys/param.h> 77#include <sys/param.h>
78#include <sys/aio.h> 78#include <sys/aio.h>
79#include <sys/systm.h> 79#include <sys/systm.h>
80#include <sys/ioctl.h> 80#include <sys/ioctl.h>
81#include <sys/tty.h> 81#include <sys/tty.h>
82#include <sys/time.h> 82#include <sys/time.h>
83#include <sys/resource.h> 83#include <sys/resource.h>
@@ -232,28 +232,28 @@ exit1(struct lwp *l, int rv) @@ -232,28 +232,28 @@ exit1(struct lwp *l, int rv)
232 * If we have been asked to stop on exit, do so now. 232 * If we have been asked to stop on exit, do so now.
233 */ 233 */
234 if (__predict_false(p->p_sflag & PS_STOPEXIT)) { 234 if (__predict_false(p->p_sflag & PS_STOPEXIT)) {
235 KERNEL_UNLOCK_ALL(l, &l->l_biglocks); 235 KERNEL_UNLOCK_ALL(l, &l->l_biglocks);
236 sigclearall(p, &contsigmask, &kq); 236 sigclearall(p, &contsigmask, &kq);
237 237
238 if (!mutex_tryenter(proc_lock)) { 238 if (!mutex_tryenter(proc_lock)) {
239 mutex_exit(p->p_lock); 239 mutex_exit(p->p_lock);
240 mutex_enter(proc_lock); 240 mutex_enter(proc_lock);
241 mutex_enter(p->p_lock); 241 mutex_enter(p->p_lock);
242 } 242 }
243 p->p_waited = 0; 243 p->p_waited = 0;
244 p->p_pptr->p_nstopchild++; 244 p->p_pptr->p_nstopchild++;
245 mutex_exit(proc_lock); 
246 p->p_stat = SSTOP; 245 p->p_stat = SSTOP;
 246 mutex_exit(proc_lock);
247 lwp_lock(l); 247 lwp_lock(l);
248 p->p_nrlwps--; 248 p->p_nrlwps--;
249 l->l_stat = LSSTOP; 249 l->l_stat = LSSTOP;
250 mutex_exit(p->p_lock); 250 mutex_exit(p->p_lock);
251 mi_switch(l); 251 mi_switch(l);
252 KERNEL_LOCK(l->l_biglocks, l); 252 KERNEL_LOCK(l->l_biglocks, l);
253 mutex_enter(p->p_lock); 253 mutex_enter(p->p_lock);
254 } 254 }
255 255
256 /* 256 /*
257 * Bin any remaining signals and mark the process as dying so it will 257 * Bin any remaining signals and mark the process as dying so it will
258 * not be found for, e.g. signals.  258 * not be found for, e.g. signals.
259 */ 259 */