device-mapper-multipath/0017-RH-don-t-start-without-a-config-file.patch
Benjamin Marzinski 5bea53fe7e device-mapper-multipath-0.7.4-1.git07e7bd5
Update Source to the latest upstream commit
  * Previous patches 0001-0006 are included in this commit
  * Previous patches 0007-0014 are now patches 0015-0022
Add 0001-libmultipath-fix-tur-checker-locking.patch
  * Fixed spinlock bug. posted upstream
Add 0002-multipath-fix-DEF_TIMEOUT-use.patch
  * Add missing sec to ms conversion. posted upstream
Add 0003-multipathd-remove-coalesce_paths-from-ev_add_map.patch
  * Remove unused code. posted upstream
Add 0004-multipathd-remove-unused-configure-parameter.patch
  * Remove unused code. posted upstream
Add 0005-Fix-set_no_path_retry-regression.patch
  * Fix issue with queueing and path addition. posted upstream
Add 0006-multipathd-change-spurious-uevent-msg-priority.patch
  * Change message priority to Notice. posted upstream
Add 0007-multipath-print-sysfs-state-in-fast-list-mode.patch
  * Show sysfs state correctly in fast list mode (-l). posted upstream
Add 0008-libmultipath-move-remove_map-waiter-code-to-multipat.patch
  * Move code around. posted upstream
Add 0009-move-waiter-code-from-libmultipath-to-multipathd.patch
  * Move code around. posted upstream
Add 0010-call-start_waiter_thread-before-setup_multipath.patch
  * Fix race on multipath device creations. posted upstream
Add 0011-libmultipath-add-helper-functions.patch
  * posted upstream
Add 0012-multipathd-RFC-add-new-polling-dmevents-waiter-threa.patch
  * Add alternate method of getting dmevents, that doesn't
    require a thread per device. posted upstream
Add 0013-libmultipath-condlog-log-to-stderr.patch
  * change condlog to log to stderr instead of stdout. posted upstream
Add 0014-multipathd-fix-compiler-warning-for-uev_pathfail_che.patch
  * fix indentation issue. posted upstream
2018-02-15 13:17:53 -06:00

107 lines
3.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 15 Oct 2014 10:39:30 -0500
Subject: [PATCH] RH: don't start without a config file
If /etc/multipath.conf doesn't exist, don't start multipathd and blacklist
all devices when running multipath. A completely blank configuration file
is almost never what users want. Also, people may have the multipath
packages installed but don't want to use them. This patch provides a
simple way to disable multipath. Simply removing or renaming
/etc/multipath.conf will keep multipath from doing anything.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/config.c | 15 +++++++++++++++
libmultipath/config.h | 1 +
multipath/multipath.rules | 1 +
multipathd/multipathd.8 | 2 ++
multipathd/multipathd.service | 1 +
5 files changed, 20 insertions(+)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 3d6a24c..27826fa 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -26,6 +26,7 @@
#include "devmapper.h"
#include "mpath_cmd.h"
#include "propsel.h"
+#include "version.h"
static int
hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2)
@@ -656,6 +657,20 @@ load_config (char * file)
factorize_hwtable(conf->hwtable, builtin_hwtable_size);
}
+ } else {
+ condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
+ if (conf->blist_devnode == NULL) {
+ conf->blist_devnode = vector_alloc();
+ if (!conf->blist_devnode) {
+ condlog(0, "cannot allocate blacklist\n");
+ goto out;
+ }
+ }
+ if (store_ble(conf->blist_devnode, strdup(".*"),
+ ORIGIN_NO_CONFIG)) {
+ condlog(0, "cannot store default no-config blacklist\n");
+ goto out;
+ }
}
conf->processed_main_config = 1;
diff --git a/libmultipath/config.h b/libmultipath/config.h
index a20ac2a..21a3bbd 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -9,6 +9,7 @@
#define ORIGIN_DEFAULT 0
#define ORIGIN_CONFIG 1
+#define ORIGIN_NO_CONFIG 2
/*
* In kernel, fast_io_fail == 0 means immediate failure on rport delete.
diff --git a/multipath/multipath.rules b/multipath/multipath.rules
index bc1a852..2bc0348 100644
--- a/multipath/multipath.rules
+++ b/multipath/multipath.rules
@@ -7,6 +7,7 @@ IMPORT{cmdline}="nompath"
ENV{nompath}=="?*", GOTO="end_mpath"
IMPORT{cmdline}="multipath"
ENV{multipath}=="off", GOTO="end_mpath"
+TEST!="/etc/multipath.conf", GOTO="end_mpath"
ENV{DEVTYPE}!="partition", GOTO="test_dev"
IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH"
diff --git a/multipathd/multipathd.8 b/multipathd/multipathd.8
index 5c96680..0515211 100644
--- a/multipathd/multipathd.8
+++ b/multipathd/multipathd.8
@@ -39,6 +39,8 @@ map regains its maximum performance and redundancy.
This daemon executes the external \fBmultipath\fR tool when events occur.
In turn, the multipath tool signals the multipathd daemon when it is done with
devmap reconfiguration, so that it can refresh its failed path list.
+
+In this Linux distribution, multipathd does not run unless a /etc/multipath.conf file exists.
.
.
.\" ----------------------------------------------------------------------------
diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service
index fd66cf6..fafd088 100644
--- a/multipathd/multipathd.service
+++ b/multipathd/multipathd.service
@@ -4,6 +4,7 @@ Wants=systemd-udev-trigger.service systemd-udev-settle.service
Before=iscsi.service iscsid.service lvm2-lvmetad.service lvm2-activation-early.service
Before=local-fs-pre.target blk-availability.service
After=multipathd.socket systemd-udev-trigger.service systemd-udev-settle.service
+ConditionPathExists=/etc/multipath.conf
DefaultDependencies=no
Conflicts=shutdown.target
ConditionKernelCommandLine=!nompath
--
2.7.4