Skip to content

Commit

Permalink
io_uring: check non-sync defer_list carefully
Browse files Browse the repository at this point in the history
io_req_defer() do double-checked locking. Use proper helpers for that,
i.e. list_empty_careful().

Signed-off-by: Pavel Begunkov <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
isilence authored and axboe committed May 1, 2020
1 parent 7759a0b commit 4ee3631
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -5031,7 +5031,7 @@ static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe)
int ret;

/* Still need defer if there is pending req in defer list. */
if (!req_need_defer(req) && list_empty(&ctx->defer_list))
if (!req_need_defer(req) && list_empty_careful(&ctx->defer_list))
return 0;

if (!req->io && io_alloc_async_ctx(req))
Expand Down

0 comments on commit 4ee3631

Please sign in to comment.