Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Nov 2017 17:56:32 +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-11@freebsd.org
Subject:   svn commit: r325819 - stable/11/sys/geom/mountver
Message-ID:  <201711141756.vAEHuWe0068875@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Tue Nov 14 17:56:32 2017
New Revision: 325819
URL: https://svnweb.freebsd.org/changeset/base/325819

Log:
  MFC r324276:
  
  Don't destroy gmountver(8) devices on shutdown, unless they are orphaned.
  Otherwise we would fail to sync the filesystem on reboot.

Modified:
  stable/11/sys/geom/mountver/g_mountver.c
  stable/11/sys/geom/mountver/g_mountver.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/mountver/g_mountver.c
==============================================================================
--- stable/11/sys/geom/mountver/g_mountver.c	Tue Nov 14 17:54:00 2017	(r325818)
+++ stable/11/sys/geom/mountver/g_mountver.c	Tue Nov 14 17:56:32 2017	(r325819)
@@ -190,6 +190,11 @@ g_mountver_start(struct bio *bp)
 	 * requests in order to maintain ordering.
 	 */
 	if (sc->sc_orphaned || !TAILQ_EMPTY(&sc->sc_queue)) {
+		if (sc->sc_shutting_down) {
+			G_MOUNTVER_LOGREQ(bp, "Discarding request due to shutdown.");
+			g_io_deliver(bp, ENXIO);
+			return;
+		}
 		G_MOUNTVER_LOGREQ(bp, "Queueing request.");
 		g_mountver_queue(bp);
 		if (!sc->sc_orphaned)
@@ -607,13 +612,20 @@ g_mountver_dumpconf(struct sbuf *sb, const char *inden
 static void
 g_mountver_shutdown_pre_sync(void *arg, int howto)
 {
+	struct g_mountver_softc *sc;
 	struct g_class *mp;
 	struct g_geom *gp, *gp2;
 
 	mp = arg;
 	g_topology_lock();
-	LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2)
-		g_mountver_destroy(gp, 1);
+	LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) {
+		if (gp->softc == NULL)
+			continue;
+		sc = gp->softc;
+		sc->sc_shutting_down = 1;
+		if (sc->sc_orphaned)
+			g_mountver_destroy(gp, 1);
+	}
 	g_topology_unlock();
 }
 

Modified: stable/11/sys/geom/mountver/g_mountver.h
==============================================================================
--- stable/11/sys/geom/mountver/g_mountver.h	Tue Nov 14 17:54:00 2017	(r325818)
+++ stable/11/sys/geom/mountver/g_mountver.h	Tue Nov 14 17:56:32 2017	(r325819)
@@ -62,6 +62,7 @@ struct g_mountver_softc {
 	char				*sc_provider_name;
 	char				sc_ident[DISK_IDENT_SIZE];
 	int				sc_orphaned;
+	int				sc_shutting_down;
 	int				sc_access_r;
 	int				sc_access_w;
 	int				sc_access_e;



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