io_uring: harden iopoll reaping in try_cancel
PATCH 1/1 io_uring: harden iopoll reaping in try_cancel
In reply to a message not in the archiveDon't decide whether to do io_iopoll_try_reap_events() in io_uring_try_cancel_requests() based on @files, because files cancellation is not about files anymore but rather requests accounted with io_req_track_inflight(), e.g. as for requests taking a file reference to a io_uring file. Even though there is no problem now as iopoll will fail early enough for io_uring file and io-wq behaves well, it's safer to always do reaping.
Signed-off-by Pavel Begunkov <[email protected]>
--- fs/io_uring.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/io_uring.c +1 -2
@@ -8712,8 +8712,7 @@ static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx, }/* SQPOLL thread does its own polling */ -if ((!(ctx->flags &IORING_SETUP_SQPOLL ) && !files) || - (ctx->sq_data && ctx->sq_data->thread == current)) { +if (!ctx->sq_data || ctx->sq_data->thread == current) {while (!list_empty_careful (&ctx->iopoll_list)) {io_iopoll_try_reap_events (ctx); ret = true;
Signature · 1 line
2.24.0