Skip to content

Commit 773af69

Browse files
committed
io_uring: always reissue from task_work context
As a safeguard, if we're going to queue async work, do it from task_work from the original task. This ensures that we can always sanely create threads, regards of what the reissue context may be. Signed-off-by: Jens Axboe <[email protected]>
1 parent 110aa25 commit 773af69

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

fs/io_uring.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -2060,6 +2060,12 @@ static void io_req_task_queue(struct io_kiocb *req)
20602060
io_req_task_work_add(req);
20612061
}
20622062

2063+
static void io_req_task_queue_reissue(struct io_kiocb *req)
2064+
{
2065+
req->io_task_work.func = io_queue_async_work;
2066+
io_req_task_work_add(req);
2067+
}
2068+
20632069
static inline void io_queue_next(struct io_kiocb *req)
20642070
{
20652071
struct io_kiocb *nxt = io_req_find_next(req);
@@ -2248,7 +2254,7 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events,
22482254
!(req->flags & REQ_F_DONT_REISSUE)) {
22492255
req->iopoll_completed = 0;
22502256
req_ref_get(req);
2251-
io_queue_async_work(req);
2257+
io_req_task_queue_reissue(req);
22522258
continue;
22532259
}
22542260

@@ -2771,7 +2777,7 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret,
27712777
req->flags &= ~REQ_F_REISSUE;
27722778
if (io_resubmit_prep(req)) {
27732779
req_ref_get(req);
2774-
io_queue_async_work(req);
2780+
io_req_task_queue_reissue(req);
27752781
} else {
27762782
int cflags = 0;
27772783

0 commit comments

Comments
 (0)