Source-Changes-HG archive

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

[src/trunk]: src/sys/kern fork1: fix stop-on-fork case, lend a correct lock t...



details:   https://anonhg.NetBSD.org/src/rev/61e6d10b38df
branches:  trunk
changeset: 764974:61e6d10b38df
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sat May 14 18:50:07 2011 +0000

description:
fork1: fix stop-on-fork case, lend a correct lock to LWP for LSSTOP state.

Fixes PR/44935.

diffstat:

 sys/kern/kern_fork.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 0195995533d5 -r 61e6d10b38df sys/kern/kern_fork.c
--- a/sys/kern/kern_fork.c      Sat May 14 18:24:47 2011 +0000
+++ b/sys/kern/kern_fork.c      Sat May 14 18:50:07 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_fork.c,v 1.183 2011/05/01 01:15:18 rmind Exp $    */
+/*     $NetBSD: kern_fork.c,v 1.184 2011/05/14 18:50:07 rmind Exp $    */
 
 /*-
  * Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.183 2011/05/01 01:15:18 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.184 2011/05/14 18:50:07 rmind Exp $");
 
 #include "opt_ktrace.h"
 
@@ -506,12 +506,14 @@
        lwp_lock(l2);
        KASSERT(p2->p_nrlwps == 1);
        if (p2->p_sflag & PS_STOPFORK) {
+               struct schedstate_percpu *spc = &l2->l_cpu->ci_schedstate;
                p2->p_nrlwps = 0;
                p2->p_stat = SSTOP;
                p2->p_waited = 0;
                p1->p_nstopchild++;
                l2->l_stat = LSSTOP;
-               lwp_unlock(l2);
+               KASSERT(l2->l_wchan == NULL);
+               lwp_unlock_to(l2, spc->spc_lwplock);
        } else {
                p2->p_nrlwps = 1;
                p2->p_stat = SACTIVE;
@@ -519,7 +521,6 @@
                sched_enqueue(l2, false);
                lwp_unlock(l2);
        }
-
        mutex_exit(p2->p_lock);
 
        /*



Home | Main Index | Thread Index | Old Index