Module Name:    src
Committed By:   pgoyette
Date:           Tue Oct 13 00:25:52 UTC 2015

Modified Files:
        src/sys/kern: kern_synch.c

Log Message:
When clearing out the scheduler queues during system shutdown, we move
all processes to the SSTOP state.  Make sure we update each process's
p_waited and the parents' p_nstopchild counters to maintain consistent
values.  Should not make any real difference this late in the shutdown
process, but we should still be consistent just in case.

Fixes PR kern/50318

Pullups will be requested for:

       NetBSD-7, -6, -6-0, -6-1, -5, -5-0, -5-1, and -5-2


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/sys/kern/kern_synch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_synch.c
diff -u src/sys/kern/kern_synch.c:1.308 src/sys/kern/kern_synch.c:1.309
--- src/sys/kern/kern_synch.c:1.308	Fri Feb 28 10:16:51 2014
+++ src/sys/kern/kern_synch.c	Tue Oct 13 00:25:51 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.308 2014/02/28 10:16:51 skrll Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.309 2015/10/13 00:25:51 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.308 2014/02/28 10:16:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.309 2015/10/13 00:25:51 pgoyette Exp $");
 
 #include "opt_kstack.h"
 #include "opt_perfctrs.h"
@@ -985,7 +985,13 @@ suspendsched(void)
 			continue;
 		}
 
-		p->p_stat = SSTOP;
+		if (p->p_stat != SSTOP) {
+			if (p->p_stat != SZOMB && p->p_stat != SDEAD) {
+				p->p_pptr->p_nstopchild++;
+				p->p_waited = 0;
+			}
+			p->p_stat = SSTOP;
+		}
 
 		LIST_FOREACH(l, &p->p_lwps, l_sibling) {
 			if (l == curlwp)

Reply via email to