Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Hold the current lwp's mutex, instead of the lwp we...



details:   https://anonhg.NetBSD.org/src/rev/36554d6fb520
branches:  trunk
changeset: 764536:36554d6fb520
user:      ahoka <ahoka%NetBSD.org@localhost>
date:      Tue Apr 26 17:40:38 2011 +0000

description:
Hold the current lwp's mutex, instead of the lwp we want to wait for
in kthread_join(). This fixes panics with DIAGNOSTIC and possibly some
rare race conditons.

diffstat:

 sys/kern/kern_kthread.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r d3efea96f668 -r 36554d6fb520 sys/kern/kern_kthread.c
--- a/sys/kern/kern_kthread.c   Tue Apr 26 17:31:57 2011 +0000
+++ b/sys/kern/kern_kthread.c   Tue Apr 26 17:40:38 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_kthread.c,v 1.31 2011/02/17 19:27:13 matt Exp $   */
+/*     $NetBSD: kern_kthread.c,v 1.32 2011/04/26 17:40:38 ahoka Exp $  */
 
 /*-
  * Copyright (c) 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.31 2011/02/17 19:27:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.32 2011/04/26 17:40:38 ahoka Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -221,7 +221,7 @@
        KASSERT((l->l_flag & LW_SYSTEM) != 0);
        KASSERT((l->l_prflag & LPR_DETACHED) == 0);
        
-       p = l->l_proc;
+       p = curlwp->l_proc;
 
        mutex_enter(p->p_lock);
        error = lwp_wait1(curlwp, l->l_lid, &departed, LWPWAIT_EXITCONTROL);



Home | Main Index | Thread Index | Old Index