Skip to content

Commit

Permalink
io_uring: perform IOPOLL reaping if canceler is thread itself
Browse files Browse the repository at this point in the history
[ Upstream commit d052d1d ]

We bypass IOPOLL completion polling (and reaping) for the SQPOLL thread,
but if it's the thread itself invoking cancelations, then we still need
to perform it or no one will.

Fixes: 9936c7c ("io_uring: deduplicate core cancellations sequence")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
axboe authored and gregkh committed Mar 17, 2021
1 parent add3e42 commit 33448e4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/io_uring.c
Expand Up @@ -8891,7 +8891,8 @@ 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) {
if ((!(ctx->flags & IORING_SETUP_SQPOLL) && !files) ||
(ctx->sq_data && ctx->sq_data->thread == current)) {
while (!list_empty_careful(&ctx->iopoll_list)) {
io_iopoll_try_reap_events(ctx);
ret = true;
Expand Down

0 comments on commit 33448e4

Please sign in to comment.