io_uring: import_single_range() returns 0/-ERROR
authorJens Axboe <axboe@kernel.dk>
Wed, 26 Feb 2020 00:48:55 +0000 (17:48 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 26 Feb 2020 14:06:57 +0000 (07:06 -0700)
Unlike the other core import helpers, import_single_range() returns 0 on
success, not the length imported. This means that links that depend on
the result of non-vec based IORING_OP_{READ,WRITE} that were added for
5.5 get errored when they should not be.

Fixes: 3a6820f2bb8a ("io_uring: add non-vectored read/write commands")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index f79ca494bb56222e86380552defb60b2f4dc44ab..36917c0101fdca32407d9349d9b504a1fefb45a3 100644 (file)
@@ -2075,7 +2075,7 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
                ssize_t ret;
                ret = import_single_range(rw, buf, sqe_len, *iovec, iter);
                *iovec = NULL;
-               return ret;
+               return ret < 0 ? ret : sqe_len;
        }
 
        if (req->io) {