OSDN Git Service

io_uring: internally retry short reads
authorJens Axboe <axboe@kernel.dk>
Thu, 13 Aug 2020 17:51:40 +0000 (11:51 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 13 Aug 2020 23:00:31 +0000 (16:00 -0700)
commit227c0c9673d86732995474d277f84e08ee763e46
tree9992d6439bed79798c41ae49fc8566dfe58c43a5
parentff6165b2d7f66fccb7095a60ccc7a80813858665
io_uring: internally retry short reads

We've had a few application cases of not handling short reads properly,
and it is understandable as short reads aren't really expected if the
application isn't doing non-blocking IO.

Now that we retain the iov_iter over retries, we can implement internal
retry pretty trivially. This ensures that we don't return a short read,
even for buffered reads on page cache conflicts.

Cleanup the deep nesting and hard to read nature of io_read() as well,
it's much more straight forward now to read and understand. Added a
few comments explaining the logic as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c