diff mbox series

[11/13] libmultipath: set need_reload when the tpg_id gets set

Message ID 20250123031643.3017891-12-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: Benjamin Marzinski
Headers show
Series fix for GitHub issue #108 and misc cleanups | expand

Commit Message

Benjamin Marzinski Jan. 23, 2025, 3:16 a.m. UTC
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 <bmarzins@redhat.com>
---
 libmultipath/discovery.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

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;
 }