[multipathd] enable the defered failback feature
authorroot <root@xa-s05.(none)>
Sat, 28 May 2005 16:33:54 +0000 (18:33 +0200)
committerroot <root@xa-s05.(none)>
Sat, 28 May 2005 16:33:54 +0000 (18:33 +0200)
The failback config file keyword activates defered failback when set to
an integer value superior to zero. This value expresses the number of
consecutive successful path check before failback.

Remember the path testing delay arithmeticaly increases when consecutive
checks report PATH_UP. This affects the calculation of the failback delay
in seconds.

Failback is canceled as soon as a path in the multipath goes down, and
is rescheduled when a path goes up.

libmultipath/structs.h
multipath.conf.annotated
multipathd/main.c

index 49ed507..a064987 100644 (file)
@@ -95,6 +95,7 @@ struct multipath {
        int queuedio;
        int action;
        int pgfailback;
+       int failback_tick;
        unsigned long size;
        vector paths;
        vector pg;
index 8444332..5e6b59c 100644 (file)
@@ -83,7 +83,7 @@
 #      # scope   : multipathd
 #      # desc    : tell the daemon to manage path group failback, or not to.
 #      #           0 means immediate failback, values >0 means deffered failback
-#      #           expressed in seconds.
+#      #           expressed in number of consecutive sucessful checks.
 #      # values  : manual|immediate|n > 0
 #      # default : immediate
 #      #
 #              # scope   : multipathd
 #              # desc    : tell the daemon to manage path group failback, or not to.
 #              #           0 means immediate failback, values >0 means deffered failback
-#              #           expressed in seconds.
+#              #           expressed in number of consecutive sucessful checks.
 #              # values  : manual|immediate|n > 0
 #              # default : immediate
 #              #
 #              # scope   : multipathd
 #              # desc    : tell the daemon to manage path group failback, or not to.
 #              #           0 means immediate failback, values >0 means deffered failback
-#              #           expressed in seconds.
+#              #           expressed in number of consecutive sucessful checks.
 #              # values  : manual|immediate|n > 0
 #              # default : immediate
 #              #
index 270759d..d35821c 100644 (file)
@@ -763,12 +763,17 @@ checkerloop (void *ap)
                                 */
                                pp->checkint = conf->checkint;
 
-                               /*
-                                * proactively fail path in the DM
-                                */
                                if (newstate == PATH_DOWN ||
                                    newstate == PATH_SHAKY) {
+                                       /*
+                                        * proactively fail path in the DM
+                                        */
                                        fail_path(pp);
+
+                                       /*
+                                        * cancel scheduled failback
+                                        */
+                                       pp->mpp->failback_tick = 0;
                                        continue;
                                }
 
@@ -782,12 +787,33 @@ checkerloop (void *ap)
                                 */
                                update_multipath_strings(pp->mpp,
                                                         allpaths->pathvec);
-                               switch_pathgroup(pp->mpp);
+
+                               /*
+                                * schedule defered failback
+                                */
+                               if (pp->mpp->pgfailback > 0)
+                                       pp->mpp->failback_tick =
+                                               pp->mpp->pgfailback;
+
+                               if (pp->mpp->pgfailback == FAILBACK_IMMEDIATE)
+                                       switch_pathgroup(pp->mpp);
                        }
                        else if (newstate == PATH_UP) {
                                /*
                                 * PATH_UP for last two checks
-                                * double the next check delay.
+                                * defered failback getting sooner
+                                */
+                               if (pp->mpp->pgfailback > 0) {
+                                       if (pp->mpp->failback_tick > 0) {
+                                               pp->mpp->failback_tick--;
+
+                                               if (!pp->mpp->failback_tick)
+                                                       switch_pathgroup(pp->mpp);
+                                       }
+                               }
+                               
+                               /*
+                                * and double the next check delay.
                                 * max at conf->max_checkint
                                 */
                                if (pp->checkint < (conf->max_checkint / 2))