We free paths in INIT_REMOVED or INIT_PARTIAL states in check_removed_paths
if they have an associated multipath map but are not part of any PG.
We might as well also free such paths if they aren't member of any map
in the first place. This can happen now, because we don't free such paths
in remove_map -> orphan_paths() any more.

Signed-off-by: Martin Wilck <[email protected]>
---
 libmultipath/structs_vec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 3344005..58c785e 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -569,10 +569,10 @@ void check_removed_paths(vector pathvec)
        int i;
 
        vector_foreach_slot(pathvec, pp, i) {
-               if (pp->mpp &&
-                   (pp->initialized == INIT_REMOVED ||
+               if ((pp->initialized == INIT_REMOVED ||
                     pp->initialized == INIT_PARTIAL) &&
-                   !find_devt_in_pathgroups(pp->mpp, pp->dev_t)) {
+                   (!pp->mpp ||
+                    !find_devt_in_pathgroups(pp->mpp, pp->dev_t))) {
                        condlog(2, "%s: %s: freeing path in %s state",
                                __func__, pp->dev,
                                pp->initialized == INIT_REMOVED ?
-- 
2.52.0


Reply via email to