io_uring: internally retry short reads
authorJens Axboe <axboe@kernel.dk>
Tue, 18 Aug 2020 04:03:27 +0000 (21:03 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 24 Aug 2020 23:05:27 +0000 (17:05 -0600)
commit4cbd2103412af7deac6684c3d9b4d4bb29869166
tree829ae424a15668bddbf5cc9dea760f529ab5298f
parentb3d9fbdba838dc61448dc5121723bda552cae3c1
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