Skip to content

Commit bd2ab18

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix FORCE_ASYNC req preparation
As for other not inlined requests, alloc req->io for FORCE_ASYNC reqs, so they can be prepared properly. Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 650b548 commit bd2ab18

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

fs/io_uring.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5608,9 +5608,15 @@ static void io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe)
56085608
io_double_put_req(req);
56095609
}
56105610
} else if (req->flags & REQ_F_FORCE_ASYNC) {
5611-
ret = io_req_defer_prep(req, sqe);
5612-
if (unlikely(ret < 0))
5613-
goto fail_req;
5611+
if (!req->io) {
5612+
ret = -EAGAIN;
5613+
if (io_alloc_async_ctx(req))
5614+
goto fail_req;
5615+
ret = io_req_defer_prep(req, sqe);
5616+
if (unlikely(ret < 0))
5617+
goto fail_req;
5618+
}
5619+
56145620
/*
56155621
* Never try inline submit of IOSQE_ASYNC is set, go straight
56165622
* to async execution.

0 commit comments

Comments
 (0)