From: mwilck@suse.com Subject: [PATCH 60/74] libmultipath: orphan_paths(): delete paths in INIT_REMOVED state Date: Thu, 9 Jul 2020 12:51:31 +0200 Message-ID: <20200709105145.9211-8-mwilck@suse.com> References: <20200709105145.9211-1-mwilck@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20200709105145.9211-1-mwilck@suse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@redhat.com, Martin Wilck List-Id: dm-devel.ids From: Martin Wilck 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 --- 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