summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-11-29 18:32:50 +0000
committerjhb <jhb@FreeBSD.org>2000-11-29 18:32:50 +0000
commit896b5da5191ff4114d68d09f418bf72a8bddc52d (patch)
tree56be26cca72f1c8e155b7b0de954c62ad26afd21 /sys/kern/kern_synch.c
parent9712e17cfeeeead7f7c14055f700198f949b00fa (diff)
downloadFreeBSD-src-896b5da5191ff4114d68d09f418bf72a8bddc52d.zip
FreeBSD-src-896b5da5191ff4114d68d09f418bf72a8bddc52d.tar.gz
Don't drop Giant and the passed in mutex incorrectly in the
cold || panicstr case. Do drop the passed in mutex in that case if PDROP is specified.
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index bf4b89d..45ad0f0 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -426,16 +426,6 @@ msleep(ident, mtx, priority, wmesg, timo)
#endif
WITNESS_SLEEP(0, mtx);
mtx_enter(&sched_lock, MTX_SPIN);
- DROP_GIANT_NOSWITCH();
-
- if (mtx != NULL) {
- mtx_assert(mtx, MA_OWNED | MA_NOTRECURSED);
- WITNESS_SAVE(mtx, mtx);
- mtx_exit(mtx, MTX_DEF | MTX_NOSWITCH);
- if (priority & PDROP)
- mtx = NULL;
- }
-
s = splhigh();
if (cold || panicstr) {
/*
@@ -444,11 +434,23 @@ msleep(ident, mtx, priority, wmesg, timo)
* don't run any other procs or panic below,
* in case this is the idle process and already asleep.
*/
+ if (mtx != NULL && priority & PDROP)
+ mtx_exit(mtx, MTX_DEF | MTX_NOSWITCH);
mtx_exit(&sched_lock, MTX_SPIN);
splx(s);
return (0);
}
+ DROP_GIANT_NOSWITCH();
+
+ if (mtx != NULL) {
+ mtx_assert(mtx, MA_OWNED | MA_NOTRECURSED);
+ WITNESS_SAVE(mtx, mtx);
+ mtx_exit(mtx, MTX_DEF | MTX_NOSWITCH);
+ if (priority & PDROP)
+ mtx = NULL;
+ }
+
KASSERT(p != NULL, ("msleep1"));
KASSERT(ident != NULL && p->p_stat == SRUN, ("msleep"));
/*
OpenPOWER on IntegriCloud