If a multipath device has a path grouping policy of "group_by_tpg" and
pp->tpg_id wasn't previously set, set need_reload. If the multipath
device hasn't been created yet, need_reload will get cleared when the
device is created. If the multipath device already exists, the path
likely wasn't in the correct pathgroup, since it was unable to set
pp->tpg_id before the paths were grouped.

Signed-off-by: Benjamin Marzinski <bmarz...@redhat.com>
---
 libmultipath/discovery.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 48e23d44..846101d0 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -34,6 +34,7 @@
 #include "configure.h"
 #include "print.h"
 #include "strbuf.h"
+#include "pgpolicies.h"
 
 #define VPD_BUFLEN 4096
 
@@ -1097,8 +1098,13 @@ detect_alua(struct path * pp)
 
 int path_get_tpgs(struct path *pp)
 {
-       if (pp->tpgs == TPGS_UNDEF)
+       if (pp->tpgs == TPGS_UNDEF) {
                detect_alua(pp);
+               if (pp->tpgs != TPGS_UNDEF && pp->tpg_id != GROUP_ID_UNDEF &&
+                   pp->mpp &&
+                   pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_tpg)
+                       pp->mpp->need_reload = true;
+       }
        return pp->tpgs;
 }
 
-- 
2.46.2


Reply via email to