• Jens Axboe's avatar
    loop: handle short DIO reads · f9de14bc
    Jens Axboe authored
    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.
    
    Fixes: bc07c10a ("block: loop: support DIO & AIO")
    Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    f9de14bc
loop.c 52.6 KB