From cd4a05fa8172a77ec31673bd7a352d6f30bae30e Mon Sep 17 00:00:00 2001 From: pjd Date: Sat, 31 Jul 2004 11:22:03 +0000 Subject: [PATCH] Destroy synchronization geom immediately. This should fix unloading without stopping all mirrors. --- sys/geom/mirror/g_mirror.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 3d2f844b6b25..06f8ade16199 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -445,6 +445,7 @@ g_mirror_destroy_device(struct g_mirror_softc *sc) struct g_mirror_disk *disk; struct g_mirror_event *ep; struct g_geom *gp; + struct g_consumer *cp; g_topology_assert(); @@ -470,7 +471,16 @@ g_mirror_destroy_device(struct g_mirror_softc *sc) callout_drain(&sc->sc_callout); gp->softc = NULL; uma_zdestroy(sc->sc_sync.ds_zone); - g_wither_geom(sc->sc_sync.ds_geom, ENXIO); + while ((cp = LIST_FIRST(&sc->sc_sync.ds_geom->consumer)) != NULL) { + if (cp->provider != NULL) { + if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) + g_access(cp, -cp->acr, -cp->acw, -cp->ace); + g_detach(cp); + } + g_destroy_consumer(cp); + } + sc->sc_sync.ds_geom->softc = NULL; + g_destroy_geom(sc->sc_sync.ds_geom); mtx_destroy(&sc->sc_queue_mtx); mtx_destroy(&sc->sc_events_mtx); G_MIRROR_DEBUG(0, "Device %s destroyed.", gp->name);