multipath -u: cleanup logic
authorMartin Wilck <mwilck@suse.com>
Fri, 13 Apr 2018 22:00:10 +0000 (00:00 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 11 May 2018 08:48:50 +0000 (10:48 +0200)
The CMD_VALID_PATH logic is complex and hard to read and understand.
This patch cleans it up a bit (preparing for folluw-up patches).
It doesn't change any logic.

Signed-off-by: Martin Wilck <mwilck@suse.com>
multipath/main.c

index 5d847f0..61ba90a 100644 (file)
@@ -585,15 +585,17 @@ configure (struct config *conf, enum mpath_cmds cmd,
                        if (is_failed_wwid(refwwid) == WWID_IS_FAILED) {
                                r = 1;
                                goto print_valid;
-                       } else if ((!find_multipaths_on(conf) &&
+                       }
+                       if ((!find_multipaths_on(conf) &&
                                    ignore_wwids_on(conf)) ||
                                   check_wwids_file(refwwid, 0) == 0)
                                r = 0;
-                       if (r == 0 ||
-                           !find_multipaths_on(conf) ||
-                           !ignore_wwids_on(conf)) {
+                       if (!ignore_wwids_on(conf))
                                goto print_valid;
-                       }
+                       /* At this point, either r==0 or find_multipaths_on. */
+                       if (r == 0)
+                               goto print_valid;
+                       /* find_multipaths_on: Fall through to path detection */
                }
        }