summaryrefslogtreecommitdiff
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 209883c59b4..d1dc798669e 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.82 2007/11/28 20:07:36 oga Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.83 2007/11/30 16:44:44 oga Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -144,7 +144,7 @@ int
msleep(void *ident, struct mutex *mtx, int priority, const char *wmesg, int timo)
{
struct sleep_state sls;
- int error, error1;
+ int error, error1, spl;
sleep_setup(&sls, ident, priority, wmesg);
sleep_setup_timeout(&sls, timo);
@@ -155,6 +155,7 @@ msleep(void *ident, struct mutex *mtx, int priority, const char *wmesg, int tim
* unblock splsched. This can be made a bit more
* correct when the sched_lock is a mutex.
*/
+ spl = MUTEX_OLDIPL(mtx);
MUTEX_OLDIPL(mtx) = splsched();
mtx_leave(mtx);
}
@@ -166,6 +167,7 @@ msleep(void *ident, struct mutex *mtx, int priority, const char *wmesg, int tim
if (mtx && (priority & PNORELOCK) == 0)
mtx_enter(mtx);
+ MUTEX_OLDIPL(mtx) = spl; /* put the ipl back else it breaks things */
/* Signal errors are higher priority than timeouts. */
if (error == 0 && error1 != 0)
error = error1;