summaryrefslogtreecommitdiffstats
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-03-01 19:20:45 +0100
committerJens Axboe <axboe@kernel.dk>2021-03-04 14:38:03 +0100
commit64c7212391e778949aa3055fb3863439417ddba9 (patch)
treee072494598de799f3e67d8bb9c15644781e60b2f /fs/io_uring.c
parentio_uring: fix -EAGAIN retry with IOPOLL (diff)
downloadlinux-64c7212391e778949aa3055fb3863439417ddba9.tar.xz
linux-64c7212391e778949aa3055fb3863439417ddba9.zip
io_uring: choose right tctx->io_wq for try cancel
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 <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r--fs/io_uring.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 361befaae28f..d6c5465b372b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8636,7 +8636,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;