diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 02ca68b9cee8..fa881ea8ebd9 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -564,6 +564,8 @@ g_mirror_destroy_device(struct g_mirror_softc *sc) callout_drain(&sc->sc_callout); g_topology_lock(); + gp->softc = NULL; + sc->sc_sync.ds_geom->softc = NULL; LIST_FOREACH_SAFE(cp, &sc->sc_sync.ds_geom->consumer, consumer, tmpcp) { g_mirror_disconnect_consumer(sc, cp); } @@ -3065,15 +3067,8 @@ g_mirror_destroy(struct g_mirror_softc *sc, int how) } } - g_topology_lock(); - if (sc->sc_geom->softc == NULL) { - g_topology_unlock(); + if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0) return (0); - } - sc->sc_geom->softc = NULL; - sc->sc_sync.ds_geom->softc = NULL; - g_topology_unlock(); - sc->sc_flags |= G_MIRROR_DEVICE_FLAG_DESTROY; sc->sc_flags |= G_MIRROR_DEVICE_FLAG_WAIT; G_MIRROR_DEBUG(4, "%s: Waking up %p.", __func__, sc);