Blame SOURCES/0075-multipath-print-warning-if-multipathd-is-not-running.patch

b46d12
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b46d12
From: Benjamin Marzinski <bmarzins@redhat.com>
b46d12
Date: Fri, 16 Jul 2021 12:39:17 -0500
b46d12
Subject: [PATCH] multipath: print warning if multipathd is not running.
b46d12
b46d12
If multipath notices that multipath devices exist or were created, and
b46d12
multipathd is not running, it now prints a warning message, so users are
b46d12
notified of the issue.
b46d12
b46d12
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
b46d12
---
b46d12
 libmultipath/configure.c | 13 +++++++++++--
b46d12
 libmultipath/configure.h |  1 +
b46d12
 multipath/main.c         |  5 +++++
b46d12
 3 files changed, 17 insertions(+), 2 deletions(-)
b46d12
b46d12
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
b46d12
index f24d9283..9c8d3e34 100644
b46d12
--- a/libmultipath/configure.c
b46d12
+++ b/libmultipath/configure.c
b46d12
@@ -1043,7 +1043,8 @@ deadmap (struct multipath * mpp)
b46d12
 	return 1; /* dead */
b46d12
 }
b46d12
 
b46d12
-int check_daemon(void)
b46d12
+extern int
b46d12
+check_daemon(void)
b46d12
 {
b46d12
 	int fd;
b46d12
 	char *reply;
b46d12
@@ -1097,6 +1098,8 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
b46d12
 	struct config *conf;
b46d12
 	int allow_queueing;
b46d12
 	uint64_t *size_mismatch_seen;
b46d12
+	bool map_processed = false;
b46d12
+	bool no_daemon = false;
b46d12
 
b46d12
 	/* ignore refwwid if it's empty */
b46d12
 	if (refwwid && !strlen(refwwid))
b46d12
@@ -1239,7 +1242,9 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
b46d12
 		conf = get_multipath_config();
b46d12
 		allow_queueing = conf->allow_queueing;
b46d12
 		put_multipath_config(conf);
b46d12
-		if (!is_daemon && !allow_queueing && !check_daemon()) {
b46d12
+		if (!is_daemon && !allow_queueing &&
b46d12
+		    (no_daemon || !check_daemon())) {
b46d12
+			no_daemon = true;
b46d12
 			if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF &&
b46d12
 			    mpp->no_path_retry != NO_PATH_RETRY_FAIL)
b46d12
 				condlog(3, "%s: multipathd not running, unset "
b46d12
@@ -1267,6 +1272,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
b46d12
 			else
b46d12
 				remove_map(mpp, vecs, 0);
b46d12
 		}
b46d12
+		map_processed = true;
b46d12
 	}
b46d12
 	/*
b46d12
 	 * Flush maps with only dead paths (ie not in sysfs)
b46d12
@@ -1292,6 +1298,9 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
b46d12
 				condlog(2, "%s: remove (dead)", alias);
b46d12
 		}
b46d12
 	}
b46d12
+	if (map_processed && !is_daemon && (no_daemon || !check_daemon()))
b46d12
+		condlog(2, "multipath devices exist, but multipathd service is not running");
b46d12
+
b46d12
 	ret = CP_OK;
b46d12
 out:
b46d12
 	free(size_mismatch_seen);
b46d12
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
b46d12
index 81090dd4..8a266d31 100644
b46d12
--- a/libmultipath/configure.h
b46d12
+++ b/libmultipath/configure.h
b46d12
@@ -59,3 +59,4 @@ struct udev_device *get_udev_device(const char *dev, enum devtypes dev_type);
b46d12
 void trigger_paths_udev_change(struct multipath *mpp, bool is_mpath);
b46d12
 void trigger_partitions_udev_change(struct udev_device *dev, const char *action,
b46d12
 				    int len);
b46d12
+int check_daemon(void);
b46d12
diff --git a/multipath/main.c b/multipath/main.c
b46d12
index 607cada2..14d045c9 100644
b46d12
--- a/multipath/main.c
b46d12
+++ b/multipath/main.c
b46d12
@@ -254,6 +254,7 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
b46d12
 	int i;
b46d12
 	struct multipath * mpp;
b46d12
 	char params[PARAMS_SIZE], status[PARAMS_SIZE];
b46d12
+	bool maps_present = false;
b46d12
 
b46d12
 	if (dm_get_maps(curmp))
b46d12
 		return 1;
b46d12
@@ -302,6 +303,8 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
b46d12
 
b46d12
 		if (cmd == CMD_CREATE)
b46d12
 			reinstate_paths(mpp);
b46d12
+
b46d12
+		maps_present = true;
b46d12
 	}
b46d12
 
b46d12
 	if (cmd == CMD_LIST_SHORT || cmd == CMD_LIST_LONG) {
b46d12
@@ -311,6 +314,8 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
b46d12
 		put_multipath_config(conf);
b46d12
 	}
b46d12
 
b46d12
+	if (maps_present && !check_daemon())
b46d12
+		condlog(2, "multipath devices exist, but multipathd service is not running");
b46d12
 	return 0;
b46d12
 }
b46d12