Skip to content

Commit

Permalink
io_uring: always go for cancellation spin on exec
Browse files Browse the repository at this point in the history
Always try to do cancellation in __io_uring_task_cancel() at least once,
so it actually goes and cleans its sqpoll tasks (i.e. via
io_sqpoll_cancel_sync()), otherwise sqpoll task may submit new requests
after cancellation and it's racy for many reasons.

Fixes: 521d6a7 ("io_uring: cancel sqpoll via task_work")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/0a21bd6d794bb1629bc906dd57a57b2c2985a8ac.1616839147.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
isilence authored and axboe committed Mar 29, 2021
1 parent 2b8ed1c commit 5a978dc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -9002,6 +9002,8 @@ void __io_uring_task_cancel(void)

/* make sure overflow events are dropped */
atomic_inc(&tctx->in_idle);
__io_uring_files_cancel(NULL);

do {
/* read completions before cancelations */
inflight = tctx_inflight(tctx);
Expand Down

0 comments on commit 5a978dc

Please sign in to comment.