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

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