Module Name: src Committed By: bouyer Date: Sun Feb 5 12:28:15 UTC 2012
Modified Files: src/sys/kern [netbsd-5-0]: kern_fork.c Log Message: Pull up following revision(s) (requested by rmind in ticket #1628): sys/kern/kern_fork.c: revision 1.184 via patch fork1: fix stop-on-fork case, lend a correct lock to LWP for LSSTOP state. Fixes PR/44935. To generate a diff of this commit: cvs rdiff -u -r1.171.8.1 -r1.171.8.2 src/sys/kern/kern_fork.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_fork.c diff -u src/sys/kern/kern_fork.c:1.171.8.1 src/sys/kern/kern_fork.c:1.171.8.2 --- src/sys/kern/kern_fork.c:1.171.8.1 Sat Jun 18 16:36:09 2011 +++ src/sys/kern/kern_fork.c Sun Feb 5 12:28:14 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_fork.c,v 1.171.8.1 2011/06/18 16:36:09 bouyer Exp $ */ +/* $NetBSD: kern_fork.c,v 1.171.8.2 2012/02/05 12:28:14 bouyer 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.171.8.1 2011/06/18 16:36:09 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.171.8.2 2012/02/05 12:28:14 bouyer Exp $"); #include "opt_ktrace.h" @@ -509,13 +509,15 @@ fork1(struct lwp *l1, int flags, int exi p2->p_acflag = AFORK; lwp_lock(l2); 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; l2->l_flag |= tmp; - lwp_unlock(l2); + KASSERT(l2->l_wchan == NULL); + lwp_unlock_to(l2, spc->spc_lwplock); } else { p2->p_nrlwps = 1; p2->p_stat = SACTIVE; @@ -524,7 +526,6 @@ fork1(struct lwp *l1, int flags, int exi sched_enqueue(l2, false); lwp_unlock(l2); } - mutex_exit(p2->p_lock); /*