|
|
4728c8 |
---
|
|
|
4728c8 |
libmultipath/config.c | 4 ++++
|
|
|
4728c8 |
libmultipath/config.h | 1 +
|
|
|
4728c8 |
libmultipath/configure.c | 5 ++---
|
|
|
4728c8 |
libmultipath/dict.c | 33 +++++++++++++++++++++++++++++++++
|
|
|
4728c8 |
libmultipath/util.c | 30 ++++++++++++++++++++++++++++++
|
|
|
4728c8 |
libmultipath/util.h | 1 +
|
|
|
4728c8 |
libmultipath/wwids.c | 21 ++++++++++++++-------
|
|
|
4728c8 |
multipathd/main.c | 3 +--
|
|
|
4728c8 |
8 files changed, 86 insertions(+), 12 deletions(-)
|
|
|
4728c8 |
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/config.h
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/config.h
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/config.h
|
|
|
4728c8 |
@@ -131,6 +131,7 @@ struct config {
|
|
|
4728c8 |
int detect_prio;
|
|
|
4728c8 |
int force_sync;
|
|
|
4728c8 |
int deferred_remove;
|
|
|
4728c8 |
+ int ignore_new_boot_devs;
|
|
|
4728c8 |
unsigned int version[3];
|
|
|
4728c8 |
|
|
|
4728c8 |
char * dev;
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/configure.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/configure.c
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/configure.c
|
|
|
4728c8 |
@@ -775,9 +775,8 @@ coalesce_paths (struct vectors * vecs, v
|
|
|
4728c8 |
if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE))
|
|
|
4728c8 |
continue;
|
|
|
4728c8 |
|
|
|
4728c8 |
- /* If find_multipaths was selected check if the path is valid */
|
|
|
4728c8 |
- if (conf->find_multipaths && !refwwid &&
|
|
|
4728c8 |
- !should_multipath(pp1, pathvec)) {
|
|
|
4728c8 |
+ /* check if the path is valid */
|
|
|
4728c8 |
+ if (!refwwid && !should_multipath(pp1, pathvec)) {
|
|
|
4728c8 |
orphan_path(pp1);
|
|
|
4728c8 |
continue;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/wwids.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/wwids.c
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/wwids.c
|
|
|
4728c8 |
@@ -15,6 +15,7 @@
|
|
|
4728c8 |
#include "wwids.h"
|
|
|
4728c8 |
#include "defaults.h"
|
|
|
4728c8 |
#include "config.h"
|
|
|
4728c8 |
+#include "util.h"
|
|
|
4728c8 |
|
|
|
4728c8 |
/*
|
|
|
4728c8 |
* Copyright (c) 2010 Benjamin Marzinski, Redhat
|
|
|
4728c8 |
@@ -268,15 +269,21 @@ should_multipath(struct path *pp1, vecto
|
|
|
4728c8 |
{
|
|
|
4728c8 |
int i;
|
|
|
4728c8 |
struct path *pp2;
|
|
|
4728c8 |
+ int ignore_new_devs = (conf->ignore_new_boot_devs && in_initrd());
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ if (!conf->find_multipaths && !ignore_new_devs)
|
|
|
4728c8 |
+ return 1;
|
|
|
4728c8 |
|
|
|
4728c8 |
condlog(4, "checking if %s should be multipathed", pp1->dev);
|
|
|
4728c8 |
- vector_foreach_slot(pathvec, pp2, i) {
|
|
|
4728c8 |
- if (pp1->dev == pp2->dev)
|
|
|
4728c8 |
- continue;
|
|
|
4728c8 |
- if (strncmp(pp1->wwid, pp2->wwid, WWID_SIZE) == 0) {
|
|
|
4728c8 |
- condlog(3, "found multiple paths with wwid %s, "
|
|
|
4728c8 |
- "multipathing %s", pp1->wwid, pp1->dev);
|
|
|
4728c8 |
- return 1;
|
|
|
4728c8 |
+ if (!ignore_new_devs) {
|
|
|
4728c8 |
+ vector_foreach_slot(pathvec, pp2, i) {
|
|
|
4728c8 |
+ if (pp1->dev == pp2->dev)
|
|
|
4728c8 |
+ continue;
|
|
|
4728c8 |
+ if (strncmp(pp1->wwid, pp2->wwid, WWID_SIZE) == 0) {
|
|
|
4728c8 |
+ condlog(3, "found multiple paths with wwid %s, "
|
|
|
4728c8 |
+ "multipathing %s", pp1->wwid, pp1->dev);
|
|
|
4728c8 |
+ return 1;
|
|
|
4728c8 |
+ }
|
|
|
4728c8 |
}
|
|
|
4728c8 |
}
|
|
|
4728c8 |
if (check_wwids_file(pp1->wwid, 0) < 0) {
|
|
|
4728c8 |
Index: multipath-tools-130222/multipathd/main.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/multipathd/main.c
|
|
|
4728c8 |
+++ multipath-tools-130222/multipathd/main.c
|
|
|
4728c8 |
@@ -503,8 +503,7 @@ rescan:
|
|
|
4728c8 |
return 1;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
- if (conf->find_multipaths &&
|
|
|
4728c8 |
- !should_multipath(pp, vecs->pathvec)) {
|
|
|
4728c8 |
+ if (!should_multipath(pp, vecs->pathvec)) {
|
|
|
4728c8 |
orphan_path(pp);
|
|
|
4728c8 |
return 0;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/config.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/config.c
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/config.c
|
|
|
4728c8 |
@@ -622,6 +622,7 @@ load_config (char * file, struct udev *u
|
|
|
4728c8 |
conf->deferred_remove = DEFAULT_DEFERRED_REMOVE;
|
|
|
4728c8 |
conf->hw_strmatch = 0;
|
|
|
4728c8 |
conf->force_sync = 0;
|
|
|
4728c8 |
+ conf->ignore_new_boot_devs = 0;
|
|
|
4728c8 |
|
|
|
4728c8 |
/*
|
|
|
4728c8 |
* preload default hwtable
|
|
|
4728c8 |
@@ -732,6 +733,9 @@ load_config (char * file, struct udev *u
|
|
|
4728c8 |
!conf->wwids_file)
|
|
|
4728c8 |
goto out;
|
|
|
4728c8 |
|
|
|
4728c8 |
+ if (conf->ignore_new_boot_devs)
|
|
|
4728c8 |
+ in_initrd();
|
|
|
4728c8 |
+
|
|
|
4728c8 |
return 0;
|
|
|
4728c8 |
out:
|
|
|
4728c8 |
free_config(conf);
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/dict.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/dict.c
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/dict.c
|
|
|
4728c8 |
@@ -761,6 +761,29 @@ def_deferred_remove_handler(vector strve
|
|
|
4728c8 |
return 0;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
+static int
|
|
|
4728c8 |
+def_ignore_new_boot_devs_handler(vector strvec)
|
|
|
4728c8 |
+{
|
|
|
4728c8 |
+ char * buff;
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ buff = set_value(strvec);
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ if (!buff)
|
|
|
4728c8 |
+ return 1;
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
|
|
|
4728c8 |
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
|
|
|
4728c8 |
+ conf->ignore_new_boot_devs = 0;
|
|
|
4728c8 |
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
|
|
|
4728c8 |
+ (strlen(buff) == 1 && !strcmp(buff, "1")))
|
|
|
4728c8 |
+ conf->ignore_new_boot_devs = 1;
|
|
|
4728c8 |
+ else
|
|
|
4728c8 |
+ conf->ignore_new_boot_devs = 0;
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ FREE(buff);
|
|
|
4728c8 |
+ return 0;
|
|
|
4728c8 |
+}
|
|
|
4728c8 |
+
|
|
|
4728c8 |
/*
|
|
|
4728c8 |
* blacklist block handlers
|
|
|
4728c8 |
*/
|
|
|
4728c8 |
@@ -3011,6 +3034,15 @@ snprint_def_deferred_remove(char * buff,
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
static int
|
|
|
4728c8 |
+snprint_def_ignore_new_boot_devs(char * buff, int len, void * data)
|
|
|
4728c8 |
+{
|
|
|
4728c8 |
+ if (conf->ignore_new_boot_devs == 1)
|
|
|
4728c8 |
+ return snprintf(buff, len, "yes");
|
|
|
4728c8 |
+ else
|
|
|
4728c8 |
+ return snprintf(buff, len, "no");
|
|
|
4728c8 |
+}
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+static int
|
|
|
4728c8 |
snprint_ble_simple (char * buff, int len, void * data)
|
|
|
4728c8 |
{
|
|
|
4728c8 |
struct blentry * ble = (struct blentry *)data;
|
|
|
4728c8 |
@@ -3080,6 +3112,7 @@ init_keywords(void)
|
|
|
4728c8 |
install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch);
|
|
|
4728c8 |
install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync);
|
|
|
4728c8 |
install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove);
|
|
|
4728c8 |
+ install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs);
|
|
|
4728c8 |
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
|
|
|
4728c8 |
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
|
|
|
4728c8 |
__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/util.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/util.c
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/util.c
|
|
|
4728c8 |
@@ -3,6 +3,8 @@
|
|
|
4728c8 |
#include <sys/types.h>
|
|
|
4728c8 |
#include <sys/stat.h>
|
|
|
4728c8 |
#include <unistd.h>
|
|
|
4728c8 |
+#include <sys/vfs.h>
|
|
|
4728c8 |
+#include <linux/magic.h>
|
|
|
4728c8 |
|
|
|
4728c8 |
#include "debug.h"
|
|
|
4728c8 |
#include "memory.h"
|
|
|
4728c8 |
@@ -267,3 +269,31 @@ dev_t parse_devt(const char *dev_t)
|
|
|
4728c8 |
|
|
|
4728c8 |
return makedev(maj, min);
|
|
|
4728c8 |
}
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+/* This define was taken from systemd. src/shared/macro.h */
|
|
|
4728c8 |
+#define F_TYPE_EQUAL(a, b) (a == (typeof(a)) b)
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+/* This function was taken from systemd. src/shared/util.c */
|
|
|
4728c8 |
+int in_initrd(void) {
|
|
|
4728c8 |
+ static int saved = -1;
|
|
|
4728c8 |
+ struct statfs s;
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ if (saved >= 0)
|
|
|
4728c8 |
+ return saved;
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ /* We make two checks here:
|
|
|
4728c8 |
+ *
|
|
|
4728c8 |
+ * 1. the flag file /etc/initrd-release must exist
|
|
|
4728c8 |
+ * 2. the root file system must be a memory file system
|
|
|
4728c8 |
+ * The second check is extra paranoia, since misdetecting an
|
|
|
4728c8 |
+ * initrd can have bad bad consequences due the initrd
|
|
|
4728c8 |
+ * emptying when transititioning to the main systemd.
|
|
|
4728c8 |
+ */
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ saved = access("/etc/initrd-release", F_OK) >= 0 &&
|
|
|
4728c8 |
+ statfs("/", &s) >= 0 &&
|
|
|
4728c8 |
+ (F_TYPE_EQUAL(s.f_type, TMPFS_MAGIC) ||
|
|
|
4728c8 |
+ F_TYPE_EQUAL(s.f_type, RAMFS_MAGIC));
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ return saved;
|
|
|
4728c8 |
+}
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/util.h
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/util.h
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/util.h
|
|
|
4728c8 |
@@ -11,6 +11,7 @@ void remove_trailing_chars(char *path, c
|
|
|
4728c8 |
int devt2devname (char *, int, char *);
|
|
|
4728c8 |
dev_t parse_devt(const char *dev_t);
|
|
|
4728c8 |
char *convert_dev(char *dev, int is_path_device);
|
|
|
4728c8 |
+int in_initrd(void);
|
|
|
4728c8 |
|
|
|
4728c8 |
#define safe_sprintf(var, format, args...) \
|
|
|
4728c8 |
snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
|