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.
This commit is contained in:
parent
82f0cb7f33
commit
fcac1be89a
@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <geom/vinum/geom_vinum.h>
|
||||
#include <geom/vinum/geom_vinum_share.h>
|
||||
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user