35f5570500
Update Source to upstream version 0.8.0 * Previous patches 0006 & 0007 are included in this commit Rename files * Previous patches 0008-0016 & 0100 are now patches 0018-0027 Add 0006-multipathd-Fix-miscounting-active-paths.patch Add 0007-multipathd-ignore-failed-wwid-recheck.patch * multipathd will no longer disable paths if it is unable to get their wwid on a change event Add 0008-libmutipath-continue-to-use-old-state-on-PATH_PENDIN.patch Add 0009-multipathd-use-update_path_groups-instead-of-reload_.patch Add 0010-multipath.conf-add-missing-options-to-man-page.patch Add 0011-libmultipath-add-get_uid-fallback-code-for-NVMe-devi.patch Add 0012-libmulitpath-cleanup-uid_fallback-code.patch Add 0013-multipathd-handle-changed-wwids-by-removal-and-addit.patch * if a path device changes wwid, it will now be removed and re-added to the correct multipath device. Add 0014-multipathd-remove-wwid_changed-path-attribute.patch Add 0015-multipathd-ignore-disable_changed_wwids.patch Add 0016-multipathd-Don-t-use-fallback-code-after-getting-wwi.patch Add 0017-libmultipath-silence-dm_is_mpath-error-messages.patch * The above 12 patches have been submitted upstream
130 lines
3.8 KiB
Diff
130 lines
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Wed, 27 Mar 2019 12:21:57 -0500
|
|
Subject: [PATCH] libmulitpath: cleanup uid_fallback code
|
|
|
|
Instead of always calling uid_fallback() if the configured method to get
|
|
the uid failed, get_uid now checks if the path supports fallbacks and if
|
|
all the retriggers have occurred. If so, it calls uid_fallback(), which
|
|
just attempts to get the uid using the appropriate fallback method. None
|
|
of these changes should make the code function any differently.
|
|
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
libmultipath/discovery.c | 85 ++++++++++++++++++++++------------------
|
|
1 file changed, 46 insertions(+), 39 deletions(-)
|
|
|
|
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
|
|
index bece67c..3ec60d6 100644
|
|
--- a/libmultipath/discovery.c
|
|
+++ b/libmultipath/discovery.c
|
|
@@ -1755,50 +1755,50 @@ get_vpd_uid(struct path * pp)
|
|
}
|
|
|
|
static ssize_t uid_fallback(struct path *pp, int path_state,
|
|
- const char **origin, ssize_t old_len)
|
|
+ const char **origin)
|
|
{
|
|
- ssize_t len = old_len;
|
|
- int retrigger;
|
|
- struct config *conf;
|
|
-
|
|
- conf = get_multipath_config();
|
|
- retrigger = conf->retrigger_tries;
|
|
- put_multipath_config(conf);
|
|
- if (pp->retriggers >= retrigger) {
|
|
- if (pp->bus == SYSFS_BUS_SCSI &&
|
|
- !strcmp(pp->uid_attribute, DEFAULT_UID_ATTRIBUTE)) {
|
|
- len = get_vpd_uid(pp);
|
|
- *origin = "sysfs";
|
|
- pp->uid_attribute = NULL;
|
|
- if (len < 0 && path_state == PATH_UP) {
|
|
- condlog(1, "%s: failed to get sysfs uid: %s",
|
|
- pp->dev, strerror(-len));
|
|
- len = get_vpd_sgio(pp->fd, 0x83, pp->wwid,
|
|
+ ssize_t len = -1;
|
|
+
|
|
+ if (pp->bus == SYSFS_BUS_SCSI &&
|
|
+ !strcmp(pp->uid_attribute, DEFAULT_UID_ATTRIBUTE)) {
|
|
+ len = get_vpd_uid(pp);
|
|
+ *origin = "sysfs";
|
|
+ pp->uid_attribute = NULL;
|
|
+ if (len < 0 && path_state == PATH_UP) {
|
|
+ condlog(1, "%s: failed to get sysfs uid: %s",
|
|
+ pp->dev, strerror(-len));
|
|
+ len = get_vpd_sgio(pp->fd, 0x83, pp->wwid,
|
|
+ WWID_SIZE);
|
|
+ *origin = "sgio";
|
|
+ }
|
|
+ } else if (pp->bus == SYSFS_BUS_NVME) {
|
|
+ char value[256];
|
|
+ len = sysfs_attr_get_value(pp->udev, "wwid", value,
|
|
+ sizeof(value));
|
|
+ if (len <= 0)
|
|
+ return -1;
|
|
+ len = strlcpy(pp->wwid, value, WWID_SIZE);
|
|
+ if (len >= WWID_SIZE) {
|
|
+ len = fix_broken_nvme_wwid(pp, value,
|
|
WWID_SIZE);
|
|
- *origin = "sgio";
|
|
- }
|
|
- } else if (pp->bus == SYSFS_BUS_NVME) {
|
|
- char value[256];
|
|
- len = sysfs_attr_get_value(pp->udev, "wwid", value,
|
|
- sizeof(value));
|
|
- if (len <= 0)
|
|
- return -1;
|
|
- len = strlcpy(pp->wwid, value, WWID_SIZE);
|
|
- if (len >= WWID_SIZE) {
|
|
- len = fix_broken_nvme_wwid(pp, value,
|
|
- WWID_SIZE);
|
|
- if (len > 0)
|
|
- return len;
|
|
- condlog(0, "%s: wwid overflow", pp->dev);
|
|
- len = WWID_SIZE;
|
|
- }
|
|
- *origin = "sysfs";
|
|
- pp->uid_attribute = NULL;
|
|
+ if (len > 0)
|
|
+ return len;
|
|
+ condlog(0, "%s: wwid overflow", pp->dev);
|
|
+ len = WWID_SIZE;
|
|
}
|
|
+ *origin = "sysfs";
|
|
+ pp->uid_attribute = NULL;
|
|
}
|
|
return len;
|
|
}
|
|
|
|
+static int has_uid_fallback(struct path *pp)
|
|
+{
|
|
+ return ((pp->bus == SYSFS_BUS_SCSI &&
|
|
+ !strcmp(pp->uid_attribute, DEFAULT_UID_ATTRIBUTE)) ||
|
|
+ pp->bus == SYSFS_BUS_NVME);
|
|
+}
|
|
+
|
|
int
|
|
get_uid (struct path * pp, int path_state, struct udev_device *udev)
|
|
{
|
|
@@ -1846,8 +1846,15 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev)
|
|
len = get_vpd_uid(pp);
|
|
origin = "sysfs";
|
|
}
|
|
- if (len <= 0)
|
|
- len = uid_fallback(pp, path_state, &origin, len);
|
|
+ if (len <= 0 && has_uid_fallback(pp)) {
|
|
+ int retrigger_tries;
|
|
+
|
|
+ conf = get_multipath_config();
|
|
+ retrigger_tries = conf->retrigger_tries;
|
|
+ put_multipath_config(conf);
|
|
+ if (pp->retriggers >= retrigger_tries)
|
|
+ len = uid_fallback(pp, path_state, &origin);
|
|
+ }
|
|
}
|
|
if ( len < 0 ) {
|
|
condlog(1, "%s: failed to get %s uid: %s",
|
|
--
|
|
2.17.2
|
|
|