From 01ec4fa8657d222b484f89f4ccf65f0bf7903715 Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Mon, 2 Dec 2024 10:10:51 +0100 Subject: [PATCH] multipathd: reload maps in do_sync_mpp() if necessary update_pathvec_from_dm() may set mpp->need_reload if it finds inconsistent settings. In this case, the map should be reloaded, but so far we don't do this reliably. Add a call to reload_map() to do_sync_mpp() to clear this kind of inconsistency. In order to avoid endless reload loops, limit the number of retries to 1. Fixes: https://github.com/opensvc/multipath-tools/issues/105 Signed-off-by: Martin Wilck --- multipathd/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/multipathd/main.c b/multipathd/main.c index e9d9848b..8711d37b 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2459,7 +2459,10 @@ do_sync_mpp(struct vectors * vecs, struct multipath *mpp) { int i, ret; struct path *pp; + const int MAX_RETRIES = 1; + int retry = 0; +try_again: ret = update_multipath_strings(mpp, vecs->pathvec); if (ret != DMP_OK) { condlog(1, "%s: %s", mpp->alias, ret == DMP_NOT_FOUND ? @@ -2468,6 +2471,14 @@ do_sync_mpp(struct vectors * vecs, struct multipath *mpp) vector_foreach_slot (mpp->paths, pp, i) pp->dmstate = PSTATE_UNDEF; return; + } else if (mpp->need_reload) { + if (retry++ < MAX_RETRIES) { + condlog(2, "%s: %s needs reload", __func__, mpp->alias); + reload_map(vecs, mpp, 1); + goto try_again; + } else + condlog(1, "%s: %s still needs reload after %d retries, giving up", + __func__, mpp->alias, retry); } set_no_path_retry(mpp); }