diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2007-11-30 16:44:45 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2007-11-30 16:44:45 +0000 |
commit | 807dad5587553b4d8ed003a446d3df1c545e1f4b (patch) | |
tree | b37456e9d3cfb9032acc7e2e7f32871165b96608 /sys/kern | |
parent | 39fde46772e4d19b6bd8884cfb4472426d6b1ec0 (diff) |
Fix msleep.
Since mutexes mess around with spl levels, and the sched-lock isn't a
mutex, we need to make sure to fix the IPL when msleep does the locking.
ok art.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_synch.c | 6 |
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; |