If the multipath configuration is changed to blacklist existing devices,
and multipathd is reloaded but the blacklisted multipaths device can't
be removed, multipathd was marking the paths as INIT_PARTIAL, causing
them to stay in the multipath device, at least until the
partial_retrigger_delay timeout elapsed. Instead, mark them as
INIT_REMOVED and set mpp->need_reload, so the device is reloaded and the
paths are removed. To make sure the blacklisted paths are deleted when
the multipath device is removed in coalesce_maps(), set their pp->mpp
to point to map before removing it.

Fixes d9c61332 ("multipathd: trigger uevents for blacklisted paths in 
reconfigure")

Signed-off-by: Benjamin Marzinski <bmarz...@redhat.com>
---
 libmultipath/structs_vec.c | 15 +++++++++++----
 multipathd/main.c          | 12 ++++++++++++
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 663c9053..9232b54b 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -205,10 +205,17 @@ static void update_pathvec_from_dm(vector pathvec, struct 
multipath *mpp,
                                                must_reload = true;
                                                continue;
                                        }
-                                       condlog(2, "%s: adding new path %s",
-                                               mpp->alias, pp->dev);
-                                       pp->initialized = INIT_PARTIAL;
-                                       pp->partial_retrigger_delay = 180;
+                                       if (rc == PATHINFO_SKIPPED) {
+                                               condlog(1, "%s: blacklisted 
path in %s",
+                                                       pp->dev, mpp->alias);
+                                               set_path_removed(pp);
+                                               must_reload = true;
+                                       } else {
+                                               condlog(2, "%s: adding new path 
%s",
+                                                       mpp->alias, pp->dev);
+                                               pp->initialized = INIT_PARTIAL;
+                                               pp->partial_retrigger_delay = 
180;
+                                       }
                                        store_path(pathvec, pp);
                                        pp->tick = 1;
                                }
diff --git a/multipathd/main.c b/multipathd/main.c
index 99d603f9..bdd97178 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -804,6 +804,18 @@ coalesce_maps(struct vectors *vecs, vector nmpv)
        vector_foreach_slot (ompv, ompp, i) {
                condlog(3, "%s: coalesce map", ompp->alias);
                if (!find_mp_by_wwid(nmpv, ompp->wwid)) {
+                       struct pathgroup *pgp;
+                       struct path *pp;
+                       int j, k;
+
+                       /*
+                        * set pp->mpp for all the old map's paths,
+                        * so that they can be properly removed
+                        */
+                       vector_foreach_slot (ompp->pg, pgp, j)
+                               vector_foreach_slot(pgp->paths, pp, k)
+                                       if (!pp->mpp)
+                                               pp->mpp = ompp;
                        /*
                         * remove all current maps not allowed by the
                         * current configuration
-- 
2.48.1


Reply via email to