summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_subr.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-03-11 08:16:23 +0000
committerphk <phk@FreeBSD.org>2004-03-11 08:16:23 +0000
commit8940a1c435c52cd4cbb1b37b746e9c6052a08fef (patch)
treedf6f36c63650c8a6b652a97feb17a1bc793bb990 /sys/geom/geom_subr.c
parentfc7667febaa59c3b8f249f27da954782dd241cb2 (diff)
downloadFreeBSD-src-8940a1c435c52cd4cbb1b37b746e9c6052a08fef.zip
FreeBSD-src-8940a1c435c52cd4cbb1b37b746e9c6052a08fef.tar.gz
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.
Diffstat (limited to 'sys/geom/geom_subr.c')
-rw-r--r--sys/geom/geom_subr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c
index 720a3d6..e669e8c 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);
}
OpenPOWER on IntegriCloud