From: Martin Wilck <mwi...@suse.com>

A path in INIT_REMOVED state is only waiting for its last association
with a multipath map to be dropped. When orphan_paths() encounters
such a path, rather than orphaning it, free it.

Signed-off-by: Martin Wilck <mwi...@suse.com>
---
 libmultipath/structs_vec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index faa1a2a..7c68592 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -119,7 +119,13 @@ void orphan_paths(vector pathvec, struct multipath *mpp, 
const char *reason)
 
        vector_foreach_slot (pathvec, pp, i) {
                if (pp->mpp == mpp) {
-                       orphan_path(pp, reason);
+                       if (pp->initialized == INIT_REMOVED) {
+                               condlog(3, "%s: freeing path in removed state",
+                                       pp->dev);
+                               vector_del_slot(pathvec, i--);
+                               free_path(pp);
+                       } else
+                               orphan_path(pp, reason);
                }
        }
 }
-- 
2.26.2


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to