Blame SOURCES/0076-multipathd-don-t-access-path-if-it-was-deleted.patch

50e627
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
50e627
From: Benjamin Marzinski <bmarzins@redhat.com>
50e627
Date: Fri, 23 Jul 2021 14:10:06 -0500
50e627
Subject: [PATCH] multipathd: don't access path if it was deleted
50e627
50e627
ev_remove_path() could fail and still delete the path. This could cause
50e627
problems for handle_path_wwid_change(), which expected that a failure
50e627
meant that the path still existed. ev_remove_path now returns a
50e627
different error code for failure to reload the multipath device, so that
50e627
it can be differentiated from cases where the path was no removed.
50e627
50e627
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
50e627
---
50e627
 multipathd/main.c | 11 +++++++----
50e627
 1 file changed, 7 insertions(+), 4 deletions(-)
50e627
50e627
diff --git a/multipathd/main.c b/multipathd/main.c
50e627
index e6c19ab2..823b53a2 100644
50e627
--- a/multipathd/main.c
50e627
+++ b/multipathd/main.c
50e627
@@ -86,6 +86,9 @@
50e627
 #define FILE_NAME_SIZE 256
50e627
 #define CMDSIZE 160
50e627
 
50e627
+#define PATH_REMOVE_FAILED 1
50e627
+#define MAP_RELOAD_FAILED 2
50e627
+
50e627
 #define LOG_MSG(lvl, verb, pp)					\
50e627
 do {								\
50e627
 	if (pp->mpp && checker_selected(&pp->checker) &&	\
50e627
@@ -840,7 +843,7 @@ handle_path_wwid_change(struct path *pp, struct vectors *vecs)
50e627
 		return;
50e627
 
50e627
 	udd = udev_device_ref(pp->udev);
50e627
-	if (ev_remove_path(pp, vecs, 1) != 0 && pp->mpp) {
50e627
+	if (ev_remove_path(pp, vecs, 1) == PATH_REMOVE_FAILED && pp->mpp) {
50e627
 		pp->dmstate = PSTATE_FAILED;
50e627
 		dm_fail_path(pp->mpp->alias, pp->dev_t);
50e627
 	}
50e627
@@ -1226,13 +1229,13 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)
50e627
 			condlog(0, "%s: failed in domap for "
50e627
 				"removal of path %s",
50e627
 				mpp->alias, pp->dev);
50e627
-			retval = 1;
50e627
+			retval = MAP_RELOAD_FAILED;
50e627
 		} else {
50e627
 			/*
50e627
 			 * update our state from kernel
50e627
 			 */
50e627
 			if (setup_multipath(vecs, mpp))
50e627
-				return 1;
50e627
+				return PATH_REMOVE_FAILED;
50e627
 			sync_map_state(mpp);
50e627
 
50e627
 			condlog(2, "%s [%s]: path removed from map %s",
50e627
@@ -1250,7 +1253,7 @@ out:
50e627
 
50e627
 fail:
50e627
 	remove_map_and_stop_waiter(mpp, vecs);
50e627
-	return 1;
50e627
+	return PATH_REMOVE_FAILED;
50e627
 }
50e627
 
50e627
 static int