svn commit: r316859 - head/sys/geom/mirror

Mark Johnston markj at FreeBSD.org
Fri Apr 14 16:54:51 UTC 2017


Author: markj
Date: Fri Apr 14 16:54:50 2017
New Revision: 316859
URL: https://svnweb.freebsd.org/changeset/base/316859

Log:
  Stop mirror synchronization before draining the I/O queue.
  
  Regular I/O requests may be blocked by concurrent synchronization requests
  targeted to the same LBAs, in which case they are moved to a holding queue
  until the conflicting I/O completes. We therefore want to stop
  synchronization before completing pending I/O in g_mirror_destroy_provider()
  since this ensures that blocked I/O requests are completed as well.
  
  Tested by:	pho
  MFC after:	2 weeks
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sys/geom/mirror/g_mirror.c

Modified: head/sys/geom/mirror/g_mirror.c
==============================================================================
--- head/sys/geom/mirror/g_mirror.c	Fri Apr 14 16:53:34 2017	(r316858)
+++ head/sys/geom/mirror/g_mirror.c	Fri Apr 14 16:54:50 2017	(r316859)
@@ -2170,6 +2170,11 @@ g_mirror_destroy_provider(struct g_mirro
 	KASSERT(sc->sc_provider != NULL, ("NULL provider (device=%s).",
 	    sc->sc_name));
 
+	LIST_FOREACH(disk, &sc->sc_disks, d_next) {
+		if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING)
+			g_mirror_sync_stop(disk, 1);
+	}
+
 	g_topology_lock();
 	g_error_provider(sc->sc_provider, ENXIO);
 	mtx_lock(&sc->sc_queue_mtx);
@@ -2193,10 +2198,6 @@ g_mirror_destroy_provider(struct g_mirro
 	sc->sc_provider = NULL;
 	G_MIRROR_DEBUG(0, "Device %s: provider destroyed.", sc->sc_name);
 	g_topology_unlock();
-	LIST_FOREACH(disk, &sc->sc_disks, d_next) {
-		if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING)
-			g_mirror_sync_stop(disk, 1);
-	}
 }
 
 static void


More information about the svn-src-all mailing list