multipath: check failed path dmstate in check_path
authorBenjamin Marzinski <bmarzins@redhat.com>
Thu, 7 Dec 2017 18:49:05 +0000 (12:49 -0600)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sat, 13 Jan 2018 09:16:05 +0000 (10:16 +0100)
If a path's checker state is down before and after a path check, but the
path's dmstate is active, mutipath won't update the dmstate. It only
updates the dmstate when the path first fails.  This can cause the
kernel to try known faulty paths, if the multipath device was reloaded
outside of multipathd.  check_path() already checks for and deals with a
similar case where the path's checker state is up before and after a
path check, but the dmstate is failed.  It should do the same thing for
faulty paths.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
multipathd/main.c

index 8b90056..059cb7a 100644 (file)
@@ -1771,16 +1771,21 @@ check_path (struct vectors * vecs, struct path * pp, int ticks)
                        pp->tick = pp->checkint;
                }
        }
-       else if (newstate == PATH_DOWN) {
-               int log_checker_err;
+       else if (newstate != PATH_UP && newstate != PATH_GHOST) {
+               if (pp->dmstate == PSTATE_ACTIVE ||
+                   pp->dmstate == PSTATE_UNDEF)
+                       fail_path(pp, 0);
+               if (newstate == PATH_DOWN) {
+                       int log_checker_err;
 
-               conf = get_multipath_config();
-               log_checker_err = conf->log_checker_err;
-               put_multipath_config(conf);
-               if (log_checker_err == LOG_CHKR_ERR_ONCE)
-                       LOG_MSG(3, checker_message(&pp->checker));
-               else
-                       LOG_MSG(2, checker_message(&pp->checker));
+                       conf = get_multipath_config();
+                       log_checker_err = conf->log_checker_err;
+                       put_multipath_config(conf);
+                       if (log_checker_err == LOG_CHKR_ERR_ONCE)
+                               LOG_MSG(3, checker_message(&pp->checker));
+                       else
+                               LOG_MSG(2, checker_message(&pp->checker));
+               }
        }
 
        pp->state = newstate;