lkml.org 
[lkml]   [2020]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.6 068/194] io_uring: check non-sync defer_list carefully
    Date
    From: Pavel Begunkov <asml.silence@gmail.com>

    [ Upstream commit 4ee3631451c9a62e6b6bc7ee51fb9a5b34e33509 ]

    io_req_defer() do double-checked locking. Use proper helpers for that,
    i.e. list_empty_careful().

    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    fs/io_uring.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/fs/io_uring.c b/fs/io_uring.c
    index 01f71b9efb88f..832e042531bc4 100644
    --- a/fs/io_uring.c
    +++ b/fs/io_uring.c
    @@ -4258,7 +4258,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))
    --
    2.20.1


    \
     
     \ /
      Last update: 2020-05-18 20:03    [W:4.234 / U:0.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site