During configure(), when the old multipath devices are added in
map_discovery(), it's possible that they have paths in the INIT_PARTIAL
or INIT_REMOVED state. These paths were not found during
path_discovery(). Don't add them to the new multipath maps.
coalesce_maps() will make sure that they point to the old maps, so they
will get cleaned up when those maps are removed.

Signed-off-by: Benjamin Marzinski <[email protected]>
---
 libmultipath/configure.c   | 12 +++++++++++-
 libmultipath/structs_vec.c |  3 ++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 0bcec089..a713ddc4 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1113,7 +1113,17 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, 
char *refwwid,
                        continue;
                }
 
-               /* 4. path is out of scope */
+               /*
+                * 4. The path wasn't found in path_discovery. It only exists
+                *    in an old map.
+                */
+               if (pp1->initialized == INIT_PARTIAL ||
+                   pp1->initialized == INIT_REMOVED) {
+                       orphan_path(pp1, "path not found");
+                       continue;
+               }
+
+               /* 5. path is out of scope */
                if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE - 1))
                        continue;
 
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 9384de01..3e63e9c3 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -315,7 +315,8 @@ int adopt_paths(vector pathvec, struct multipath *mpp,
                                        pp->dev, mpp->alias);
                                continue;
                        }
-                       if (pp->initialized == INIT_REMOVED)
+                       if (pp->initialized == INIT_REMOVED ||
+                           pp->initialized == INIT_PARTIAL)
                                continue;
                        if (mpp->queue_mode == QUEUE_MODE_RQ &&
                            pp->bus == SYSFS_BUS_NVME &&
-- 
2.50.1


Reply via email to