From owner-svn-src-stable-7@FreeBSD.ORG Mon Apr 6 17:33:35 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94479106573A; Mon, 6 Apr 2009 17:33:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 662578FC17; Mon, 6 Apr 2009 17:33:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n36HXZe3078314; Mon, 6 Apr 2009 17:33:35 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n36HXZD8078312; Mon, 6 Apr 2009 17:33:35 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200904061733.n36HXZD8078312@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 6 Apr 2009 17:33:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190782 - in stable/7/sys: . contrib/pf dev/cxgb geom/journal X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2009 17:33:37 -0000 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