From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Thu, 10 Jul 2025 14:10:55 -0400 Subject: [PATCH] libmpathpersist: fail the release if all threads fail If none of the threads succeeds in issuing the release, simply return failure, instead of trying the workaround. Signed-off-by: Benjamin Marzinski --- libmpathpersist/mpath_persist_int.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libmpathpersist/mpath_persist_int.c b/libmpathpersist/mpath_persist_int.c index 36743d41..553fa509 100644 --- a/libmpathpersist/mpath_persist_int.c +++ b/libmpathpersist/mpath_persist_int.c @@ -423,6 +423,7 @@ static int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope, struct prin_resp resp = {{{.prgeneration = 0}}}; uint16_t udev_flags = (mpp->skip_kpartx) ? MPATH_UDEV_NO_KPARTX_FLAG : 0; bool did_resume = false; + bool all_threads_failed; if (!mpp) return MPATH_PR_DMMP_ERROR; @@ -484,15 +485,22 @@ static int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope, } } + all_threads_failed = true; for (i = 0; i < count; i++){ /* check thread status here and return the status */ - if (thread[i].param.status == MPATH_PR_RESERV_CONFLICT) + if (thread[i].param.status == MPATH_PR_SUCCESS) + all_threads_failed = false; + else if (thread[i].param.status == MPATH_PR_RESERV_CONFLICT) status = MPATH_PR_RESERV_CONFLICT; - else if (status == MPATH_PR_SUCCESS - && thread[i].param.status != MPATH_PR_RESERV_CONFLICT) + else if (status == MPATH_PR_SUCCESS) status = thread[i].param.status; } + if (all_threads_failed) { + condlog(0, "%s: all threads failed to release reservation.", + mpp->wwid); + return status; + } status = mpath_prin_activepath (mpp, MPATH_PRIN_RRES_SA, &resp, noisy); if (status != MPATH_PR_SUCCESS){