Blame SOURCES/0007-multipathd-ignore-failed-wwid-recheck.patch

b7ef27
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b7ef27
From: Benjamin Marzinski <bmarzins@redhat.com>
b7ef27
Date: Wed, 20 Feb 2019 17:05:08 -0600
b7ef27
Subject: [PATCH] multipathd: ignore failed wwid recheck
b7ef27
b7ef27
If disable_changed_wwids is set, when multipathd gets a change event on
b7ef27
a path, it verifies that the wwid hasn't changed in uev_update_path().
b7ef27
If get_uid() failed, uev_update_path treated this as a wwid change to 0.
b7ef27
This could cause paths to suddenly be dropped due to an issue with
b7ef27
getting the wwid.  Even if get_uid() failed because the path was down,
b7ef27
it no change uevent happend when it later became active, multipathd
b7ef27
would continue to ignore the path. Also, scsi_uid_fallback() clears the
b7ef27
failure return if it doesn't attempt to fallback, causing get_uid()
b7ef27
to return success, when it actually failed.
b7ef27
b7ef27
Multipathd should neither set nor clear wwid_changed if get_uid()
b7ef27
returned failure. Also, scsi_uid_fallback() should retain the old return
b7ef27
value if it doesn't attempt to fallback.
b7ef27
b7ef27
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
b7ef27
---
b7ef27
 libmultipath/discovery.c | 6 +++---
b7ef27
 multipathd/main.c        | 6 ++++--
b7ef27
 2 files changed, 7 insertions(+), 5 deletions(-)
b7ef27
b7ef27
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
b7ef27
index 729bcb9..b08cb2d 100644
b7ef27
--- a/libmultipath/discovery.c
b7ef27
+++ b/libmultipath/discovery.c
b7ef27
@@ -1755,9 +1755,9 @@ get_vpd_uid(struct path * pp)
b7ef27
 }
b7ef27
 
b7ef27
 static ssize_t scsi_uid_fallback(struct path *pp, int path_state,
b7ef27
-			     const char **origin)
b7ef27
+			     const char **origin, ssize_t old_len)
b7ef27
 {
b7ef27
-	ssize_t len = 0;
b7ef27
+	ssize_t len = old_len;
b7ef27
 	int retrigger;
b7ef27
 	struct config *conf;
b7ef27
 
b7ef27
@@ -1828,7 +1828,7 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev)
b7ef27
 			origin = "sysfs";
b7ef27
 		}
b7ef27
 		if (len <= 0 && pp->bus == SYSFS_BUS_SCSI)
b7ef27
-			len = scsi_uid_fallback(pp, path_state, &origin);
b7ef27
+			len = scsi_uid_fallback(pp, path_state, &origin, len);
b7ef27
 	}
b7ef27
 	if ( len < 0 ) {
b7ef27
 		condlog(1, "%s: failed to get %s uid: %s",
b7ef27
diff --git a/multipathd/main.c b/multipathd/main.c
b7ef27
index 678ecf8..fd83a6a 100644
b7ef27
--- a/multipathd/main.c
b7ef27
+++ b/multipathd/main.c
b7ef27
@@ -1234,9 +1234,11 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
b7ef27
 			goto out;
b7ef27
 
b7ef27
 		strcpy(wwid, pp->wwid);
b7ef27
-		get_uid(pp, pp->state, uev->udev);
b7ef27
+		rc = get_uid(pp, pp->state, uev->udev);
b7ef27
 
b7ef27
-		if (strncmp(wwid, pp->wwid, WWID_SIZE) != 0) {
b7ef27
+		if (rc != 0)
b7ef27
+			strcpy(pp->wwid, wwid);
b7ef27
+		else if (strncmp(wwid, pp->wwid, WWID_SIZE) != 0) {
b7ef27
 			condlog(0, "%s: path wwid changed from '%s' to '%s'. %s",
b7ef27
 				uev->kernel, wwid, pp->wwid,
b7ef27
 				(disable_changed_wwids ? "disallowing" :
b7ef27
-- 
b7ef27
2.17.2
b7ef27