From f3c8997bfe2fd24413bac3ec75350d77ce6049d1 Mon Sep 17 00:00:00 2001 From: pooka Date: Thu, 22 Jul 2010 21:00:07 +0000 Subject: [PATCH] Reset l_mutex when waking up a thread. select uses it to determine if a thread is still selecting, and would get a KASSERT panic if the thread had been woken up but not run yet when selnotify() was called. --- sys/rump/librump/rumpkern/sleepq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/rump/librump/rumpkern/sleepq.c b/sys/rump/librump/rumpkern/sleepq.c index a59701efaa79..1914b61e616d 100644 --- a/sys/rump/librump/rumpkern/sleepq.c +++ b/sys/rump/librump/rumpkern/sleepq.c @@ -1,4 +1,4 @@ -/* $NetBSD: sleepq.c,v 1.6 2009/11/17 15:23:42 pooka Exp $ */ +/* $NetBSD: sleepq.c,v 1.7 2010/07/22 21:00:07 pooka Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.6 2009/11/17 15:23:42 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.7 2010/07/22 21:00:07 pooka Exp $"); #include #include @@ -112,6 +112,7 @@ sleepq_wake(sleepq_t *sq, wchan_t wchan, u_int expected, kmutex_t *mp) if (l->l_wchan == wchan) { found = true; l->l_wchan = NULL; + l->l_mutex = NULL; TAILQ_REMOVE(sq, l, l_sleepchain); } } @@ -127,6 +128,7 @@ sleepq_unsleep(struct lwp *l, bool cleanup) { l->l_wchan = NULL; + l->l_mutex = NULL; TAILQ_REMOVE(l->l_sleepq, l, l_sleepchain); cv_broadcast(&sq_cv);