From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 5.12] io_uring: harden iopoll reaping in try_cancel
Date: Sun, 14 Mar 2021 23:43:26 +0000 [thread overview]
Message-ID: <cc9ebbe61a9e0d98d32db20a8f86949ebe822426.1615765375.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
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
parent reply other threads:[~2021-03-14 23:48 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <[email protected]>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc9ebbe61a9e0d98d32db20a8f86949ebe822426.1615765375.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox