[dm-devel] [PATCH v2 66/74] libmultipath: update_pathvec_from_dm: handle pp->mpp mismatch
mwilck at suse.com
mwilck at suse.com
Wed Aug 12 11:35:10 UTC 2020
From: Martin Wilck <mwilck at suse.com>
Treat this like a WWID mismatch.
Signed-off-by: Martin Wilck <mwilck at suse.com>
---
libmultipath/structs_vec.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index bd2d13b..e7a8d53 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -123,6 +123,23 @@ bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp,
goto delete_pg;
vector_foreach_slot(pgp->paths, pp, j) {
+
+ if (pp->mpp && pp->mpp != mpp) {
+ condlog(0, "BUG: %s: found path %s which is already in %s",
+ mpp->alias, pp->dev, pp->mpp->alias);
+
+ /*
+ * Either we added this path to the other mpp
+ * explicitly, or we came by here earlier and
+ * decided it belonged there. In both cases,
+ * the path should remain in the other map,
+ * and be deleted here.
+ */
+ must_reload = true;
+ dm_fail_path(mpp->alias, pp->dev_t);
+ vector_del_slot(pgp->paths, j--);
+ continue;
+ }
pp->mpp = mpp;
/*
@@ -170,6 +187,22 @@ bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp,
vector_del_slot(pgp->paths, j--);
free_path(pp);
must_reload = true;
+ } else if (mpp_has_wwid && pp->wwid[0] != '\0'
+ && strcmp(mpp->wwid, pp->wwid)) {
+ condlog(0, "%s: path %s WWID %s doesn't match, removing from map",
+ mpp->wwid, pp->dev_t, pp->wwid);
+ /*
+ * This path exists, but in the wrong map.
+ * We can't reload the map from here.
+ * Make sure it isn't used in this map
+ * any more, and let the checker re-add
+ * it as it sees fit.
+ */
+ dm_fail_path(mpp->alias, pp->dev_t);
+ vector_del_slot(pgp->paths, j--);
+ orphan_path(pp, "WWID mismatch");
+ pp->tick = 1;
+ must_reload = true;
} else {
if (mpp_has_wwid && !strlen(pp->wwid)) {
condlog(3, "%s: setting wwid from map: %s",
--
2.28.0
More information about the dm-devel
mailing list