]> git.baikalelectronics.ru Git - kernel.git/commit
block: loop: fix filesystem corruption in case of aio/dio
authorMing Lei <ming.lei@canonical.com>
Fri, 15 Apr 2016 10:51:28 +0000 (18:51 +0800)
committerJens Axboe <axboe@fb.com>
Fri, 15 Apr 2016 14:25:56 +0000 (08:25 -0600)
commitc9dfdf83948cc11c97528b5ca3c8dd7dd221f188
tree04064ecd0b492d492617443ebf7c73baa66ec951
parentc4404ca047ec0c30809dab293ebc722a8e948a5a
block: loop: fix filesystem corruption in case of aio/dio

Starting from commit b26fb5ba35(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: b26fb5ba353c211 (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: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/loop.c