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

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