loop: handle short DIO reads loop-dio
authorJens Axboe <axboe@kernel.dk>
Fri, 13 Apr 2018 22:25:57 +0000 (16:25 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 13 Apr 2018 22:44:00 +0000 (16:44 -0600)
commitc42b8c4ada164fb12f7633aac9d5774ceba2b2ef
treeeaa0ec07853de234a04d99a4043407e53c7b8940
parent827dbb1f3c246ed488efe1c0e55b22ae01b926d6
loop: handle short DIO reads

We ran into an issue with loop and btrfs, where btrfs would complain about
checksum errors. It turns out that is because we don't handle short reads
at all, we just zero fill the remainder. Worse than that, we don't handle
the filling properly, which results in loop trying to advance a single
bio by much more than its size, since it doesn't take chaining into
account.

Handle short reads appropriately, by simply retrying at the new correct
offset. End the remainder of the request with EIO, if we get a 0 read.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/loop.c