[multipathd] don't check at all if path is orphaned
authorroot <root@xa-s05.(none)>
Mon, 20 Jun 2005 21:45:41 +0000 (23:45 +0200)
committerroot <root@xa-s05.(none)>
Mon, 20 Jun 2005 21:45:41 +0000 (23:45 +0200)
Orphaned as in "a checher is registered for this path, but it does not
belong to any map". We wouldn't know what to do if its state changed
anyway.

Suggested by Ed Goggin.

multipathd/main.c

index 4297080..c369d1f 100644 (file)
@@ -611,6 +611,12 @@ show_paths (struct paths * allpaths)
 
        vector_foreach_slot(allpaths->pathvec, pp, i) {
                c += sprintf(c, "%10s: ", pp->dev);
+
+               if (!pp->mpp) {
+                       c += sprintf(c, "[orphan]\n");
+                       continue;
+               }
+
                c += sprintf(c, "state %i, ", pp->state);
 
                j = pp->tick;
@@ -877,6 +883,9 @@ checkerloop (void *ap)
                condlog(4, "tick");
 
                vector_foreach_slot (allpaths->pathvec, pp, i) {
+                       if (!pp->mpp)
+                               continue;
+
                        if (pp->tick) {
                                /*
                                 * don't check this path yet
@@ -923,8 +932,7 @@ checkerloop (void *ap)
                                        /*
                                         * cancel scheduled failback
                                         */
-                                       if (pp->mpp)
-                                               pp->mpp->failback_tick = 0;
+                                       pp->mpp->failback_tick = 0;
 
                                        continue;
                                }
@@ -943,12 +951,11 @@ checkerloop (void *ap)
                                /*
                                 * schedule defered failback
                                 */
-                               if (pp->mpp && pp->mpp->pgfailback > 0)
+                               if (pp->mpp->pgfailback > 0)
                                        pp->mpp->failback_tick =
                                                pp->mpp->pgfailback;
 
-                               if (pp->mpp &&
-                                   pp->mpp->pgfailback == FAILBACK_IMMEDIATE)
+                               if (pp->mpp->pgfailback == FAILBACK_IMMEDIATE)
                                        switch_pathgroup(pp->mpp);
                        }
                        else if (newstate == PATH_UP || newstate == PATH_GHOST) {
@@ -956,7 +963,7 @@ checkerloop (void *ap)
                                 * PATH_UP for last two checks
                                 * defered failback getting sooner
                                 */
-                               if (pp->mpp && pp->mpp->pgfailback > 0) {
+                               if (pp->mpp->pgfailback > 0) {
                                        if (pp->mpp->failback_tick > 0) {
                                                pp->mpp->failback_tick--;