Skip to content

Commit e490fab

Browse files
committed
libmultipath: async_checker: fix sync checker case
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>
1 parent e201c34 commit e490fab

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

libmultipath/async_checker.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,6 @@ int async_check_check(struct checker *c, union checker_mpcontext *mpc)
174174
if (mpc && !IS_INVALID_MPCONTEXT(*mpc))
175175
acc->rdata.mpc = *mpc;
176176

177-
if (checker_is_sync(c)) {
178-
int rc = acc->rdata.afunc(&acc->rdata);
179-
180-
if (mpc && !IS_INVALID_MPCONTEXT(acc->rdata.mpc))
181-
*mpc = acc->rdata.mpc;
182-
return rc;
183-
}
184177
/* Handle the case that the checker just completed */
185178
if (acc->rtx)
186179
return async_check_pending(c, mpc);
@@ -192,6 +185,15 @@ int async_check_check(struct checker *c, union checker_mpcontext *mpc)
192185
acc->rdata.state = PATH_PENDING;
193186
acc->rdata.msgid = CHECKER_MSGID_RUNNING;
194187
acc->rdata.afunc = c->cls->async_func;
188+
189+
if (checker_is_sync(c)) {
190+
int rc = acc->rdata.afunc(&acc->rdata);
191+
192+
if (mpc && !IS_INVALID_MPCONTEXT(acc->rdata.mpc))
193+
*mpc = acc->rdata.mpc;
194+
return rc;
195+
}
196+
195197
condlog(4, "%d:%d : starting checker", major(acc->rdata.devt),
196198
minor(acc->rdata.devt));
197199
acc->rtx = get_runner(runner_callback, &acc->rdata, rdata_size(acc),

0 commit comments

Comments
 (0)