Skip to content

Commit ca75872

Browse files
axboegregkh
authored andcommitted
io_uring: iopoll requests should also wake task ->in_idle state
commit c93cc9e16d88e0f5ea95d2d65d58a8a4dab258bc upstream. If we're freeing/finishing iopoll requests, ensure we check if the task is in idling in terms of cancelation. Otherwise we could end up waiting forever in __io_uring_task_cancel() if the task has active iopoll requests that need cancelation. Cc: [email protected] # 5.9+ Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 371f3fb commit ca75872

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/io_uring.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,6 +2167,8 @@ static void io_req_free_batch_finish(struct io_ring_ctx *ctx,
21672167
struct io_uring_task *tctx = rb->task->io_uring;
21682168

21692169
percpu_counter_sub(&tctx->inflight, rb->task_refs);
2170+
if (atomic_read(&tctx->in_idle))
2171+
wake_up(&tctx->wait);
21702172
put_task_struct_many(rb->task, rb->task_refs);
21712173
rb->task = NULL;
21722174
}
@@ -2186,6 +2188,8 @@ static void io_req_free_batch(struct req_batch *rb, struct io_kiocb *req)
21862188
struct io_uring_task *tctx = rb->task->io_uring;
21872189

21882190
percpu_counter_sub(&tctx->inflight, rb->task_refs);
2191+
if (atomic_read(&tctx->in_idle))
2192+
wake_up(&tctx->wait);
21892193
put_task_struct_many(rb->task, rb->task_refs);
21902194
}
21912195
rb->task = req->task;

0 commit comments

Comments
 (0)