libmultipath: async_checker: fix sync checker case
PATCH 1/1 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 <[email protected]>
--- libmultipath/async_checker.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
libmultipath/async_checker.c +9 -7
@@ -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),
Signature · 1 line
2.55.0
Quoted 6 lines · Martin Wilck
In the synchronous case (e.g. if called from multipath), the
async_checkercode 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 <[email protected]>
Reviewed-by Benjamin Marzinski <[email protected]>