|
|
f20720 |
---
|
|
|
f20720 |
libmultipath/config.c | 1 +
|
|
|
f20720 |
libmultipath/config.h | 1 +
|
|
|
f20720 |
libmultipath/configure.c | 11 +++++++++++
|
|
|
f20720 |
libmultipath/defaults.h | 1 +
|
|
|
f20720 |
libmultipath/dict.c | 34 ++++++++++++++++++++++++++++++++++
|
|
|
f20720 |
libmultipath/wwids.c | 26 ++++++++++++++++++++++++++
|
|
|
f20720 |
libmultipath/wwids.h | 1 +
|
|
|
f20720 |
multipath/main.c | 2 +-
|
|
|
f20720 |
multipathd/main.c | 6 ++++++
|
|
|
f20720 |
9 files changed, 82 insertions(+), 1 deletion(-)
|
|
|
f20720 |
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/config.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/config.c
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/config.c
|
|
|
f20720 |
@@ -547,6 +547,7 @@ load_config (char * file)
|
|
|
f20720 |
conf->reassign_maps = DEFAULT_REASSIGN_MAPS;
|
|
|
f20720 |
conf->checkint = DEFAULT_CHECKINT;
|
|
|
f20720 |
conf->max_checkint = MAX_CHECKINT(conf->checkint);
|
|
|
f20720 |
+ conf->find_multipaths = DEFAULT_FIND_MULTIPATHS;
|
|
|
f20720 |
conf->fast_io_fail = DEFAULT_FAST_IO_FAIL;
|
|
|
f20720 |
conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER;
|
|
|
f20720 |
conf->detect_prio = DEFAULT_DETECT_PRIO;
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/configure.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/configure.c
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/configure.c
|
|
|
f20720 |
@@ -508,6 +508,10 @@ coalesce_paths (struct vectors * vecs, v
|
|
|
f20720 |
|
|
|
f20720 |
memset(empty_buff, 0, WWID_SIZE);
|
|
|
f20720 |
|
|
|
f20720 |
+ /* ignore refwwid if it's empty */
|
|
|
f20720 |
+ if (refwwid && !strlen(refwwid))
|
|
|
f20720 |
+ refwwid = NULL;
|
|
|
f20720 |
+
|
|
|
f20720 |
if (force_reload) {
|
|
|
f20720 |
vector_foreach_slot (pathvec, pp1, k) {
|
|
|
f20720 |
pp1->mpp = NULL;
|
|
|
f20720 |
@@ -537,6 +541,13 @@ coalesce_paths (struct vectors * vecs, v
|
|
|
f20720 |
if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE))
|
|
|
f20720 |
continue;
|
|
|
f20720 |
|
|
|
f20720 |
+ /* If find_multipaths was selected check if the path is valid */
|
|
|
f20720 |
+ if (conf->find_multipaths && !refwwid &&
|
|
|
f20720 |
+ !should_multipath(pp1, pathvec)) {
|
|
|
f20720 |
+ orphan_path(pp1);
|
|
|
f20720 |
+ continue;
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+
|
|
|
f20720 |
/*
|
|
|
f20720 |
* at this point, we know we really got a new mp
|
|
|
f20720 |
*/
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/defaults.h
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/defaults.h
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/defaults.h
|
|
|
f20720 |
@@ -15,6 +15,7 @@
|
|
|
f20720 |
#define DEFAULT_USER_FRIENDLY_NAMES 0
|
|
|
f20720 |
#define DEFAULT_VERBOSITY 2
|
|
|
f20720 |
#define DEFAULT_REASSIGN_MAPS 1
|
|
|
f20720 |
+#define DEFAULT_FIND_MULTIPATHS 0
|
|
|
f20720 |
#define DEFAULT_FAST_IO_FAIL 5
|
|
|
f20720 |
#define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_OFF
|
|
|
f20720 |
#define DEFAULT_DETECT_PRIO DETECT_PRIO_OFF
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/dict.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/dict.c
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/dict.c
|
|
|
f20720 |
@@ -585,6 +585,27 @@ def_reservation_key_handler(vector strve
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
static int
|
|
|
f20720 |
+def_find_multipaths_handler(vector strvec)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ char * buff;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ buff = set_value(strvec);
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if (!buff)
|
|
|
f20720 |
+ return 1;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
|
|
|
f20720 |
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
|
|
|
f20720 |
+ conf->find_multipaths = 0;
|
|
|
f20720 |
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
|
|
|
f20720 |
+ (strlen(buff) == 1 && !strcmp(buff, "1")))
|
|
|
f20720 |
+ conf->find_multipaths = 1;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ FREE(buff);
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+static int
|
|
|
f20720 |
def_names_handler(vector strvec)
|
|
|
f20720 |
{
|
|
|
f20720 |
char * buff;
|
|
|
f20720 |
@@ -2700,6 +2721,18 @@ snprint_def_log_checker_err (char * buff
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
static int
|
|
|
f20720 |
+snprint_def_find_multipaths (char * buff, int len, void * data)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ if (conf->find_multipaths == DEFAULT_FIND_MULTIPATHS)
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+ if (!conf->find_multipaths)
|
|
|
f20720 |
+ return snprintf(buff, len, "no");
|
|
|
f20720 |
+
|
|
|
f20720 |
+ return snprintf(buff, len, "yes");
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+
|
|
|
f20720 |
+static int
|
|
|
f20720 |
snprint_def_user_friendly_names (char * buff, int len, void * data)
|
|
|
f20720 |
{
|
|
|
f20720 |
if (conf->user_friendly_names == USER_FRIENDLY_NAMES_ON)
|
|
|
f20720 |
@@ -2833,6 +2866,7 @@ init_keywords(void)
|
|
|
f20720 |
install_keyword("wwids_file", &wwids_file_handler, &snprint_def_wwids_file);
|
|
|
f20720 |
install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err);
|
|
|
f20720 |
install_keyword("reservation_key", &def_reservation_key_handler, &snprint_def_reservation_key);
|
|
|
f20720 |
+ install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths);
|
|
|
f20720 |
install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler);
|
|
|
f20720 |
install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio);
|
|
|
f20720 |
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/wwids.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/wwids.c
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/wwids.c
|
|
|
f20720 |
@@ -125,6 +125,32 @@ out:
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
int
|
|
|
f20720 |
+should_multipath(struct path *pp1, vector pathvec)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ int i;
|
|
|
f20720 |
+ struct path *pp2;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ condlog(4, "checking if %s should be multipathed", pp1->dev);
|
|
|
f20720 |
+ vector_foreach_slot(pathvec, pp2, i) {
|
|
|
f20720 |
+ if (pp1->dev == pp2->dev)
|
|
|
f20720 |
+ continue;
|
|
|
f20720 |
+ if (strncmp(pp1->wwid, pp2->wwid, WWID_SIZE) == 0) {
|
|
|
f20720 |
+ condlog(3, "found multiple paths with wwid %s, "
|
|
|
f20720 |
+ "multipathing %s", pp1->wwid, pp1->dev);
|
|
|
f20720 |
+ return 1;
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+ if (check_wwids_file(pp1->wwid, 0) < 0) {
|
|
|
f20720 |
+ condlog(3, "wwid %s not in wwids file, skipping %s",
|
|
|
f20720 |
+ pp1->wwid, pp1->dev);
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+ condlog(3, "found wwid %s in wwids file, multipathing %s", pp1->wwid,
|
|
|
f20720 |
+ pp1->dev);
|
|
|
f20720 |
+ return 1;
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+int
|
|
|
f20720 |
remember_wwid(char *wwid)
|
|
|
f20720 |
{
|
|
|
f20720 |
int ret = check_wwids_file(wwid, 1);
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/wwids.h
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/wwids.h
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/wwids.h
|
|
|
f20720 |
@@ -12,6 +12,7 @@
|
|
|
f20720 |
"#\n" \
|
|
|
f20720 |
"# Valid WWIDs:\n"
|
|
|
f20720 |
|
|
|
f20720 |
+int should_multipath(struct path *pp, vector pathvec);
|
|
|
f20720 |
int remember_wwid(char *wwid);
|
|
|
f20720 |
int check_wwids_file(char *wwid, int write_wwid);
|
|
|
f20720 |
|
|
|
f20720 |
Index: multipath-tools-130222/multipath/main.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/multipath/main.c
|
|
|
f20720 |
+++ multipath-tools-130222/multipath/main.c
|
|
|
f20720 |
@@ -333,7 +333,7 @@ configure (void)
|
|
|
f20720 |
/*
|
|
|
f20720 |
* core logic entry point
|
|
|
f20720 |
*/
|
|
|
f20720 |
- r = coalesce_paths(&vecs, NULL, NULL, conf->force_reload);
|
|
|
f20720 |
+ r = coalesce_paths(&vecs, NULL, refwwid, conf->force_reload);
|
|
|
f20720 |
|
|
|
f20720 |
out:
|
|
|
f20720 |
if (refwwid)
|
|
|
f20720 |
Index: multipath-tools-130222/multipathd/main.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/multipathd/main.c
|
|
|
f20720 |
+++ multipath-tools-130222/multipathd/main.c
|
|
|
f20720 |
@@ -49,6 +49,7 @@
|
|
|
f20720 |
#include <print.h>
|
|
|
f20720 |
#include <configure.h>
|
|
|
f20720 |
#include <prio.h>
|
|
|
f20720 |
+#include <wwids.h>
|
|
|
f20720 |
#include <pgpolicies.h>
|
|
|
f20720 |
#include <uevent.h>
|
|
|
f20720 |
|
|
|
f20720 |
@@ -471,6 +472,11 @@ rescan:
|
|
|
f20720 |
return 1;
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
+ if (conf->find_multipaths &&
|
|
|
f20720 |
+ !should_multipath(pp, vecs->pathvec)) {
|
|
|
f20720 |
+ orphan_path(pp);
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+ }
|
|
|
f20720 |
condlog(4,"%s: creating new map", pp->dev);
|
|
|
f20720 |
if ((mpp = add_map_with_path(vecs, pp, 1))) {
|
|
|
f20720 |
mpp->action = ACT_CREATE;
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/config.h
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/config.h
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/config.h
|
|
|
f20720 |
@@ -106,6 +106,7 @@ struct config {
|
|
|
f20720 |
unsigned int dev_loss;
|
|
|
f20720 |
int log_checker_err;
|
|
|
f20720 |
int allow_queueing;
|
|
|
f20720 |
+ int find_multipaths;
|
|
|
f20720 |
uid_t uid;
|
|
|
f20720 |
gid_t gid;
|
|
|
f20720 |
mode_t mode;
|