diff mbox series

[V2,11/11] multipathd: don't assume mpp->paths will exist in need_switch_pathgroup

Message ID 1686082391-29210-12-git-send-email-bmarzins@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: christophe varoqui
Headers show
Series multipath: Add a group_by_tgp pgpolicy | expand

Commit Message

Benjamin Marzinski June 6, 2023, 8:13 p.m. UTC
When need_switch_pathgroup() is called by deferred_failback_tick(),
there is a chance that mpp->paths will be NULL, even if there are paths
in the multipath device's pathgroups. Instead check if there are
multiple pathgroups, since multipath can't be using the wrong pathgroup
if there is one or none.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 multipathd/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/multipathd/main.c b/multipathd/main.c
index 05c74e9e..539cff54 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -438,7 +438,7 @@  need_switch_pathgroup (struct multipath * mpp, bool *need_reload)
 	if (!mpp)
 		return 0;
 
-	if (!mpp->pg || VECTOR_SIZE(mpp->paths) == 0)
+	if (VECTOR_SIZE(mpp->pg) < 2)
 		return 0;
 
 	bestpg = select_path_group(mpp);