All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <martin.wilck@suse.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>,
	Benjamin Marzinski <bmarzins@redhat.com>
Cc: Martin Wilck <mwilck@suse.com>, dm-devel@lists.linux.dev
Subject: [PATCH] libmultipath: async_checker: fix sync checker case
Date: Wed, 22 Jul 2026 23:09:26 +0200	[thread overview]
Message-ID: <20260722210926.507674-1-mwilck@suse.com> (raw)

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


             reply	other threads:[~2026-07-22 21:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 21:09 Martin Wilck [this message]
2026-07-22 21:51 ` [PATCH] libmultipath: async_checker: fix sync checker case Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260722210926.507674-1-mwilck@suse.com \
    --to=martin.wilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=mwilck@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.