The various "tick" functions will only be called after CHECKER_FINISHED is reached. So we might as well move them into the respective code block into checker_finished(). This way don't have to drop and re-take he lock when all paths have been checked. Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> --- multipathd/main.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 0823484..b045f8b 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2990,6 +2990,11 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) if (inconsistent) mpp->sync_tick = 1; } + deferred_failback_tick(vecs); + retry_count_tick(vecs->mpvec); + missing_uev_wait_tick(vecs); + ghost_delay_tick(vecs); + partial_retrigger_tick(vecs->pathvec); } static void * @@ -3064,16 +3069,6 @@ checkerloop (void *ap) lock_cleanup_pop(vecs->lock); } - pthread_cleanup_push(cleanup_lock, &vecs->lock); - lock(&vecs->lock); - pthread_testcancel(); - deferred_failback_tick(vecs); - retry_count_tick(vecs->mpvec); - missing_uev_wait_tick(vecs); - ghost_delay_tick(vecs); - partial_retrigger_tick(vecs->pathvec); - lock_cleanup_pop(vecs->lock); - if (count) count--; else { -- 2.47.0