summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2005-04-19 21:47:25 +0000
committerpjd <pjd@FreeBSD.org>2005-04-19 21:47:25 +0000
commit15eddd96beb523e19af1df49c87f07d8ad4dfe95 (patch)
tree618577adec569e30c7b85ba402adae01dc57d64f /sys/geom
parentdb9ce4609f5c2cf9baa552a61c8c12a3c27b113b (diff)
downloadFreeBSD-src-15eddd96beb523e19af1df49c87f07d8ad4dfe95.zip
FreeBSD-src-15eddd96beb523e19af1df49c87f07d8ad4dfe95.tar.gz
Remove the hack which allowed to use gmirror for root file system,
use root_mount KPI instead.
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/mirror/g_mirror.c55
-rw-r--r--sys/geom/mirror/g_mirror.h2
2 files changed, 8 insertions, 49 deletions
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c
index 2b1b129..51fbfed 100644
--- a/sys/geom/mirror/g_mirror.c
+++ b/sys/geom/mirror/g_mirror.c
@@ -1890,6 +1890,8 @@ g_mirror_update_device(struct g_mirror_softc *sc, boolean_t force)
* Disks went down in starting phase, so destroy
* device.
*/
+ root_mount_rel(sc->sc_rootmount);
+ sc->sc_rootmount = NULL;
callout_drain(&sc->sc_callout);
sc->sc_flags |= G_MIRROR_DEVICE_FLAG_DESTROY;
return;
@@ -1897,6 +1899,9 @@ g_mirror_update_device(struct g_mirror_softc *sc, boolean_t force)
return;
}
+ root_mount_rel(sc->sc_rootmount);
+ sc->sc_rootmount = NULL;
+
/*
* Activate all disks with the biggest syncid.
*/
@@ -2567,6 +2572,7 @@ g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md)
G_MIRROR_DEBUG(0, "Device %s created (id=%u).", sc->sc_name, sc->sc_id);
+ sc->sc_rootmount = root_mount_hold("GMIRROR");
/*
* Run timeout.
*/
@@ -2858,53 +2864,4 @@ g_mirror_fini(struct g_class *mp)
EVENTHANDLER_DEREGISTER(shutdown_post_sync, g_mirror_ehtag);
}
-static int
-g_mirror_can_go(void)
-{
- struct g_mirror_softc *sc;
- struct g_geom *gp;
- struct g_provider *pp;
- int can_go;
-
- DROP_GIANT();
- can_go = 1;
- g_topology_lock();
- LIST_FOREACH(gp, &g_mirror_class.geom, geom) {
- sc = gp->softc;
- if (sc == NULL) {
- can_go = 0;
- break;
- }
- pp = sc->sc_provider;
- if (pp == NULL || pp->error != 0) {
- can_go = 0;
- break;
- }
- }
- g_topology_unlock();
- PICKUP_GIANT();
- return (can_go);
-}
-
-static void
-g_mirror_rootwait(void)
-{
-
- /*
- * HACK: Wait for GEOM, because g_mirror_rootwait() can be called,
- * HACK: before we get providers for tasting.
- */
- tsleep(&g_mirror_class, PRIBIO, "mroot", hz * 3);
- /*
- * Wait for mirrors in degraded 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);
diff --git a/sys/geom/mirror/g_mirror.h b/sys/geom/mirror/g_mirror.h
index 03827ea..963931e 100644
--- a/sys/geom/mirror/g_mirror.h
+++ b/sys/geom/mirror/g_mirror.h
@@ -191,6 +191,8 @@ struct g_mirror_softc {
struct mtx sc_events_mtx;
struct callout sc_callout;
+
+ struct root_hold_token *sc_rootmount;
};
#define sc_name sc_geom->name
OpenPOWER on IntegriCloud