lkml.org 
[lkml]   [2021]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.10 22/22] block: don't ignore REQ_NOWAIT for direct IO
    Date
    From: Pavel Begunkov <asml.silence@gmail.com>

    [ Upstream commit f8b78caf21d5bc3fcfc40c18898f9d52ed1451a5 ]

    If IOCB_NOWAIT is set on submission, then that needs to get propagated to
    REQ_NOWAIT on the block side. Otherwise we completely lose this
    information, and any issuer of IOCB_NOWAIT IO will potentially end up
    blocking on eg request allocation on the storage side.

    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/block_dev.c | 4 ++++
    1 file changed, 4 insertions(+)

    diff --git a/fs/block_dev.c b/fs/block_dev.c
    index fe201b757baa..1b6a34fd1fef 100644
    --- a/fs/block_dev.c
    +++ b/fs/block_dev.c
    @@ -280,6 +280,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
    bio.bi_opf = dio_bio_write_op(iocb);
    task_io_account_write(ret);
    }
    + if (iocb->ki_flags & IOCB_NOWAIT)
    + bio.bi_opf |= REQ_NOWAIT;
    if (iocb->ki_flags & IOCB_HIPRI)
    bio_set_polled(&bio, iocb);

    @@ -433,6 +435,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
    bio->bi_opf = dio_bio_write_op(iocb);
    task_io_account_write(bio->bi_iter.bi_size);
    }
    + if (iocb->ki_flags & IOCB_NOWAIT)
    + bio->bi_opf |= REQ_NOWAIT;

    dio->size += bio->bi_iter.bi_size;
    pos += bio->bi_iter.bi_size;
    --
    2.30.2
    \
     
     \ /
      Last update: 2021-04-05 18:06    [W:2.676 / U:0.848 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site