summaryrefslogtreecommitdiffstats
path: root/sys/geom/gate
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-05-05 12:30:41 +0000
committerpjd <pjd@FreeBSD.org>2004-05-05 12:30:41 +0000
commit6f00e1b72e6255e5748c76125bcd245bbe0b774d (patch)
treeb5c4865983ca7cc2fb84b1143668eb392e8d5e19 /sys/geom/gate
parent4845d2da92efac1c5caf6568efce7c4f0000a517 (diff)
downloadFreeBSD-src-6f00e1b72e6255e5748c76125bcd245bbe0b774d.zip
FreeBSD-src-6f00e1b72e6255e5748c76125bcd245bbe0b774d.tar.gz
Close some small wakeup<->msleep races.
Diffstat (limited to 'sys/geom/gate')
-rw-r--r--sys/geom/gate/g_gate.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/geom/gate/g_gate.c b/sys/geom/gate/g_gate.c
index a410c4a..ce084d6 100644
--- a/sys/geom/gate/g_gate.c
+++ b/sys/geom/gate/g_gate.c
@@ -102,7 +102,9 @@ g_gate_destroy(struct g_gate_softc *sc, boolean_t force)
LIST_REMOVE(sc, sc_next);
}
mtx_unlock(&g_gate_list_mtx);
+ mtx_lock(&sc->sc_inqueue_mtx);
wakeup(sc);
+ mtx_unlock(&sc->sc_inqueue_mtx);
if (sc->sc_ref > 0) {
G_GATE_DEBUG(1, "Cannot destroy %s yet.", sc->sc_name);
return (0);
@@ -215,8 +217,8 @@ g_gate_start(struct bio *bp)
mtx_lock(&sc->sc_inqueue_mtx);
bioq_disksort(&sc->sc_inqueue, bp);
- mtx_unlock(&sc->sc_inqueue_mtx);
wakeup(sc);
+ mtx_unlock(&sc->sc_inqueue_mtx);
}
static struct g_gate_softc *
@@ -563,8 +565,8 @@ g_gate_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
atomic_add_acq_32(&sc->sc_queue_count, 1);
mtx_lock(&sc->sc_inqueue_mtx);
bioq_disksort(&sc->sc_inqueue, bp);
- mtx_unlock(&sc->sc_inqueue_mtx);
wakeup(sc);
+ mtx_unlock(&sc->sc_inqueue_mtx);
} else {
bp->bio_error = ggio->gctl_error;
if (bp->bio_error == 0) {
OpenPOWER on IntegriCloud