Blame SOURCES/0013-multipathd-handle-changed-wwids-by-removal-and-addit.patch

a1c519
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a1c519
From: Benjamin Marzinski <bmarzins@redhat.com>
a1c519
Date: Wed, 27 Mar 2019 23:27:47 -0500
a1c519
Subject: [PATCH] multipathd: handle changed wwids by removal and addition
a1c519
a1c519
If a path's WWID changes, it's not necessarily failed. But it certainly
a1c519
has to be removed from an existing map, otherwise data corruption is
a1c519
imminent. Instead of keeping the path in the map, failing it, and
a1c519
remembering the "changed WWID" state, this patch simply removes and
a1c519
re-adds the path.
a1c519
a1c519
This is patch is heavily based on the previous patch of the same name
a1c519
by Martin Wilck.
a1c519
a1c519
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
a1c519
---
a1c519
 multipathd/main.c | 28 ++++++----------------------
a1c519
 1 file changed, 6 insertions(+), 22 deletions(-)
a1c519
a1c519
diff --git a/multipathd/main.c b/multipathd/main.c
a1c519
index 7a317d9..b3571d9 100644
a1c519
--- a/multipathd/main.c
a1c519
+++ b/multipathd/main.c
a1c519
@@ -1191,7 +1191,6 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
a1c519
 	int ro, retval = 0, rc;
a1c519
 	struct path * pp;
a1c519
 	struct config *conf;
a1c519
-	int disable_changed_wwids;
a1c519
 	int needs_reinit = 0;
a1c519
 
a1c519
 	switch ((rc = change_foreign(uev->udev))) {
a1c519
@@ -1209,12 +1208,6 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
a1c519
 		break;
a1c519
 	}
a1c519
 
a1c519
-	conf = get_multipath_config();
a1c519
-	disable_changed_wwids = conf->disable_changed_wwids;
a1c519
-	put_multipath_config(conf);
a1c519
-
a1c519
-	ro = uevent_get_disk_ro(uev);
a1c519
-
a1c519
 	pthread_cleanup_push(cleanup_lock, &vecs->lock);
a1c519
 	lock(&vecs->lock);
a1c519
 	pthread_testcancel();
a1c519
@@ -1239,22 +1232,12 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
a1c519
 		if (rc != 0)
a1c519
 			strcpy(pp->wwid, wwid);
a1c519
 		else if (strncmp(wwid, pp->wwid, WWID_SIZE) != 0) {
a1c519
-			condlog(0, "%s: path wwid changed from '%s' to '%s'. %s",
a1c519
-				uev->kernel, wwid, pp->wwid,
a1c519
-				(disable_changed_wwids ? "disallowing" :
a1c519
-				 "continuing"));
a1c519
-			strcpy(pp->wwid, wwid);
a1c519
-			if (disable_changed_wwids) {
a1c519
-				if (!pp->wwid_changed) {
a1c519
-					pp->wwid_changed = 1;
a1c519
-					pp->tick = 1;
a1c519
-					if (pp->mpp)
a1c519
-						dm_fail_path(pp->mpp->alias, pp->dev_t);
a1c519
-				}
a1c519
-				goto out;
a1c519
-			}
a1c519
+			condlog(0, "%s: path wwid changed from '%s' to '%s'",
a1c519
+				uev->kernel, wwid, pp->wwid);
a1c519
+			ev_remove_path(pp, vecs, 1);
a1c519
+			needs_reinit = 1;
a1c519
+			goto out;
a1c519
 		} else {
a1c519
-			pp->wwid_changed = 0;
a1c519
 			udev_device_unref(pp->udev);
a1c519
 			pp->udev = udev_device_ref(uev->udev);
a1c519
 			conf = get_multipath_config();
a1c519
@@ -1265,6 +1248,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
a1c519
 			pthread_cleanup_pop(1);
a1c519
 		}
a1c519
 
a1c519
+		ro = uevent_get_disk_ro(uev);
a1c519
 		if (mpp && ro >= 0) {
a1c519
 			condlog(2, "%s: update path write_protect to '%d' (uevent)", uev->kernel, ro);
a1c519
 
a1c519
-- 
a1c519
2.17.2
a1c519