mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
io_uring: don't prepare DRAIN reqs twice
If req->io is not NULL, it's already prepared. Don't do it again, it's dangerous. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
583863ed91
commit
650b548129
@ -5014,12 +5014,13 @@ static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
if (!req_need_defer(req) && list_empty_careful(&ctx->defer_list))
|
||||
return 0;
|
||||
|
||||
if (!req->io && io_alloc_async_ctx(req))
|
||||
return -EAGAIN;
|
||||
|
||||
ret = io_req_defer_prep(req, sqe);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!req->io) {
|
||||
if (io_alloc_async_ctx(req))
|
||||
return -EAGAIN;
|
||||
ret = io_req_defer_prep(req, sqe);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
spin_lock_irq(&ctx->completion_lock);
|
||||
if (!req_need_defer(req) && list_empty(&ctx->defer_list)) {
|
||||
|
Loading…
Reference in New Issue
Block a user