Skip to contentSkip to conversation

io_uring: harden iopoll reaping in try_cancel

PATCH New Pavel Begunkov 1 participant 1 message Mar 14, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 io_uring: harden iopoll reaping in try_cancel

Don'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.

---
 fs/io_uring.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/io_uring.c +1 -2
index ccd7f09fd449..9fb4bc5f063b 100644
@@ -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