Date: Sat, 25 Aug 2012 10:36:32 +0000 (UTC) From: Thomas Quinot <thomas@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r239673 - head/sys/geom/multipath Message-ID: <201208251036.q7PAaWhi024826@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: thomas Date: Sat Aug 25 10:36:31 2012 New Revision: 239673 URL: http://svn.freebsd.org/changeset/base/239673 Log: (g_multipath_rotate): Fix algorithm so that it does rotate over all good providers, not just the last two. PR: kern/170379 Reviewed by: mav MFC after: 2 weeks Modified: head/sys/geom/multipath/g_multipath.c Modified: head/sys/geom/multipath/g_multipath.c ============================================================================== --- head/sys/geom/multipath/g_multipath.c Sat Aug 25 09:26:37 2012 (r239672) +++ head/sys/geom/multipath/g_multipath.c Sat Aug 25 10:36:31 2012 (r239673) @@ -590,19 +590,26 @@ g_multipath_destroy_geom(struct gctl_req 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) 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",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208251036.q7PAaWhi024826>