Blame SOURCES/0036-libmultipath-fix-disassemble-status-for-historical-s.patch

da32ae
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
da32ae
From: Benjamin Marzinski <bmarzins@redhat.com>
da32ae
Date: Wed, 12 Jan 2022 12:26:12 -0600
da32ae
Subject: [PATCH] libmultipath: fix disassemble status for
da32ae
 historical-service-time PS
da32ae
da32ae
The historical-service-time path selector prints out 2 path group status
da32ae
arguments. This is the only path selector that uses the group status
da32ae
arguments. All the others only have path status arguments.
da32ae
disassemble_status() was expecting the number of group status arguments
da32ae
to always be zero, causing it to fail at disassembling the status of
da32ae
devices that use historical-service-time path selector. Now multipath
da32ae
actually checks the number of group arguments, and skips them.
da32ae
da32ae
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
da32ae
---
da32ae
 libmultipath/dmparser.c | 14 ++++++++++++--
da32ae
 1 file changed, 12 insertions(+), 2 deletions(-)
da32ae
da32ae
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
da32ae
index 4ba7f339..bc311421 100644
da32ae
--- a/libmultipath/dmparser.c
da32ae
+++ b/libmultipath/dmparser.c
da32ae
@@ -437,9 +437,19 @@ int disassemble_status(const char *params, struct multipath *mpp)
da32ae
 		FREE(word);
da32ae
 
da32ae
 		/*
da32ae
-		 * PG Status (discarded, would be '0' anyway)
da32ae
+		 * Path Selector Group Arguments
da32ae
 		 */
da32ae
-		p += get_word(p, NULL);
da32ae
+		p += get_word(p, &word);
da32ae
+
da32ae
+		if (!word)
da32ae
+			return 1;
da32ae
+
da32ae
+		num_pg_args = atoi(word);
da32ae
+		free(word);
da32ae
+
da32ae
+		/* Ignore ps group arguments */
da32ae
+		for (j = 0; j < num_pg_args; j++)
da32ae
+			p += get_word(p, NULL);
da32ae
 
da32ae
 		p += get_word(p, &word);
da32ae