As we now don't free orphaned paths which are in INIT_REMOVED or INIT_PARTIAL state in orphan_paths() directly any more, do it from the checker loop to be sure we don't carry them around forever.
Signed-off-by: Martin Wilck <[email protected]> --- multipathd/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/multipathd/main.c b/multipathd/main.c index 6c29d5e..c03546b 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -3083,12 +3083,30 @@ static void enable_pathgroups(struct multipath *mpp) } } +static void free_orphan_paths(vector pathvec) +{ + struct path *pp; + int i; + + vector_foreach_slot (pathvec, pp, i) { + if (!pp->mpp && (pp->initialized == INIT_REMOVED || + pp->initialized == INIT_PARTIAL)) { + condlog(2, "%s: freeing orphan %s in %s state", + __func__, pp->dev, + pp->initialized == INIT_REMOVED ? "removed" : "partial"); + vector_del_slot(pathvec, i--); + free_path(pp); + } + } +} + static void checker_finished(struct vectors *vecs, unsigned int ticks) { struct multipath *mpp; bool uev_timed_out = false; int i; + free_orphan_paths(vecs->pathvec); vector_foreach_slot(vecs->mpvec, mpp, i) { bool inconsistent, prio_reload, failback_reload; bool uev_wait_reload, ghost_reload; -- 2.52.0
