Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern exit_lwps: fix a race which causes a panic "setrunn...



details:   https://anonhg.NetBSD.org/src/rev/bac489495df4
branches:  trunk
changeset: 583509:bac489495df4
user:      yamt <yamt%NetBSD.org@localhost>
date:      Wed Aug 10 09:42:03 2005 +0000

description:
exit_lwps: fix a race which causes a panic "setrunnable: lwp %p state was %d".

diffstat:

 sys/kern/kern_exit.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 4b6277cc89ab -r bac489495df4 sys/kern/kern_exit.c
--- a/sys/kern/kern_exit.c      Wed Aug 10 06:51:24 2005 +0000
+++ b/sys/kern/kern_exit.c      Wed Aug 10 09:42:03 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exit.c,v 1.148 2005/05/29 22:24:15 christos Exp $ */
+/*     $NetBSD: kern_exit.c,v 1.149 2005/08/10 09:42:03 yamt Exp $     */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.148 2005/05/29 22:24:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.149 2005/08/10 09:42:03 yamt Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_perfctrs.h"
@@ -595,14 +595,14 @@
        LIST_FOREACH(l2, &p->p_lwps, l_sibling) {
                l2->l_flag &= ~(L_DETACHED|L_SA);
 
+               SCHED_LOCK(s);
                if ((l2->l_stat == LSSLEEP && (l2->l_flag & L_SINTR)) ||
                    l2->l_stat == LSSUSPENDED || l2->l_stat == LSSTOP) {
-                       SCHED_LOCK(s);
                        setrunnable(l2);
-                       SCHED_UNLOCK(s);
                        DPRINTF(("exit_lwps: Made %d.%d runnable\n",
                            p->p_pid, l2->l_lid));
                }
+               SCHED_UNLOCK(s);
        }
 
 



Home | Main Index | Thread Index | Old Index