summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Marzinski <bmarzins@redhat.com>2014-12-18 17:08:30 -0600
committerBenjamin Marzinski <bmarzins@redhat.com>2014-12-18 17:08:30 -0600
commit5e9760974a4a5969afcae23dd20006b5f2bc8c01 (patch)
tree836f41e758bc57a818109fd25c80505ee50ac585
parentfdb6ec87792ea4aa912eb255329105862961d369 (diff)
downloaddevice-mapper-multipath-5e9760974a4a5969afcae23dd20006b5f2bc8c01.tar.gz
device-mapper-multipath-5e9760974a4a5969afcae23dd20006b5f2bc8c01.tar.xz
device-mapper-multipath-5e9760974a4a5969afcae23dd20006b5f2bc8c01.zip
device-mapper-multipath-0.4.9-72
Modify 0107-RHBZ-1169935-no-new-devs.patch * instead of using "-n" there is now a new configuration option, 'ignore_new_boot_devs'. If set to 'yes', multipath will ignore devices that aren't in /etc/multipath/wwids when running in the initramfs. This option does nothing while multipathd is running in the real root filesystem. Update 0109-RH-read-only-bindings.patch
-rw-r--r--0107-RHBZ-1169935-no-new-devs.patch222
-rw-r--r--0109-RH-read-only-bindings.patch8
-rw-r--r--device-mapper-multipath.spec11
3 files changed, 182 insertions, 59 deletions
diff --git a/0107-RHBZ-1169935-no-new-devs.patch b/0107-RHBZ-1169935-no-new-devs.patch
index 96d61a4..99ae35a 100644
--- a/0107-RHBZ-1169935-no-new-devs.patch
+++ b/0107-RHBZ-1169935-no-new-devs.patch
@@ -1,10 +1,13 @@
---
+ libmultipath/config.c | 4 ++++
libmultipath/config.h | 1 +
- libmultipath/configure.c | 4 ++--
- libmultipath/wwids.c | 16 +++++++++-------
- multipathd/main.c | 8 ++++++--
- multipathd/multipathd.8 | 6 ++++++
- 5 files changed, 24 insertions(+), 11 deletions(-)
+ libmultipath/configure.c | 5 ++---
+ libmultipath/dict.c | 33 +++++++++++++++++++++++++++++++++
+ libmultipath/util.c | 30 ++++++++++++++++++++++++++++++
+ libmultipath/util.h | 1 +
+ libmultipath/wwids.c | 21 ++++++++++++++-------
+ multipathd/main.c | 3 +--
+ 8 files changed, 86 insertions(+), 12 deletions(-)
Index: multipath-tools-130222/libmultipath/config.h
===================================================================
@@ -14,7 +17,7 @@ Index: multipath-tools-130222/libmultipath/config.h
int detect_prio;
int force_sync;
int deferred_remove;
-+ int no_new_devs;
++ int ignore_new_boot_devs;
unsigned int version[3];
char * dev;
@@ -22,14 +25,15 @@ Index: multipath-tools-130222/libmultipath/configure.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/configure.c
+++ multipath-tools-130222/libmultipath/configure.c
-@@ -776,8 +776,8 @@ coalesce_paths (struct vectors * vecs, v
+@@ -775,9 +775,8 @@ coalesce_paths (struct vectors * vecs, v
+ if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE))
continue;
- /* If find_multipaths was selected check if the path is valid */
+- /* If find_multipaths was selected check if the path is valid */
- if (conf->find_multipaths && !refwwid &&
- !should_multipath(pp1, pathvec)) {
-+ if ((conf->find_multipaths || conf->no_new_devs)
-+ && !refwwid && !should_multipath(pp1, pathvec)) {
++ /* check if the path is valid */
++ if (!refwwid && !should_multipath(pp1, pathvec)) {
orphan_path(pp1);
continue;
}
@@ -37,8 +41,22 @@ Index: multipath-tools-130222/libmultipath/wwids.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/wwids.c
+++ multipath-tools-130222/libmultipath/wwids.c
-@@ -270,13 +270,15 @@ should_multipath(struct path *pp1, vecto
+@@ -15,6 +15,7 @@
+ #include "wwids.h"
+ #include "defaults.h"
+ #include "config.h"
++#include "util.h"
+
+ /*
+ * Copyright (c) 2010 Benjamin Marzinski, Redhat
+@@ -268,15 +269,21 @@ should_multipath(struct path *pp1, vecto
+ {
+ int i;
struct path *pp2;
++ int ignore_new_devs = (conf->ignore_new_boot_devs && in_initrd());
++
++ if (!conf->find_multipaths && !ignore_new_devs)
++ return 1;
condlog(4, "checking if %s should be multipathed", pp1->dev);
- vector_foreach_slot(pathvec, pp2, i) {
@@ -48,7 +66,7 @@ Index: multipath-tools-130222/libmultipath/wwids.c
- condlog(3, "found multiple paths with wwid %s, "
- "multipathing %s", pp1->wwid, pp1->dev);
- return 1;
-+ if (!conf->no_new_devs) {
++ if (!ignore_new_devs) {
+ vector_foreach_slot(pathvec, pp2, i) {
+ if (pp1->dev == pp2->dev)
+ continue;
@@ -64,54 +82,150 @@ Index: multipath-tools-130222/multipathd/main.c
===================================================================
--- multipath-tools-130222.orig/multipathd/main.c
+++ multipath-tools-130222/multipathd/main.c
-@@ -503,7 +503,7 @@ rescan:
+@@ -503,8 +503,7 @@ rescan:
return 1;
}
- if (conf->find_multipaths &&
-+ if ((conf->find_multipaths || conf->no_new_devs) &&
- !should_multipath(pp, vecs->pathvec)) {
+- !should_multipath(pp, vecs->pathvec)) {
++ if (!should_multipath(pp, vecs->pathvec)) {
orphan_path(pp);
return 0;
-@@ -1427,6 +1427,7 @@ reconfigure (struct vectors * vecs)
+ }
+Index: multipath-tools-130222/libmultipath/config.c
+===================================================================
+--- multipath-tools-130222.orig/libmultipath/config.c
++++ multipath-tools-130222/libmultipath/config.c
+@@ -622,6 +622,7 @@ load_config (char * file, struct udev *u
+ conf->deferred_remove = DEFAULT_DEFERRED_REMOVE;
+ conf->hw_strmatch = 0;
+ conf->force_sync = 0;
++ conf->ignore_new_boot_devs = 0;
+
+ /*
+ * preload default hwtable
+@@ -732,6 +733,9 @@ load_config (char * file, struct udev *u
+ !conf->wwids_file)
+ goto out;
+
++ if (conf->ignore_new_boot_devs)
++ in_initrd();
++
+ return 0;
+ out:
+ free_config(conf);
+Index: multipath-tools-130222/libmultipath/dict.c
+===================================================================
+--- multipath-tools-130222.orig/libmultipath/dict.c
++++ multipath-tools-130222/libmultipath/dict.c
+@@ -761,6 +761,29 @@ def_deferred_remove_handler(vector strve
+ return 0;
+ }
- if (!load_config(DEFAULT_CONFIGFILE, udev)) {
- conf->verbosity = old->verbosity;
-+ conf->no_new_devs = old->no_new_devs;
- conf->daemon = 1;
- configure(vecs, 1);
- free_config(old);
-@@ -1880,12 +1881,15 @@ main (int argc, char *argv[])
- if (!conf)
- exit(1);
++static int
++def_ignore_new_boot_devs_handler(vector strvec)
++{
++ char * buff;
++
++ buff = set_value(strvec);
++
++ if (!buff)
++ return 1;
++
++ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
++ (strlen(buff) == 1 && !strcmp(buff, "0")))
++ conf->ignore_new_boot_devs = 0;
++ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
++ (strlen(buff) == 1 && !strcmp(buff, "1")))
++ conf->ignore_new_boot_devs = 1;
++ else
++ conf->ignore_new_boot_devs = 0;
++
++ FREE(buff);
++ return 0;
++}
++
+ /*
+ * blacklist block handlers
+ */
+@@ -3011,6 +3034,15 @@ snprint_def_deferred_remove(char * buff,
+ }
-- while ((arg = getopt(argc, argv, ":dv:k::")) != EOF ) {
-+ while ((arg = getopt(argc, argv, ":dnv:k::")) != EOF ) {
- switch(arg) {
- case 'd':
- logsink = 0;
- //debug=1; /* ### comment me out ### */
- break;
-+ case 'n':
-+ conf->no_new_devs = 1;
-+ break;
- case 'v':
- if (sizeof(optarg) > sizeof(char *) ||
- !isdigit(optarg[0]))
-Index: multipath-tools-130222/multipathd/multipathd.8
+ static int
++snprint_def_ignore_new_boot_devs(char * buff, int len, void * data)
++{
++ if (conf->ignore_new_boot_devs == 1)
++ return snprintf(buff, len, "yes");
++ else
++ return snprintf(buff, len, "no");
++}
++
++static int
+ snprint_ble_simple (char * buff, int len, void * data)
+ {
+ struct blentry * ble = (struct blentry *)data;
+@@ -3080,6 +3112,7 @@ init_keywords(void)
+ install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch);
+ install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync);
+ install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove);
++ install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs);
+ __deprecated install_keyword("default_selector", &def_selector_handler, NULL);
+ __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
+ __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
+Index: multipath-tools-130222/libmultipath/util.c
===================================================================
---- multipath-tools-130222.orig/multipathd/multipathd.8
-+++ multipath-tools-130222/multipathd/multipathd.8
-@@ -22,6 +22,12 @@ devmap reconfiguration, so that it can r
- .B \-d
- Forground Mode. Don't daemonize, and print all messages to stdout and stderr.
- .TP
-+.B -n
-+No new devs mode. When multipathd is started in this mode, it will only
-+create multipath devices if the device wwid is listed in /etc/multipath/wwids.
-+This means multipathd will never create a device that hasn't never been
-+created before.
-+.TP
- .B -v "level"
- Verbosity level. Print additional information while running multipathd. A level of 0 means only print errors. A level of 3 or greater prints debugging information as well.
- .TP
+--- multipath-tools-130222.orig/libmultipath/util.c
++++ multipath-tools-130222/libmultipath/util.c
+@@ -3,6 +3,8 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
++#include <sys/vfs.h>
++#include <linux/magic.h>
+
+ #include "debug.h"
+ #include "memory.h"
+@@ -267,3 +269,31 @@ dev_t parse_devt(const char *dev_t)
+
+ return makedev(maj, min);
+ }
++
++/* This define was taken from systemd. src/shared/macro.h */
++#define F_TYPE_EQUAL(a, b) (a == (typeof(a)) b)
++
++/* This function was taken from systemd. src/shared/util.c */
++int in_initrd(void) {
++ static int saved = -1;
++ struct statfs s;
++
++ if (saved >= 0)
++ return saved;
++
++ /* We make two checks here:
++ *
++ * 1. the flag file /etc/initrd-release must exist
++ * 2. the root file system must be a memory file system
++ * The second check is extra paranoia, since misdetecting an
++ * initrd can have bad bad consequences due the initrd
++ * emptying when transititioning to the main systemd.
++ */
++
++ saved = access("/etc/initrd-release", F_OK) >= 0 &&
++ statfs("/", &s) >= 0 &&
++ (F_TYPE_EQUAL(s.f_type, TMPFS_MAGIC) ||
++ F_TYPE_EQUAL(s.f_type, RAMFS_MAGIC));
++
++ return saved;
++}
+Index: multipath-tools-130222/libmultipath/util.h
+===================================================================
+--- multipath-tools-130222.orig/libmultipath/util.h
++++ multipath-tools-130222/libmultipath/util.h
+@@ -11,6 +11,7 @@ void remove_trailing_chars(char *path, c
+ int devt2devname (char *, int, char *);
+ dev_t parse_devt(const char *dev_t);
+ char *convert_dev(char *dev, int is_path_device);
++int in_initrd(void);
+
+ #define safe_sprintf(var, format, args...) \
+ snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
diff --git a/0109-RH-read-only-bindings.patch b/0109-RH-read-only-bindings.patch
index 536c5d4..c08120f 100644
--- a/0109-RH-read-only-bindings.patch
+++ b/0109-RH-read-only-bindings.patch
@@ -6,16 +6,16 @@ Index: multipath-tools-130222/multipathd/main.c
===================================================================
--- multipath-tools-130222.orig/multipathd/main.c
+++ multipath-tools-130222/multipathd/main.c
-@@ -1881,7 +1881,7 @@ main (int argc, char *argv[])
+@@ -1879,7 +1879,7 @@ main (int argc, char *argv[])
if (!conf)
exit(1);
-- while ((arg = getopt(argc, argv, ":dnv:k::")) != EOF ) {
-+ while ((arg = getopt(argc, argv, ":dnv:k::B")) != EOF ) {
+- while ((arg = getopt(argc, argv, ":dv:k::")) != EOF ) {
++ while ((arg = getopt(argc, argv, ":dv:k::B")) != EOF ) {
switch(arg) {
case 'd':
logsink = 0;
-@@ -1900,6 +1900,9 @@ main (int argc, char *argv[])
+@@ -1895,6 +1895,9 @@ main (int argc, char *argv[])
case 'k':
uxclnt(optarg);
exit(0);
diff --git a/device-mapper-multipath.spec b/device-mapper-multipath.spec
index f478059..7626b94 100644
--- a/device-mapper-multipath.spec
+++ b/device-mapper-multipath.spec
@@ -1,7 +1,7 @@
Summary: Tools to manage multipath devices using device-mapper
Name: device-mapper-multipath
Version: 0.4.9
-Release: 71%{?dist}
+Release: 72%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://christophe.varoqui.free.fr/
@@ -375,6 +375,15 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||:
%{_mandir}/man8/kpartx.8.gz
%changelog
+* Thu Dec 18 2014 Benjamin Marzinski <bmarzins@redhat.com> 0.4.9-72
+- Modify 0107-RHBZ-1169935-no-new-devs.patch
+ * instead of using "-n" there is now a new configuration option,
+ 'ignore_new_boot_devs'. If set to 'yes', multipath will ignore
+ devices that aren't in /etc/multipath/wwids when running in the
+ initramfs. This option does nothing while multipathd is running
+ in the real root filesystem.
+- Update 0109-RH-read-only-bindings.patch
+
* Mon Dec 15 2014 Benjamin Marzinski <bmarzins@redhat.com> 0.4.9-71
- Add 0103-RH-cleanup-partmaps-code.patch
* code refactoring to prepare for next patch