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