Index: geom.h =================================================================== RCS file: /private/FreeBSD/src/sys/geom/geom.h,v retrieving revision 1.84 diff -u -p -r1.84 geom.h --- geom.h 8 Aug 2004 06:46:27 -0000 1.84 +++ geom.h 23 Aug 2004 17:22:08 -0000 @@ -188,6 +188,7 @@ struct g_provider { #define G_PF_CANDELETE 0x1 #define G_PF_WITHER 0x2 #define G_PF_ORPHAN 0x4 +#define G_PF_NEW 0x8 /* Two fields for the implementing class to use */ void *private; Index: geom_slice.c =================================================================== RCS file: /private/FreeBSD/src/sys/geom/geom_slice.c,v retrieving revision 1.55 diff -u -p -r1.55 geom_slice.c --- geom_slice.c 25 Jul 2004 09:41:31 -0000 1.55 +++ geom_slice.c 23 Aug 2004 20:08:22 -0000 @@ -359,7 +359,7 @@ g_slice_config(struct g_geom *gp, u_int sbuf_finish(sb); pp = g_new_providerf(gp, sbuf_data(sb)); pp2 = LIST_FIRST(&gp->consumer)->provider; - pp->flags = pp2->flags & G_PF_CANDELETE; + pp->flags |= pp2->flags & G_PF_CANDELETE; if (pp2->stripesize > 0) { pp->stripesize = pp2->stripesize; pp->stripeoffset = (pp2->stripeoffset + offset) % pp->stripesize; Index: geom_subr.c =================================================================== RCS file: /private/FreeBSD/src/sys/geom/geom_subr.c,v retrieving revision 1.81 diff -u -p -r1.81 geom_subr.c --- geom_subr.c 8 Aug 2004 08:34:46 -0000 1.81 +++ geom_subr.c 23 Aug 2004 20:15:15 -0000 @@ -62,6 +62,19 @@ struct g_hh00 { int error; }; +static int +g_valid_provider(struct g_provider *pp) +{ + + if (pp->error != 0) + return (0); + if (pp->sectorsize == 0) + return (0); + if (pp->mediasize == 0) + return (0); + return (1); +} + /* * This event offers a new class a chance to taste all preexisting providers. */ @@ -103,6 +116,8 @@ g_load_class(void *arg, int flag) continue; LIST_FOREACH(gp, &mp2->geom, geom) { LIST_FOREACH(pp, &gp->provider, provider) { + if (!g_valid_provider(pp)) + continue; mp->taste(mp, pp, 0); g_topology_assert(); } @@ -452,7 +467,7 @@ g_new_providerf(struct g_geom *gp, const 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, gp, NULL); + pp->flags |= G_PF_NEW; return (pp); } @@ -462,6 +477,13 @@ g_error_provider(struct g_provider *pp, /* G_VALID_PROVIDER(pp); We may not have g_topology */ pp->error = error; + if (pp->error == 0 && (pp->flags & G_PF_NEW) != 0) { + pp->flags &= ~G_PF_NEW; + if (g_valid_provider(pp)) { + g_post_event(g_new_provider_event, pp, M_WAITOK, pp, + pp->geom, NULL); + } + } } struct g_provider *