diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index ea005700c8ce..8ed2c6552971 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -9856,8 +9856,11 @@ static void io_uring_cancel_generic(bool cancel_all, struct io_sq_data *sqd) atomic_inc(&tctx->in_idle); do { io_uring_drop_tctx_refs(current); + if (!tctx_inflight(tctx, !cancel_all)) + break; + /* read completions before cancelations */ - inflight = tctx_inflight(tctx, !cancel_all); + inflight = tctx_inflight(tctx, false); if (!inflight) break;