[PATCH v2 15/20] multipathd: handle changed wwid when adding partial path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If multipathd noticed that the WWID didn't match the device when adding
a partial path, but removing it failed, multipathd wasn't disabling the
path. Instead of calling handle_path_wwid_change(), which doesn't make
much sense when multipathd is expecting a uevent, just manually disable
the path if ev_remove_path() fails.

Since the path hasn't actually been removed, multipathd needs to make
sure that it says failed when the path state is resynced with the
kernel. Set the state to PATH_UNCHECKED in orphan_path(), and
additionally skip all path in INIT_REMOVED in sync_map_state().

Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>
---
 libmultipath/structs.c     | 1 +
 libmultipath/structs_vec.c | 3 ++-
 multipathd/cli_handlers.c  | 6 +++++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 1583e001..0a26096a 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -146,6 +146,7 @@ uninitialize_path(struct path *pp)
 		return;
 
 	pp->dmstate = PSTATE_UNDEF;
+	pp->state = PATH_UNCHECKED;
 	pp->uid_attribute = NULL;
 	pp->checker_timeout = 0;
 
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 60360c76..345d3069 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -723,7 +723,8 @@ sync_map_state(struct multipath *mpp)
 
 	vector_foreach_slot (mpp->pg, pgp, i){
 		vector_foreach_slot (pgp->paths, pp, j){
-			if (pp->state == PATH_UNCHECKED ||
+			if (pp->initialized == INIT_REMOVED ||
+			    pp->state == PATH_UNCHECKED ||
 			    pp->state == PATH_WILD ||
 			    pp->state == PATH_DELAYED)
 				continue;
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 772a45d0..3a935aa0 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -540,7 +540,11 @@ add_partial_path(struct path *pp, struct vectors *vecs)
 	if (strlen(wwid) && strncmp(wwid, pp->wwid, WWID_SIZE) != 0) {
 		condlog(0, "%s: path wwid changed from '%s' to '%s'. removing",
 			pp->dev, wwid, pp->wwid);
-		ev_remove_path(pp, vecs, 1);
+		if (!(ev_remove_path(pp, vecs, 1) & REMOVE_PATH_SUCCESS) &&
+		    pp->mpp) {
+			pp->dmstate = PSTATE_FAILED;
+			dm_fail_path(pp->mpp->alias, pp->dev_t);
+		}
 		udev_device_unref(udd);
 		return -1;
 	}
-- 
2.45.0





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux