libmultipath: fix detect alua corner case
authorBenjamin Marzinski <bmarzins@redhat.com>
Wed, 1 Aug 2018 20:56:48 +0000 (15:56 -0500)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Tue, 7 Aug 2018 13:30:05 +0000 (15:30 +0200)
If retain_attach_hw_handler = no, then the paths tpgs state will never
be checked, and the multipath device will always select the alua
handler, if no other handler is selected. the paths tpgs state
should be checked, regardless of the retain_hwhandler value.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
libmultipath/propsel.c

index af3ed62..fdb5953 100644 (file)
@@ -420,9 +420,11 @@ int select_hwhandler(struct config *conf, struct multipath *mp)
        bool all_tpgs = true;
 
        dh_state = &handler[2];
+
+       vector_foreach_slot(mp->paths, pp, i)
+               all_tpgs = all_tpgs && (pp->tpgs > 0);
        if (mp->retain_hwhandler != RETAIN_HWHANDLER_OFF) {
                vector_foreach_slot(mp->paths, pp, i) {
-                       all_tpgs = all_tpgs && (pp->tpgs > 0);
                        if (get_dh_state(pp, dh_state, sizeof(handler) - 2) > 0
                            && strcmp(dh_state, "detached")) {
                                memcpy(handler, "1 ", 2);