[PATCH 5.12] io_uring: harden iopoll reaping in try_cancel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
 fs/io_uring.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index ccd7f09fd449..9fb4bc5f063b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -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;
-- 
2.24.0




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux