public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 1/4] io_uring: choose right tctx->io_wq for try cancel
Date: Mon,  1 Mar 2021 18:20:45 +0000	[thread overview]
Message-ID: <095c880d18a0338dc5f57435c6f91ca3666d8b90.1614622683.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

When we cancel SQPOLL, @task in io_uring_try_cancel_requests() will
differ from current. Use the right tctx from passed in @task, and don't
forget that it can be NULL when the io_uring ctx exits.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 0c363529a836..34d0fd4a933b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8615,7 +8615,8 @@ static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx,
 					 struct files_struct *files)
 {
 	struct io_task_cancel cancel = { .task = task, .files = files, };
-	struct io_uring_task *tctx = current->io_uring;
+	struct task_struct *tctx_task = task ?: current;
+	struct io_uring_task *tctx = tctx_task->io_uring;
 
 	while (1) {
 		enum io_wq_cancel cret;
-- 
2.24.0


  reply	other threads:[~2021-03-01 18:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 18:20 [PATCH 5.12 0/4] random 5.12 bits Pavel Begunkov
2021-03-01 18:20 ` Pavel Begunkov [this message]
2021-03-01 18:20 ` [PATCH 2/4] io_uring: inline io_req_clean_work() Pavel Begunkov
2021-03-01 18:20 ` [PATCH 3/4] io_uring: inline __io_queue_async_work() Pavel Begunkov
2021-03-01 18:20 ` [PATCH 4/4] io_uring: remove extra in_idle wake up Pavel Begunkov
2021-03-01 23:41 ` [PATCH 5.12 0/4] random 5.12 bits Jens Axboe

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=095c880d18a0338dc5f57435c6f91ca3666d8b90.1614622683.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