blob: 23908fa585253c2009e3bd1d6c3bd46b13383dff [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Benjamin Marzinski <bmarzins@redhat.com>
3Date: Fri, 8 Jun 2018 17:12:37 -0500
4Subject: [PATCH] libmultipath: fix detect alua corner case
5
6If retain_attach_hw_handler = no, then the paths tpgs state will never
7be checked, and the multipath device will always select the alua
8handler, if no other handler is selected. the paths tpgs state
9should be checked, regardless of the retain_hwhandler value.
10
11Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
12---
13 libmultipath/propsel.c | 4 +++-
14 1 file changed, 3 insertions(+), 1 deletion(-)
15
16diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
17index 62a6893..f626c74 100644
18--- a/libmultipath/propsel.c
19+++ b/libmultipath/propsel.c
20@@ -403,9 +403,11 @@ int select_hwhandler(struct config *conf, struct multipath *mp)
21 bool all_tpgs = true;
22
23 dh_state = &handler[2];
24+
25+ vector_foreach_slot(mp->paths, pp, i)
26+ all_tpgs = all_tpgs && (pp->tpgs > 0);
27 if (mp->retain_hwhandler != RETAIN_HWHANDLER_OFF) {
28 vector_foreach_slot(mp->paths, pp, i) {
29- all_tpgs = all_tpgs && (pp->tpgs > 0);
30 if (get_dh_state(pp, dh_state, sizeof(handler) - 2) > 0
31 && strcmp(dh_state, "detached")) {
32 memcpy(handler, "1 ", 2);
33--
342.7.4
35