From e26bafdc256e5efd88241abfdb4e5acead45f81e Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Thu, 11 Mar 2004 08:16:23 +0000 Subject: [PATCH] Be more insistent on destroying geoms at unload time. Still not perfect, but it will do (better) for now. KASSERT that to have providers a class must have an access method. Tag the new_provider event with the geom as well. --- sys/geom/geom_subr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index 720a3d6c5af1..e669e8cc4a4d 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -154,7 +154,10 @@ g_unload_class(void *arg, int flag) mp->config = NULL; error = 0; - LIST_FOREACH(gp, &mp->geom, geom) { + for (;;) { + gp = LIST_FIRST(&mp->geom); + if (gp == NULL) + break; error = mp->destroy_geom(NULL, mp, gp); if (error != 0) break; @@ -376,6 +379,9 @@ g_new_providerf(struct g_geom *gp, const char *fmt, ...) g_topology_assert(); G_VALID_GEOM(gp); + KASSERT(gp->access != NULL, + ("new provider on geom(%s) without ->access (class %s)", + gp->name, gp->class->name)); KASSERT(gp->start != NULL, ("new provider on geom(%s) without ->start (class %s)", gp->name, gp->class->name)); @@ -397,7 +403,7 @@ g_new_providerf(struct g_geom *gp, const char *fmt, ...) pp->stat = devstat_new_entry(pp, -1, 0, DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); LIST_INSERT_HEAD(&gp->provider, pp, provider); - g_post_event(g_new_provider_event, pp, M_WAITOK, pp, NULL); + g_post_event(g_new_provider_event, pp, M_WAITOK, pp, gp, NULL); return (pp); }