Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Apr 2009 17:33:35 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r190782 - in stable/7/sys: . contrib/pf dev/cxgb geom/journal
Message-ID:  <200904061733.n36HXZD8078312@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Mon Apr  6 17:33:35 2009
New Revision: 190782
URL: http://svn.freebsd.org/changeset/base/190782

Log:
  MFC r185693:
  
  Make it possible to use gjournal for the root filesystem.  Previously,
  an unclean shutdown would make it impossible to mount rootfs at boot.
  
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/geom/journal/g_journal.c
  stable/7/sys/geom/journal/g_journal.h

Modified: stable/7/sys/geom/journal/g_journal.c
==============================================================================
--- stable/7/sys/geom/journal/g_journal.c	Mon Apr  6 17:08:48 2009	(r190781)
+++ stable/7/sys/geom/journal/g_journal.c	Mon Apr  6 17:33:35 2009	(r190782)
@@ -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: stable/7/sys/geom/journal/g_journal.h
==============================================================================
--- stable/7/sys/geom/journal/g_journal.h	Mon Apr  6 17:08:48 2009	(r190781)
+++ stable/7/sys/geom/journal/g_journal.h	Mon Apr  6 17:33:35 2009	(r190782)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904061733.n36HXZD8078312>