--- geom.h.orig Thu Dec 4 22:24:49 2003 +++ geom.h Thu Dec 4 22:24:42 2003 @@ -64,6 +64,8 @@ typedef int g_ctl_config_geom_t (struct gctl_req *, struct g_geom *gp, const char *verb); typedef void g_init_t (struct g_class *mp); typedef void g_fini_t (struct g_class *mp); +#define G_TA_TASTE 0 +#define G_TA_RETASTE 1 typedef struct g_geom * g_taste_t (struct g_class *, struct g_provider *, int flags); typedef int g_ioctl_t(struct g_provider *pp, u_long cmd, void *data, struct thread *td); #define G_TF_NORMAL 0 --- geom_subr.c.orig Thu Dec 4 21:57:37 2003 +++ geom_subr.c Thu Dec 4 22:33:55 2003 @@ -59,10 +59,14 @@ static int g_valid_obj(void const *ptr); -struct g_hh00 { +struct g_hh00_class { struct g_class *mp; int error; }; +struct g_hh00_provider { + struct g_provider *provider; + int flags; +}; /* * This event offers a new class a chance to taste all preexisting providers. @@ -70,7 +74,7 @@ static void g_load_class(void *arg, int flag) { - struct g_hh00 *hh; + struct g_hh00_class *hh; struct g_class *mp2, *mp; struct g_geom *gp; struct g_provider *pp; @@ -113,7 +117,7 @@ static void g_unload_class(void *arg, int flag) { - struct g_hh00 *hh; + struct g_hh00_class *hh; struct g_class *mp; struct g_geom *gp; struct g_provider *pp; @@ -165,7 +169,7 @@ int g_modevent(module_t mod, int type, void *data) { - struct g_hh00 *hh; + struct g_hh00_class *hh; int error; static int g_ignition; @@ -323,17 +327,23 @@ static void g_new_provider_event(void *arg, int flag) { + struct g_hh00_provider *hh; struct g_class *mp; struct g_provider *pp; struct g_consumer *cp; - int i; + int i, tflags; g_topology_assert(); if (flag == EV_CANCEL) return; if (g_shutdown) return; - pp = arg; + hh = arg; + pp = hh->provider; + tflags = hh->flags; + KASSERT(tflags == G_TA_TASTE || tflags == G_TA_RETASTE, + ("Wrong flags for taste event")); + g_free(hh); LIST_FOREACH(mp, &g_classes, class) { if (mp->taste == NULL) continue; @@ -343,7 +353,7 @@ i = 0; if (!i) continue; - mp->taste(mp, pp, 0); + mp->taste(mp, pp, tflags); g_topology_assert(); /* * XXX: Bandaid for 5.2-RELEASE @@ -360,6 +370,7 @@ struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...) { + struct g_hh00_provider *hh; struct g_provider *pp; struct sbuf *sb; va_list ap; @@ -380,7 +391,10 @@ 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); + hh = g_malloc(sizeof *hh, M_WAITOK | M_ZERO); + hh->provider = pp; + hh->flags = G_TA_TASTE; + g_post_event(g_new_provider_event, hh, M_WAITOK, hh, NULL); return (pp); } @@ -633,9 +647,15 @@ if (pp->acw == 0 && dcw != 0) g_spoil(pp, cp); else if (pp->acw != 0 && pp->acw == -dcw && - !(pp->geom->flags & G_GEOM_WITHER)) - g_post_event(g_new_provider_event, pp, M_WAITOK, - pp, NULL); + !(pp->geom->flags & G_GEOM_WITHER)) { + struct g_hh00_provider *hh; + + hh = g_malloc(sizeof *hh, M_WAITOK | M_ZERO); + hh->provider = pp; + hh->flags = G_TA_RETASTE; + g_post_event(g_new_provider_event, hh, M_WAITOK, + hh, NULL); + } pp->acr += dcr; pp->acw += dcw;