Date: Wed, 4 Oct 2017 12:25:39 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324276 - head/sys/geom/mountver Message-ID: <201710041225.v94CPdgx025032@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Wed Oct 4 12:25:39 2017 New Revision: 324276 URL: https://svnweb.freebsd.org/changeset/base/324276 Log: Don't destroy gmountver(8) devices on shutdown, unless they are orphaned. Otherwise we would fail to sync the filesystem on reboot. MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/geom/mountver/g_mountver.c head/sys/geom/mountver/g_mountver.h Modified: head/sys/geom/mountver/g_mountver.c ============================================================================== --- head/sys/geom/mountver/g_mountver.c Wed Oct 4 12:23:34 2017 (r324275) +++ head/sys/geom/mountver/g_mountver.c Wed Oct 4 12:25:39 2017 (r324276) @@ -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: head/sys/geom/mountver/g_mountver.h ============================================================================== --- head/sys/geom/mountver/g_mountver.h Wed Oct 4 12:23:34 2017 (r324275) +++ head/sys/geom/mountver/g_mountver.h Wed Oct 4 12:25:39 2017 (r324276) @@ -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?201710041225.v94CPdgx025032>