Index: g_mirror.c =================================================================== RCS file: /private/FreeBSD/src/sys/geom/mirror/g_mirror.c,v retrieving revision 1.32 diff -u -p -r1.32 g_mirror.c --- g_mirror.c 27 Sep 2004 19:32:26 -0000 1.32 +++ g_mirror.c 1 Oct 2004 20:24:49 -0000 @@ -1911,6 +1911,7 @@ g_mirror_update_device(struct g_mirror_s G_MIRROR_BUMP_ON_FIRST_WRITE; } } + wakeup(&g_mirror_class); break; } case G_MIRROR_DEVICE_STATE_RUNNING: @@ -2689,4 +2690,42 @@ g_mirror_dumpconf(struct sbuf *sb, const } } +static int +g_mirror_can_go(void) +{ + struct g_mirror_softc *sc; + struct g_geom *gp; + int can_go; + + can_go = 1; + g_topology_lock(); + LIST_FOREACH(gp, &g_mirror_class.geom, geom) { + sc = gp->softc; + if (sc == NULL) + continue; + if (sc->sc_state == G_MIRROR_DEVICE_STATE_STARTING) { + can_go = 0; + break; + } + } + g_topology_unlock(); + return (can_go); +} + +static void +g_mirror_rootwait(void) +{ + + /* + * Wait until there are no devices in STARTING state. + */ + for (;;) { + if (g_mirror_can_go()) + break; + tsleep(&g_mirror_class, PRIBIO, "mroot", hz); + } +} + +SYSINIT(g_mirror_root, SI_SUB_RAID, SI_ORDER_FIRST, g_mirror_rootwait, NULL) + DECLARE_GEOM_CLASS(g_mirror_class, g_mirror);