public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 5.12] io_uring: harden iopoll reaping in try_cancel
       [not found] <[email protected]>
@ 2021-03-14 23:43 ` Pavel Begunkov
  0 siblings, 0 replies; only message in thread
From: Pavel Begunkov @ 2021-03-14 23:43 UTC (permalink / raw)
  To: Jens Axboe, io-uring

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 <[email protected]>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-14 23:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <[email protected]>
2021-03-14 23:43 ` [PATCH 5.12] io_uring: harden iopoll reaping in try_cancel Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox