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

68b27c
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
68b27c
From: Benjamin Marzinski <bmarzins@redhat.com>
68b27c
Date: Fri, 16 Jul 2021 12:39:17 -0500
68b27c
Subject: [PATCH] multipath: print warning if multipathd is not running.
68b27c
68b27c
If multipath notices that multipath devices exist or were created, and
68b27c
multipathd is not running, it now prints a warning message, so users are
68b27c
notified of the issue.
68b27c
68b27c
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
68b27c
---
68b27c
 libmultipath/configure.c          | 13 +++++++++++--
68b27c
 libmultipath/configure.h          |  1 +
68b27c
 libmultipath/libmultipath.version |  5 +++++
68b27c
 multipath/main.c                  |  5 +++++
68b27c
 4 files changed, 22 insertions(+), 2 deletions(-)
68b27c
68b27c
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
68b27c
index 6ca1f4bb..9da85ce6 100644
68b27c
--- a/libmultipath/configure.c
68b27c
+++ b/libmultipath/configure.c
68b27c
@@ -1083,7 +1083,8 @@ deadmap (struct multipath * mpp)
68b27c
 	return 1; /* dead */
68b27c
 }
68b27c
 
68b27c
-int check_daemon(void)
68b27c
+extern int
68b27c
+check_daemon(void)
68b27c
 {
68b27c
 	int fd;
68b27c
 	char *reply;
68b27c
@@ -1138,6 +1139,8 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
68b27c
 	struct config *conf;
68b27c
 	int allow_queueing;
68b27c
 	struct bitfield *size_mismatch_seen;
68b27c
+	bool map_processed = false;
68b27c
+	bool no_daemon = false;
68b27c
 
68b27c
 	/* ignore refwwid if it's empty */
68b27c
 	if (refwwid && !strlen(refwwid))
68b27c
@@ -1288,7 +1291,9 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
68b27c
 		conf = get_multipath_config();
68b27c
 		allow_queueing = conf->allow_queueing;
68b27c
 		put_multipath_config(conf);
68b27c
-		if (!is_daemon && !allow_queueing && !check_daemon()) {
68b27c
+		if (!is_daemon && !allow_queueing &&
68b27c
+		    (no_daemon || !check_daemon())) {
68b27c
+			no_daemon = true;
68b27c
 			if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF &&
68b27c
 			    mpp->no_path_retry != NO_PATH_RETRY_FAIL)
68b27c
 				condlog(3, "%s: multipathd not running, unset "
68b27c
@@ -1311,6 +1316,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
68b27c
 		else
68b27c
 			remove_map(mpp, vecs->pathvec, vecs->mpvec,
68b27c
 				   KEEP_VEC);
68b27c
+		map_processed = true;
68b27c
 	}
68b27c
 	/*
68b27c
 	 * Flush maps with only dead paths (ie not in sysfs)
68b27c
@@ -1336,6 +1342,9 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
68b27c
 				condlog(2, "%s: remove (dead)", alias);
68b27c
 		}
68b27c
 	}
68b27c
+	if (map_processed && !is_daemon && (no_daemon || !check_daemon()))
68b27c
+		condlog(2, "multipath devices exist, but multipathd service is not running");
68b27c
+
68b27c
 	ret = CP_OK;
68b27c
 out:
68b27c
 	free(size_mismatch_seen);
68b27c
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
68b27c
index 70cf77a3..741066b3 100644
68b27c
--- a/libmultipath/configure.h
68b27c
+++ b/libmultipath/configure.h
68b27c
@@ -60,3 +60,4 @@ struct udev_device *get_udev_device(const char *dev, enum devtypes dev_type);
68b27c
 void trigger_paths_udev_change(struct multipath *mpp, bool is_mpath);
68b27c
 void trigger_partitions_udev_change(struct udev_device *dev, const char *action,
68b27c
 				    int len);
68b27c
+int check_daemon(void);
68b27c
diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version
68b27c
index 0cff3111..d8be5fd2 100644
68b27c
--- a/libmultipath/libmultipath.version
68b27c
+++ b/libmultipath/libmultipath.version
68b27c
@@ -274,3 +274,8 @@ global:
68b27c
 local:
68b27c
 	*;
68b27c
 };
68b27c
+
68b27c
+LIBMULTIPATH_5.1.0 {
68b27c
+global:
68b27c
+	check_daemon;
68b27c
+} LIBMULTIPATH_5.0.0;
68b27c
diff --git a/multipath/main.c b/multipath/main.c
68b27c
index 9fe53dcd..85e4481d 100644
68b27c
--- a/multipath/main.c
68b27c
+++ b/multipath/main.c
68b27c
@@ -182,6 +182,7 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
68b27c
 	int i;
68b27c
 	struct multipath * mpp;
68b27c
 	int flags = (cmd == CMD_LIST_SHORT ? DI_NOIO : DI_ALL);
68b27c
+	bool maps_present = false;
68b27c
 
68b27c
 	if (dm_get_maps(curmp))
68b27c
 		return 1;
68b27c
@@ -214,11 +215,15 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
68b27c
 
68b27c
 		if (cmd == CMD_CREATE)
68b27c
 			reinstate_paths(mpp);
68b27c
+
68b27c
+		maps_present = true;
68b27c
 	}
68b27c
 
68b27c
 	if (cmd == CMD_LIST_SHORT || cmd == CMD_LIST_LONG)
68b27c
 		print_foreign_topology(libmp_verbosity);
68b27c
 
68b27c
+	if (maps_present && !check_daemon())
68b27c
+		condlog(2, "multipath devices exist, but multipathd service is not running");
68b27c
 	return 0;
68b27c
 }
68b27c