lkml.org 
[lkml]   [2021]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.10 278/306] fs/io_uring Dont use the return value from import_iovec().
    Date
    From: David Laight <David.Laight@ACULAB.COM>

    [ Upstream commit 10fc72e43352753a08f9cf83aa5c40baec00d212 ]

    This is the only code that relies on import_iovec() returning
    iter.count on success.
    This allows a better interface to import_iovec().

    Signed-off-by: David Laight <david.laight@aculab.com>
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Reviewed-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 | 8 ++++----
    1 file changed, 4 insertions(+), 4 deletions(-)

    diff --git a/fs/io_uring.c b/fs/io_uring.c
    index 6978a42fa39b..8de0f52fd29d 100644
    --- a/fs/io_uring.c
    +++ b/fs/io_uring.c
    @@ -3128,7 +3128,7 @@ static ssize_t __io_import_iovec(int rw, struct io_kiocb *req,

    ret = import_single_range(rw, buf, sqe_len, *iovec, iter);
    *iovec = NULL;
    - return ret < 0 ? ret : sqe_len;
    + return ret;
    }

    if (req->flags & REQ_F_BUFFER_SELECT) {
    @@ -3154,7 +3154,7 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
    if (!iorw)
    return __io_import_iovec(rw, req, iovec, iter, needs_lock);
    *iovec = NULL;
    - return iov_iter_count(&iorw->iter);
    + return 0;
    }

    static inline loff_t *io_kiocb_ppos(struct kiocb *kiocb)
    @@ -3423,7 +3423,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
    if (ret < 0)
    return ret;
    iov_count = iov_iter_count(iter);
    - io_size = ret;
    + io_size = iov_count;
    req->result = io_size;
    ret = 0;

    @@ -3552,7 +3552,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
    if (ret < 0)
    return ret;
    iov_count = iov_iter_count(iter);
    - io_size = ret;
    + io_size = iov_count;
    req->result = io_size;

    /* Ensure we clear previously set non-block flag */
    --
    2.30.2


    \
     
     \ /
      Last update: 2021-09-16 18:30    [W:4.173 / U:0.236 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site