Index: geom_vinum_plex.c =================================================================== --- geom_vinum_plex.c (revision 187036) +++ geom_vinum_plex.c (working copy) @@ -614,9 +614,9 @@ from = bp->bio_caller2; KASSERT(from != NULL, ("NULL from")); v = to->vol_sc; - KASSERT(v != NULL, ("NULL v")); + KASSERT(v != NULL, ("gv_sync_complete: NULL v")); sc = v->vinumconf; - KASSERT(sc != NULL, ("NULL sc")); + KASSERT(sc != NULL, ("gv_sync_complete: NULL sc")); /* If it was a read, write it. */ if (bp->bio_cmd == BIO_READ) { @@ -636,6 +636,7 @@ gv_set_sd_state(s, GV_SD_UP, 0); to->flags &= ~GV_PLEX_SYNCING; to->synced = 0; + gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0); } else { offset = bp->bio_offset + bp->bio_length; err = gv_sync_request(from, to, offset, @@ -711,12 +712,16 @@ void gv_grow_complete(struct gv_plex *p, struct bio *bp) { + struct gv_softc *sc; struct gv_sd *s; struct gv_volume *v; off_t origsize, offset; int sdcount, err; v = p->vol_sc; + KASSERT(v != NULL, ("gv_grow_complete: NULL v")); + sc = v->vinumconf; + KASSERT(sc != NULL, ("gv_grow_complete: NULL sc")); err = 0; /* If it was a read, write it. */ @@ -748,6 +753,7 @@ gv_access(v->provider, -1, -1, 0); g_topology_unlock(); p->synced = 0; + gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0); /* Issue delayed requests. */ gv_plex_flush(p); } else { @@ -819,6 +825,7 @@ void gv_init_complete(struct gv_plex *p, struct bio *bp) { + struct gv_softc *sc; struct gv_drive *d; struct g_consumer *cp; struct gv_sd *s; @@ -837,6 +844,8 @@ KASSERT(d != NULL, ("gv_init_complete: NULL d")); cp = d->consumer; KASSERT(cp != NULL, ("gv_init_complete: NULL cp")); + sc = p->vinumconf; + KASSERT(sc != NULL, ("gv_init_complete: NULL sc")); g_destroy_bio(bp); @@ -859,6 +868,7 @@ } else { gv_set_sd_state(s, GV_SD_UP, GV_SETSTATE_CONFIG); s->initialized = 0; + gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0); G_VINUM_DEBUG(1, "subdisk '%s' init: finished " "successfully", s->name); } @@ -920,12 +930,16 @@ void gv_parity_complete(struct gv_plex *p, struct bio *bp) { + struct gv_softc *sc; int error, flags; error = bp->bio_error; flags = bp->bio_cflags; flags &= ~GV_BIO_MALLOC; + sc = p->vinumconf; + KASSERT(sc != NULL, ("gv_parity_complete: NULL sc")); + /* Clean up what we allocated. */ if (bp->bio_cflags & GV_BIO_MALLOC) g_free(bp->bio_data); @@ -960,6 +974,7 @@ /* We're finished. */ G_VINUM_DEBUG(1, "parity operation on %s finished", p->name); p->synced = 0; + gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0); return; } @@ -973,6 +988,7 @@ void gv_rebuild_complete(struct gv_plex *p, struct bio *bp) { + struct gv_softc *sc; struct gv_sd *s; int error, flags; off_t offset; @@ -981,6 +997,8 @@ flags = bp->bio_cflags; offset = bp->bio_offset; flags &= ~GV_BIO_MALLOC; + sc = p->vinumconf; + KASSERT(sc != NULL, ("gv_rebuild_complete: NULL sc")); /* Clean up what we allocated. */ if (bp->bio_cflags & GV_BIO_MALLOC) @@ -1016,6 +1034,7 @@ /* Try to up all subdisks. */ LIST_FOREACH(s, &p->subdisks, in_plex) gv_update_sd_state(s); + gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0); gv_plex_flush(p); /* Flush out remaining rebuild BIOs. */ return; }