All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libmultipath: async_checker: fix sync checker case
@ 2026-07-22 21:09 Martin Wilck
  2026-07-22 21:51 ` Benjamin Marzinski
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Wilck @ 2026-07-22 21:09 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: Martin Wilck, dm-devel

In the synchronous case (e.g. if called from multipath), the async_checker
code called the async callback before initializing the rdata struct.
Fix it.

Fixes: 474682e ("libmultipath: add generic async path checker code")
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/async_checker.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libmultipath/async_checker.c b/libmultipath/async_checker.c
index 89b7241..066b009 100644
--- a/libmultipath/async_checker.c
+++ b/libmultipath/async_checker.c
@@ -174,13 +174,6 @@ int async_check_check(struct checker *c, union checker_mpcontext *mpc)
 	if (mpc && !IS_INVALID_MPCONTEXT(*mpc))
 		acc->rdata.mpc = *mpc;
 
-	if (checker_is_sync(c)) {
-		int rc = acc->rdata.afunc(&acc->rdata);
-
-		if (mpc && !IS_INVALID_MPCONTEXT(acc->rdata.mpc))
-			*mpc = acc->rdata.mpc;
-		return rc;
-	}
 	/* Handle the case that the checker just completed */
 	if (acc->rtx)
 		return async_check_pending(c, mpc);
@@ -192,6 +185,15 @@ int async_check_check(struct checker *c, union checker_mpcontext *mpc)
 	acc->rdata.state = PATH_PENDING;
 	acc->rdata.msgid = CHECKER_MSGID_RUNNING;
 	acc->rdata.afunc = c->cls->async_func;
+
+	if (checker_is_sync(c)) {
+		int rc = acc->rdata.afunc(&acc->rdata);
+
+		if (mpc && !IS_INVALID_MPCONTEXT(acc->rdata.mpc))
+			*mpc = acc->rdata.mpc;
+		return rc;
+	}
+
 	condlog(4, "%d:%d : starting checker", major(acc->rdata.devt),
 		minor(acc->rdata.devt));
 	acc->rtx = get_runner(runner_callback, &acc->rdata, rdata_size(acc),
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libmultipath: async_checker: fix sync checker case
  2026-07-22 21:09 [PATCH] libmultipath: async_checker: fix sync checker case Martin Wilck
@ 2026-07-22 21:51 ` Benjamin Marzinski
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Marzinski @ 2026-07-22 21:51 UTC (permalink / raw)
  To: Martin Wilck; +Cc: Christophe Varoqui, Martin Wilck, dm-devel

On Wed, Jul 22, 2026 at 11:09:26PM +0200, Martin Wilck wrote:
> In the synchronous case (e.g. if called from multipath), the async_checker
> code called the async callback before initializing the rdata struct.
> Fix it.
> 
> Fixes: 474682e ("libmultipath: add generic async path checker code")
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-22 21:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 21:09 [PATCH] libmultipath: async_checker: fix sync checker case Martin Wilck
2026-07-22 21:51 ` Benjamin Marzinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.