device-mapper-multipath/0013-multipathd-handle-changed-wwids-by-removal-and-addit.patch
Benjamin Marzinski 35f5570500 device-mapper-multipath-0.8.0-1
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
2019-04-05 00:20:53 -05:00

84 lines
2.6 KiB
Diff

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