device-mapper-multipath/0107-RHBZ-1169935-no-new-devs.patch
Benjamin Marzinski 6738b34a0b device-mapper-multipath-0.4.9-82
- Modify 0005-RH-add-mpathconf.patch
  * changed warning message
- Modify 0102-RHBZ-1160478-mpathconf-template.patch
  * updated man page
- Modify 0104-RHBZ-631009-deferred-remove.patch
  * refactor code and minor fix
- Refresh 0107-RHBZ-1169935-no-new-devs.patch
- Refresh 0112-RHBZ-1194917-add-config_dir-option.patch
- Refresh 0126-RHBZ-1211383-alias-collision.patch
- Add 0133-RHBZ-1296979-fix-define.patch
  * look for the correct libudev function to set define
- Add 0134-RHBZ-1241528-check-mpath-prefix.patch
  * only touch devices with a "mpath-" dm uuid prefix
- Add 0135-RHBZ-1299600-path-dev-uevents.patch
  * trigger path uevent the first time a path is claimed by multipath
- Add 0136-RHBZ-1304687-wait-for-map-add.patch
  * wait for the device to finish being added before reloading it.
- Add 0137-RHBZ-1280524-clear-chkr-msg.patch
- Add 0138-RHBZ-1288660-fix-mpathconf-allow.patch
  * don't remove existing lines from blacklist_exceptions section
- Add 0139-RHBZ-1273173-queue-no-daemon-doc.patch
- Add 0140-RHBZ-1299647-fix-help.patch
- Add 0141-RHBZ-1303953-mpathpersist-typo.patch
- Add 0142-RHBZ-1283750-kpartx-fix.patch
  * only remove devices if their uuid says that they are the correct
    partition device
- Add 0143-RHBZ-1299648-kpartx-sync.patch
  * default to using udev sync mode
- Add 0144-RHBZ-1299652-alua-pref-arg.patch
  * allow "exclusive_pref_bit" argument to alua prioritizer
- Add 0145-UP-resize-help-msg.patch
- Add 0146-UPBZ-1299651-raw-output.patch
  * allow raw format mutipathd show commands, that remove headers and padding
- Add 0147-RHBZ-1272620-fail-rm-msg.patch
- Add 0148-RHBZ-1292599-verify-before-remove.patch
  * verify that all partitions are unused before attempting to remove a device
- Add 0149-RHBZ-1292599-restore-removed-parts.patch
  * don't disable kpartx when restoring the first path of a device.
- Add 0150-RHBZ-1253913-fix-startup-msg.patch
  * wait for multipathd daemon to write pidfile before returning
- Add 0151-RHBZ-1297456-weighted-fix.patch
  * add wwn keyword to weighted prioritizer for persistent naming
- Add 0152-RHBZ-1269293-fix-blk-unit-file.patch
  * use "Wants" instead of "Requires"
- Add 0153-RH-fix-i686-size-bug.patch
  * use 64-bit keycodes for multipathd client commands
- Add 0154-UPBZ-1291406-disable-reinstate.patch
  * don't automatically reinstate ghost paths for implicit alua devices
- Add 0155-UPBZ-1300415-PURE-config.patch
  * Add default config for PURE FlashArray
- Add 0156-UPBZ-1313324-dont-fail-discovery.patch
  * don't fail discovery because individual paths failed.
- Add 0157-RHBZ-1319853-multipath-c-error-msg.patch
  * better error reporting for multipath -c
- Add 0158-RHBZ-1318581-timestamp-doc-fix.patch
  * add documentation for -T
- Add 0159-UPBZ-1255885-udev-waits.patch
  * make multipath and kpartx wait after for udev after each command
2016-04-21 21:27:49 -05:00

232 lines
7.4 KiB
Diff

---
libmultipath/config.c | 4 ++++
libmultipath/config.h | 1 +
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
===================================================================
--- multipath-tools-130222.orig/libmultipath/config.h
+++ multipath-tools-130222/libmultipath/config.h
@@ -131,6 +131,7 @@ struct config {
int detect_prio;
int force_sync;
int deferred_remove;
+ int ignore_new_boot_devs;
unsigned int version[3];
char * dev;
Index: multipath-tools-130222/libmultipath/configure.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/configure.c
+++ multipath-tools-130222/libmultipath/configure.c
@@ -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 (conf->find_multipaths && !refwwid &&
- !should_multipath(pp1, pathvec)) {
+ /* check if the path is valid */
+ if (!refwwid && !should_multipath(pp1, pathvec)) {
orphan_path(pp1);
continue;
}
Index: multipath-tools-130222/libmultipath/wwids.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/wwids.c
+++ multipath-tools-130222/libmultipath/wwids.c
@@ -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) {
- if (pp1->dev == pp2->dev)
- continue;
- if (strncmp(pp1->wwid, pp2->wwid, WWID_SIZE) == 0) {
- condlog(3, "found multiple paths with wwid %s, "
- "multipathing %s", pp1->wwid, pp1->dev);
- return 1;
+ if (!ignore_new_devs) {
+ vector_foreach_slot(pathvec, pp2, i) {
+ if (pp1->dev == pp2->dev)
+ continue;
+ if (strncmp(pp1->wwid, pp2->wwid, WWID_SIZE) == 0) {
+ condlog(3, "found multiple paths with wwid %s, "
+ "multipathing %s", pp1->wwid, pp1->dev);
+ return 1;
+ }
}
}
if (check_wwids_file(pp1->wwid, 0) < 0) {
Index: multipath-tools-130222/multipathd/main.c
===================================================================
--- multipath-tools-130222.orig/multipathd/main.c
+++ multipath-tools-130222/multipathd/main.c
@@ -503,8 +503,7 @@ rescan:
return 1;
}
- if (conf->find_multipaths &&
- !should_multipath(pp, vecs->pathvec)) {
+ if (!should_multipath(pp, vecs->pathvec)) {
orphan_path(pp);
return 0;
}
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
@@ -730,6 +731,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;
}
+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,
}
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/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)