• Ming Lei's avatar
    block: loop: fix filesystem corruption in case of aio/dio · a7297a6a
    Ming Lei authored
    Starting from commit e36f6204(block: split bios to max possible length),
    block core starts to split bio in the middle of bvec.
    
    Unfortunately loop dio/aio doesn't consider this situation, and
    always treat 'iter.iov_offset' as zero. Then filesystem corruption
    is observed.
    
    This patch figures out the offset of the base bvevc via
    'bio->bi_iter.bi_bvec_done' and fixes the issue by passing the offset
    to iov iterator.
    
    Fixes: e36f6204 (block: split bios to max possible length)
    Cc: Keith Busch <keith.busch@intel.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: stable@vger.kernel.org (4.5)
    Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    a7297a6a
loop.c 50.1 KB