Author: markj
Date: Tue Feb 20 00:34:42 2018
New Revision: 329613
URL: https://svnweb.freebsd.org/changeset/base/329613

Log:
  MFC r328938:
  Simplify synchronization read error handling.

Modified:
  stable/11/sys/geom/mirror/g_mirror.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/mirror/g_mirror.c
==============================================================================
--- stable/11/sys/geom/mirror/g_mirror.c        Tue Feb 20 00:06:07 2018        
(r329612)
+++ stable/11/sys/geom/mirror/g_mirror.c        Tue Feb 20 00:34:42 2018        
(r329613)
@@ -1334,9 +1334,7 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc
         */
        switch (bp->bio_cmd) {
        case BIO_READ: {
-               struct g_mirror_disk *d;
                struct g_consumer *cp;
-               int readable;
 
                KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_read,
                    bp->bio_error);
@@ -1347,31 +1345,17 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc
                            bp->bio_error);
 
                        /*
-                        * If there's at least one other disk from which we can
-                        * read the block, retry the request.
-                        */
-                       readable = 0;
-                       LIST_FOREACH(d, &sc->sc_disks, d_next)
-                               if (d->d_state == G_MIRROR_DISK_STATE_ACTIVE &&
-                                   !(d->d_flags & G_MIRROR_DISK_FLAG_BROKEN))
-                                       readable++;
-
-                       /*
                         * The read error will trigger a syncid bump, so there's
                         * no need to do that here.
                         *
-                        * If we can retry the read from another disk, do so.
-                        * Otherwise, all we can do is kick out the new disk.
+                        * The read error handling for regular requests will
+                        * retry the read from all active mirrors before passing
+                        * the error back up, so there's no need to retry here.
                         */
-                       if (readable == 0) {
-                               g_mirror_sync_request_free(disk, bp);
-                               g_mirror_event_send(disk,
-                                   G_MIRROR_DISK_STATE_DISCONNECTED,
-                                   G_MIRROR_EVENT_DONTWAIT);
-                       } else {
-                               g_mirror_sync_reinit(disk, bp, bp->bio_offset);
-                               goto retry_read;
-                       }
+                       g_mirror_sync_request_free(disk, bp);
+                       g_mirror_event_send(disk,
+                           G_MIRROR_DISK_STATE_DISCONNECTED,
+                           G_MIRROR_EVENT_DONTWAIT);
                        return;
                }
                G_MIRROR_LOGREQ(3, bp,
@@ -1427,7 +1411,6 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc
                g_mirror_sync_reinit(disk, bp, sync->ds_offset);
                sync->ds_offset += bp->bio_length;
 
-retry_read:
                G_MIRROR_LOGREQ(3, bp, "Sending synchronization request.");
                sync->ds_consumer->index++;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to