svn commit: r185693 - head/sys/geom/journal
Edward Tomasz Napierala
trasz at FreeBSD.org
Sat Dec 6 03:33:11 PST 2008
Author: trasz
Date: Sat Dec 6 11:33:10 2008
New Revision: 185693
URL: http://svn.freebsd.org/changeset/base/185693
Log:
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
Modified:
head/sys/geom/journal/g_journal.c
head/sys/geom/journal/g_journal.h
Modified: head/sys/geom/journal/g_journal.c
==============================================================================
--- head/sys/geom/journal/g_journal.c Sat Dec 6 11:21:10 2008 (r185692)
+++ head/sys/geom/journal/g_journal.c Sat Dec 6 11:33:10 2008 (r185693)
@@ -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, str
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_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);
Modified: head/sys/geom/journal/g_journal.h
==============================================================================
--- head/sys/geom/journal/g_journal.h Sat Dec 6 11:21:10 2008 (r185692)
+++ head/sys/geom/journal/g_journal.h Sat Dec 6 11:33:10 2008 (r185693)
@@ -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
More information about the svn-src-head
mailing list