|
|
f20720 |
---
|
|
|
f20720 |
libmultipath/config.c | 1 +
|
|
|
f20720 |
libmultipath/config.h | 1 +
|
|
|
f20720 |
libmultipath/dict.c | 33 +++++++++++++++++++++++++++++++++
|
|
|
f20720 |
libmultipath/discovery.c | 11 ++++++-----
|
|
|
f20720 |
libmultipath/discovery.h | 1 +
|
|
|
f20720 |
libmultipath/structs.h | 1 +
|
|
|
f20720 |
multipathd/main.c | 26 ++++++++++++++++++++++++++
|
|
|
f20720 |
7 files changed, 69 insertions(+), 5 deletions(-)
|
|
|
f20720 |
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/discovery.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/discovery.c
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/discovery.c
|
|
|
f20720 |
@@ -1155,8 +1155,8 @@ free_dev:
|
|
|
f20720 |
return ret;
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
-static int
|
|
|
f20720 |
-get_uid (struct path * pp)
|
|
|
f20720 |
+int
|
|
|
f20720 |
+get_uid (struct path * pp, struct udev_device *udev)
|
|
|
f20720 |
{
|
|
|
f20720 |
char *c;
|
|
|
f20720 |
const char *value;
|
|
|
f20720 |
@@ -1165,7 +1165,7 @@ get_uid (struct path * pp)
|
|
|
f20720 |
if (!pp->uid_attribute)
|
|
|
f20720 |
select_getuid(pp);
|
|
|
f20720 |
|
|
|
f20720 |
- if (!pp->udev) {
|
|
|
f20720 |
+ if (!udev) {
|
|
|
f20720 |
condlog(1, "%s: no udev information", pp->dev);
|
|
|
f20720 |
return 1;
|
|
|
f20720 |
}
|
|
|
f20720 |
@@ -1180,7 +1180,7 @@ get_uid (struct path * pp)
|
|
|
f20720 |
pp->tick = conf->retrigger_delay;
|
|
|
f20720 |
}
|
|
|
f20720 |
} else {
|
|
|
f20720 |
- value = udev_device_get_property_value(pp->udev,
|
|
|
f20720 |
+ value = udev_device_get_property_value(udev,
|
|
|
f20720 |
pp->uid_attribute);
|
|
|
f20720 |
if ((!value || strlen(value) == 0) &&
|
|
|
f20720 |
conf->cmd == CMD_VALID_PATH)
|
|
|
f20720 |
@@ -1194,6 +1194,7 @@ get_uid (struct path * pp)
|
|
|
f20720 |
len = strlen(value);
|
|
|
f20720 |
}
|
|
|
f20720 |
strncpy(pp->wwid, value, len);
|
|
|
f20720 |
+ condlog(4, "%s: got wwid of '%s'", pp->dev, pp->wwid);
|
|
|
f20720 |
pp->missing_udev_info = INFO_OK;
|
|
|
f20720 |
pp->tick = 0;
|
|
|
f20720 |
} else {
|
|
|
f20720 |
@@ -1282,7 +1283,7 @@ pathinfo (struct path *pp, vector hwtabl
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
if ((mask & DI_WWID) && !strlen(pp->wwid))
|
|
|
f20720 |
- get_uid(pp);
|
|
|
f20720 |
+ get_uid(pp, pp->udev);
|
|
|
f20720 |
if (mask & DI_BLACKLIST && mask & DI_WWID) {
|
|
|
f20720 |
if (filter_wwid(conf->blist_wwid, conf->elist_wwid,
|
|
|
f20720 |
pp->wwid) > 0) {
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/discovery.h
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/discovery.h
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/discovery.h
|
|
|
f20720 |
@@ -44,6 +44,7 @@ int sysfs_set_scsi_tmo (struct multipath
|
|
|
f20720 |
int sysfs_get_timeout(struct path *pp, unsigned int *timeout);
|
|
|
f20720 |
int sysfs_get_host_pci_name(struct path *pp, char *pci_name);
|
|
|
f20720 |
int sysfs_get_iscsi_ip_address(struct path *pp, char *ip_address);
|
|
|
f20720 |
+int get_uid (struct path * pp, struct udev_device *udev);
|
|
|
f20720 |
|
|
|
f20720 |
/*
|
|
|
f20720 |
* discovery bitmask
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/structs.h
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/structs.h
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/structs.h
|
|
|
f20720 |
@@ -209,6 +209,7 @@ struct path {
|
|
|
f20720 |
int fd;
|
|
|
f20720 |
int missing_udev_info;
|
|
|
f20720 |
int retriggers;
|
|
|
f20720 |
+ int wwid_changed;
|
|
|
f20720 |
|
|
|
f20720 |
/* configlet pointers */
|
|
|
f20720 |
struct hwentry * hwe;
|
|
|
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 |
@@ -784,6 +784,26 @@ uev_update_path (struct uevent *uev, str
|
|
|
f20720 |
if (pp->missing_udev_info == INFO_REQUESTED)
|
|
|
f20720 |
return uev_add_path(uev, vecs);
|
|
|
f20720 |
|
|
|
f20720 |
+ if (conf->disable_changed_wwids &&
|
|
|
f20720 |
+ (strlen(pp->wwid) || pp->wwid_changed)) {
|
|
|
f20720 |
+ char wwid[WWID_SIZE];
|
|
|
f20720 |
+
|
|
|
f20720 |
+ strcpy(wwid, pp->wwid);
|
|
|
f20720 |
+ get_uid(pp, uev->udev);
|
|
|
f20720 |
+ if (strcmp(wwid, pp->wwid) != 0) {
|
|
|
f20720 |
+ condlog(0, "%s: path wwid changed from '%s' to '%s'. disallowing", uev->kernel, wwid, pp->wwid);
|
|
|
f20720 |
+ strcpy(pp->wwid, wwid);
|
|
|
f20720 |
+ if (!pp->wwid_changed) {
|
|
|
f20720 |
+ pp->wwid_changed = 1;
|
|
|
f20720 |
+ pp->tick = 1;
|
|
|
f20720 |
+ dm_fail_path(pp->mpp->alias, pp->dev_t);
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+ else {
|
|
|
f20720 |
+ pp->wwid_changed = 0;
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+
|
|
|
f20720 |
/* reinit the prio values on change event, in case something is
|
|
|
f20720 |
* different */
|
|
|
f20720 |
prio_init(&pp->prio);
|
|
|
f20720 |
@@ -1284,6 +1304,12 @@ check_path (struct vectors * vecs, struc
|
|
|
f20720 |
else
|
|
|
f20720 |
checker_clear_message(&pp->checker);
|
|
|
f20720 |
|
|
|
f20720 |
+ if (pp->wwid_changed) {
|
|
|
f20720 |
+ condlog(2, "%s: path wwid has changed. Refusing to use",
|
|
|
f20720 |
+ pp->dev);
|
|
|
f20720 |
+ newstate = PATH_DOWN;
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+
|
|
|
f20720 |
if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) {
|
|
|
f20720 |
condlog(2, "%s: unusable path", pp->dev);
|
|
|
f20720 |
pathinfo(pp, conf->hwtable, 0);
|
|
|
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 |
@@ -681,6 +681,7 @@ load_config (char * file, struct udev *u
|
|
|
f20720 |
conf->uev_wait_timeout = DEFAULT_UEV_WAIT_TIMEOUT;
|
|
|
f20720 |
conf->skip_kpartx = DEFAULT_SKIP_KPARTX;
|
|
|
f20720 |
conf->remove_retries = 0;
|
|
|
f20720 |
+ conf->disable_changed_wwids = 0;
|
|
|
f20720 |
|
|
|
f20720 |
/*
|
|
|
f20720 |
* preload default hwtable
|
|
|
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 |
@@ -147,6 +147,7 @@ struct config {
|
|
|
f20720 |
int uev_wait_timeout;
|
|
|
f20720 |
int skip_kpartx;
|
|
|
f20720 |
int remove_retries;
|
|
|
f20720 |
+ int disable_changed_wwids;
|
|
|
f20720 |
unsigned int version[3];
|
|
|
f20720 |
|
|
|
f20720 |
char * dev;
|
|
|
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 |
@@ -953,6 +953,29 @@ def_remove_retries_handler(vector strvec
|
|
|
f20720 |
return 0;
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
+static int
|
|
|
f20720 |
+def_disable_changed_wwids_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->disable_changed_wwids = 0;
|
|
|
f20720 |
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
|
|
|
f20720 |
+ (strlen(buff) == 1 && !strcmp(buff, "1")))
|
|
|
f20720 |
+ conf->disable_changed_wwids = 1;
|
|
|
f20720 |
+ else
|
|
|
f20720 |
+ conf->disable_changed_wwids = 0;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ FREE(buff);
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
/*
|
|
|
f20720 |
* blacklist block handlers
|
|
|
f20720 |
*/
|
|
|
f20720 |
@@ -3429,6 +3452,15 @@ snprint_def_remove_retries (char * buff,
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
static int
|
|
|
f20720 |
+snprint_def_disable_changed_wwids(char * buff, int len, void * data)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ if (conf->disable_changed_wwids == 1)
|
|
|
f20720 |
+ return snprintf(buff, len, "yes");
|
|
|
f20720 |
+ else
|
|
|
f20720 |
+ return snprintf(buff, len, "no");
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+static int
|
|
|
f20720 |
snprint_ble_simple (char * buff, int len, void * data)
|
|
|
f20720 |
{
|
|
|
f20720 |
struct blentry * ble = (struct blentry *)data;
|
|
|
f20720 |
@@ -3508,6 +3540,7 @@ init_keywords(void)
|
|
|
f20720 |
install_keyword("missing_uev_wait_timeout", &def_uev_wait_timeout_handler, &snprint_def_uev_wait_timeout);
|
|
|
f20720 |
install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot);
|
|
|
f20720 |
install_keyword("remove_retries", &def_remove_retries_handler, &snprint_def_remove_retries);
|
|
|
f20720 |
+ install_keyword("disable_changed_wwids", &def_disable_changed_wwids_handler, &snprint_def_disable_changed_wwids);
|
|
|
f20720 |
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
|
|
|
f20720 |
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
|
|
|
f20720 |
__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
|