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

Mark Johnston markj at FreeBSD.org
Thu Oct 6 00:13:56 UTC 2016


Author: markj
Date: Thu Oct  6 00:13:55 2016
New Revision: 306744
URL: https://svnweb.freebsd.org/changeset/base/306744

Log:
  gmirror: Write an updated syncid before queuing writes.
  
  When a syncid bump is pending, any write to the mirror results in the
  updated syncid being written to each component's metadata block. However,
  the update was only being performed after the writes to the mirror
  componenents were queued. Instead, synchronously update the metadata block
  first.
  
  MFC after:	3 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	Thu Oct  6 00:05:45 2016	(r306743)
+++ head/sys/geom/mirror/g_mirror.c	Thu Oct  6 00:13:55 2016	(r306744)
@@ -1676,6 +1676,14 @@ g_mirror_register_request(struct bio *bp
 			sc->sc_last_write = time_uptime;
 
 		/*
+		 * Bump syncid on first write.
+		 */
+		if ((sc->sc_bump_id & G_MIRROR_BUMP_SYNCID) != 0) {
+			sc->sc_bump_id &= ~G_MIRROR_BUMP_SYNCID;
+			g_mirror_bump_syncid(sc);
+		}
+
+		/*
 		 * Allocate all bios before sending any request, so we can
 		 * return ENOMEM in nice and clean way.
 		 */
@@ -1730,13 +1738,6 @@ g_mirror_register_request(struct bio *bp
 		 * synchronization requests don't collide with it.
 		 */
 		bioq_insert_tail(&sc->sc_inflight, bp);
-		/*
-		 * Bump syncid on first write.
-		 */
-		if ((sc->sc_bump_id & G_MIRROR_BUMP_SYNCID) != 0) {
-			sc->sc_bump_id &= ~G_MIRROR_BUMP_SYNCID;
-			g_mirror_bump_syncid(sc);
-		}
 		return;
 	    }
 	default:


More information about the svn-src-head mailing list