Blame SOURCES/0130-libmultipath-cleanup-ACT_CREATE-code-in-select_actio.patch

108c2a
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
108c2a
From: Benjamin Marzinski <bmarzins@redhat.com>
108c2a
Date: Tue, 31 Jan 2023 10:35:10 -0600
108c2a
Subject: [PATCH] libmultipath: cleanup ACT_CREATE code in select_action
108c2a
108c2a
Combine the two separate blocks that set ACT_CREATE into one.
108c2a
108c2a
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
108c2a
---
108c2a
 libmultipath/configure.c | 38 +++++++++++++++++---------------------
108c2a
 1 file changed, 17 insertions(+), 21 deletions(-)
108c2a
108c2a
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
108c2a
index ecf24f95..303d2380 100644
108c2a
--- a/libmultipath/configure.c
108c2a
+++ b/libmultipath/configure.c
108c2a
@@ -693,33 +693,29 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
108c2a
 	cmpp = find_mp_by_wwid(curmp, mpp->wwid);
108c2a
 	cmpp_by_name = find_mp_by_alias(curmp, mpp->alias);
108c2a
 
108c2a
-	if (!cmpp_by_name) {
108c2a
-		if (cmpp) {
108c2a
-			condlog(2, "%s: rename %s to %s", mpp->wwid,
108c2a
-				cmpp->alias, mpp->alias);
108c2a
-			strlcpy(mpp->alias_old, cmpp->alias, WWID_SIZE);
108c2a
-			mpp->action = ACT_RENAME;
108c2a
-			if (force_reload) {
108c2a
-				mpp->force_udev_reload = 1;
108c2a
-				mpp->action = ACT_FORCERENAME;
108c2a
-			}
108c2a
-			return;
108c2a
+	if (!cmpp) {
108c2a
+		if (cmpp_by_name) {
108c2a
+			condlog(1, "%s: can't use alias \"%s\" used by %s, falling back to WWID",
108c2a
+				mpp->wwid, mpp->alias, cmpp_by_name->wwid);
108c2a
+			/* We can do this because wwid wasn't found */
108c2a
+			free(mpp->alias);
108c2a
+			mpp->alias = strdup(mpp->wwid);
108c2a
 		}
108c2a
 		mpp->action = ACT_CREATE;
108c2a
-		condlog(3, "%s: set ACT_CREATE (map does not exist)",
108c2a
-			mpp->alias);
108c2a
+		condlog(3, "%s: set ACT_CREATE (map does not exist%s)",
108c2a
+			mpp->alias, cmpp_by_name ? ", name changed" : "");
108c2a
 		return;
108c2a
 	}
108c2a
 
108c2a
-	if (!cmpp) {
108c2a
-		condlog(1, "%s: can't use alias \"%s\" used by %s, falling back to WWID",
108c2a
-			mpp->wwid, mpp->alias, cmpp_by_name->wwid);
108c2a
-		/* We can do this because wwid wasn't found */
108c2a
-		free(mpp->alias);
108c2a
-		mpp->alias = strdup(mpp->wwid);
108c2a
-		mpp->action = ACT_CREATE;
108c2a
-		condlog(3, "%s: set ACT_CREATE (map does not exist, name changed)",
108c2a
+	if (!cmpp_by_name) {
108c2a
+		condlog(2, "%s: rename %s to %s", mpp->wwid, cmpp->alias,
108c2a
 			mpp->alias);
108c2a
+		strlcpy(mpp->alias_old, cmpp->alias, WWID_SIZE);
108c2a
+		mpp->action = ACT_RENAME;
108c2a
+		if (force_reload) {
108c2a
+			mpp->force_udev_reload = 1;
108c2a
+			mpp->action = ACT_FORCERENAME;
108c2a
+		}
108c2a
 		return;
108c2a
 	}
108c2a