diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2008-12-06 11:33:10 +0000 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2008-12-06 11:33:10 +0000 |
commit | d27a975f72adee6dc0f31a61570faff08c018d0c (patch) | |
tree | 733fa79459ad8e59b7d0007b385cfaa07e2b70a9 /sys/geom/journal | |
parent | f1f8583397585cf5c7ce267cd5e7e87debb9990e (diff) | |
download | src-d27a975f72adee6dc0f31a61570faff08c018d0c.tar.gz src-d27a975f72adee6dc0f31a61570faff08c018d0c.zip |
Make it possible to use gjournal for the root filesystem. Previously,
an unclean shutdown would make it impossible to mount rootfs at boot.
PR: kern/128529
Reviewed by: pjd
Approved by: rwatson (mentor)
Sponsored by: FreeBSD Foundation
Notes
Notes:
svn path=/head/; revision=185693
Diffstat (limited to 'sys/geom/journal')
-rw-r--r-- | sys/geom/journal/g_journal.c | 16 | ||||
-rw-r--r-- | sys/geom/journal/g_journal.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c index 4dbb44b19e20..2db236440fcd 100644 --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -2108,6 +2108,12 @@ g_journal_worker(void *arg) g_topology_unlock(); last_write = time_second; + if (sc->sc_rootmount != NULL) { + GJ_DEBUG(1, "root_mount_rel %p", sc->sc_rootmount); + root_mount_rel(sc->sc_rootmount); + sc->sc_rootmount = NULL; + } + for (;;) { /* Get first request from the queue. */ mtx_lock(&sc->sc_mtx); @@ -2304,6 +2310,9 @@ g_journal_create(struct g_class *mp, struct g_provider *pp, sc->sc_inactive.jj_queue = NULL; sc->sc_active.jj_queue = NULL; + sc->sc_rootmount = root_mount_hold("GJOURNAL"); + GJ_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount); + callout_init(&sc->sc_callout, CALLOUT_MPSAFE); if (md->md_type != GJ_TYPE_COMPLETE) { /* @@ -2434,6 +2443,13 @@ g_journal_destroy(struct g_journal_softc *sc) sc->sc_flags |= (GJF_DEVICE_DESTROY | GJF_DEVICE_CLEAN); g_topology_unlock(); + + if (sc->sc_rootmount != NULL) { + GJ_DEBUG(1, "root_mount_rel %p", sc->sc_rootmount); + root_mount_rel(sc->sc_rootmount); + sc->sc_rootmount = NULL; + } + callout_drain(&sc->sc_callout); mtx_lock(&sc->sc_mtx); wakeup(sc); diff --git a/sys/geom/journal/g_journal.h b/sys/geom/journal/g_journal.h index 39f7dde982e8..82aae0dd333e 100644 --- a/sys/geom/journal/g_journal.h +++ b/sys/geom/journal/g_journal.h @@ -163,6 +163,8 @@ struct g_journal_softc { struct callout sc_callout; struct proc *sc_worker; + + struct root_hold_token *sc_rootmount; }; #define sc_dprovider sc_dconsumer->provider #define sc_jprovider sc_jconsumer->provider |