[Midnightbsd-cvs] src [8023] trunk/sys/geom/multipath/g_multipath.c: go through all providers, not last two only.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Sep 15 16:20:32 EDT 2016


Revision: 8023
          http://svnweb.midnightbsd.org/src/?rev=8023
Author:   laffer1
Date:     2016-09-15 16:20:32 -0400 (Thu, 15 Sep 2016)
Log Message:
-----------
go through all providers, not last two only.

Modified Paths:
--------------
    trunk/sys/geom/multipath/g_multipath.c

Modified: trunk/sys/geom/multipath/g_multipath.c
===================================================================
--- trunk/sys/geom/multipath/g_multipath.c	2016-09-15 20:16:58 UTC (rev 8022)
+++ trunk/sys/geom/multipath/g_multipath.c	2016-09-15 20:20:32 UTC (rev 8023)
@@ -591,8 +591,9 @@
 static int
 g_multipath_rotate(struct g_geom *gp)
 {
-	struct g_consumer *lcp;
+	struct g_consumer *lcp, *first_good_cp = NULL;
 	struct g_multipath_softc *sc = gp->softc;
+	int active_cp_seen = 0;
 
 	g_topology_assert();
 	if (sc == NULL)
@@ -599,11 +600,17 @@
 		return (ENXIO);
 	LIST_FOREACH(lcp, &gp->consumer, consumer) {
 		if ((lcp->index & MP_BAD) == 0) {
-			if (sc->sc_active != lcp)
+			if (first_good_cp == NULL)
+				first_good_cp = lcp;
+			if (active_cp_seen)
 				break;
 		}
+		if (sc->sc_active == lcp)
+			active_cp_seen = 1;
 	}
-	if (lcp) {
+	if (lcp == NULL)
+		lcp = first_good_cp;
+	if (lcp && lcp != sc->sc_active) {
 		sc->sc_active = lcp;
 		if (sc->sc_active_active != 1)
 			printf("GEOM_MULTIPATH: %s is now active path in %s\n",



More information about the Midnightbsd-cvs mailing list