42 lines
1.5 KiB
Diff
42 lines
1.5 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
Date: Tue, 20 Dec 2022 17:41:15 -0600
|
||
|
Subject: [PATCH] libmultipath: orphan paths if coalesce_paths frees newmp
|
||
|
|
||
|
If coalesce_paths() is called without a mpvec, it will free all the
|
||
|
multipath devices on newmp at the end. This will clear pp->mpp from the
|
||
|
path, but it doesn't completely unitialize them. cli_add_map() can call
|
||
|
coalsce_paths() this way, when adding a device that doesn't currently
|
||
|
exist. cli_add_map() first creates the device in the kernel, and then
|
||
|
calls ev_add_map() to add it to multipathd. If something goes wrong in
|
||
|
ev_add_map(), the paths will still be initialized, even though they're
|
||
|
orphans.
|
||
|
|
||
|
Fix this by calling remove_map() to orphan the paths that belong to
|
||
|
the multipath devices being deleted by coalesce_paths().
|
||
|
|
||
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
||
|
---
|
||
|
libmultipath/configure.c | 7 +++++--
|
||
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
|
||
|
index e551047a..e689f8a7 100644
|
||
|
--- a/libmultipath/configure.c
|
||
|
+++ b/libmultipath/configure.c
|
||
|
@@ -1273,8 +1273,11 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
|
||
|
ret = CP_OK;
|
||
|
out:
|
||
|
free(size_mismatch_seen);
|
||
|
- if (!mpvec)
|
||
|
- free_multipathvec(newmp, KEEP_PATHS);
|
||
|
+ if (!mpvec) {
|
||
|
+ vector_foreach_slot (newmp, mpp, i)
|
||
|
+ remove_map(mpp, vecs->pathvec, NULL);
|
||
|
+ vector_free(newmp);
|
||
|
+ }
|
||
|
return ret;
|
||
|
}
|
||
|
|