From fcac1be89a926c880bc08ffdfb28eb766b069a21 Mon Sep 17 00:00:00 2001 From: Lukas Ertl Date: Thu, 8 Sep 2005 20:08:46 +0000 Subject: [PATCH] Set the G_PF_WITHER flag on the subdisk provider that is about to be destroyed. That way the GEOM system handles all deallocations and we don't have to do it ourselves. --- sys/geom/vinum/geom_vinum_rm.c | 35 +--------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/sys/geom/vinum/geom_vinum_rm.c b/sys/geom/vinum/geom_vinum_rm.c index bb2b7659428d..44b611053d5b 100644 --- a/sys/geom/vinum/geom_vinum_rm.c +++ b/sys/geom/vinum/geom_vinum_rm.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include -static void gv_cleanup_pp(void *, int); static void gv_free_sd(struct gv_sd *); static int gv_rm_drive(struct gv_softc *, struct gctl_req *, struct gv_drive *, int); @@ -261,12 +260,8 @@ gv_rm_sd(struct gv_softc *sc, struct gctl_req *req, struct gv_sd *s, int flags) /* If the subdisk has a provider we need to clean up this one too. */ if (pp != NULL) { + pp->flags |= G_PF_WITHER; g_orphan_provider(pp, ENXIO); - if (LIST_EMPTY(&pp->consumers)) - g_destroy_provider(pp); - else - /* Schedule this left-over provider for destruction. */ - g_post_event(gv_cleanup_pp, pp, M_WAITOK, pp, NULL); } return (0); @@ -350,34 +345,6 @@ gv_rm_drive(struct gv_softc *sc, struct gctl_req *req, struct gv_drive *d, int f return (err); } -/* - * This function is called from the event queue to clean up left-over subdisk - * providers. - */ -static void -gv_cleanup_pp(void *arg, int flag) -{ - struct g_provider *pp; - - g_topology_assert(); - - if (flag == EV_CANCEL) - return; - - pp = arg; - if (pp == NULL) { - printf("gv_cleanup_pp: provider has gone\n"); - return; - } - - if (!LIST_EMPTY(&pp->consumers)) { - printf("gv_cleanup_pp: provider still not empty\n"); - return; - } - - g_destroy_provider(pp); -} - static void gv_free_sd(struct gv_sd *s) {