When handle_uninitialized_path() checks a path, it will either:
1. trigger a new uevent to initalize the path, in which case it won't
   check the path again until that uevent is processed and updates
   pp->tick
2. blacklist the path, in which case the path gets removed
3. intialize the path correctly, in which case it sets pp->tick = 1
4. fail to initialize the path, in which case it was supposed to set
   pp->tick to max_checkint, but instead it set pp->checkint to
   max_checkint, which never worked correctly.

By setting pp->tick to max_checkint at the start,
handle_uninitialized_path() will continue to work as it previously did,
except in case 4, where in now works correctly. There's no point in
messing with pp->checkint for paths that haven't been initialized yet.

Signed-off-by: Benjamin Marzinski <[email protected]>
---
 multipathd/main.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index 234fbf7d..5e89fae5 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2625,7 +2625,6 @@ handle_uninitialized_path(struct vectors * vecs, struct 
path * pp,
 {
        int newstate;
        int retrigger_tries;
-       unsigned int checkint, max_checkint;
        struct config *conf;
        int ret;
 
@@ -2640,8 +2639,7 @@ handle_uninitialized_path(struct vectors * vecs, struct 
path * pp,
 
        conf = get_multipath_config();
        retrigger_tries = conf->retrigger_tries;
-       checkint = conf->checkint;
-       max_checkint = conf->max_checkint;
+       pp->tick = conf->max_checkint;
        put_multipath_config(conf);
 
        if (pp->initialized == INIT_MISSING_UDEV) {
@@ -2675,12 +2673,6 @@ handle_uninitialized_path(struct vectors * vecs, struct 
path * pp,
                }
        }
 
-       /*
-        * provision a next check soonest,
-        * in case we exit abnormally from here
-        */
-       pp->tick = checkint;
-
        newstate = check_path_state(pp);
 
        if (!strlen(pp->wwid) &&
@@ -2695,14 +2687,8 @@ handle_uninitialized_path(struct vectors * vecs, struct 
path * pp,
                if (pp->initialized == INIT_OK) {
                        ev_add_path(pp, vecs, 1);
                        pp->tick = 1;
-               } else {
-                       if (ret == PATHINFO_SKIPPED)
-                               return -1;
-                       /*
-                        * We failed multiple times to initialize this
-                        * path properly. Don't re-check too often.
-                        */
-                       pp->checkint = max_checkint;
+               } else if (ret == PATHINFO_SKIPPED) {
+                       return -1;
                }
        }
        return 0;
-- 
2.45.0


Reply via email to