Patch "block: loop: fix filesystem corruption in case of aio/dio" has been added to the 4.5-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
block: loop: fix filesystem corruption in case of aio/dio
to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
block-loop-fix-filesystem-corruption-in-case-of-aio-dio.patch
and it can be found in the queue-4.5 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
a7297a6a3a3322b054592e8e988981d2f5f29cc4Mon Sep 17 00:00:00 2001
From: Ming Lei <[email protected]>
Date: Fri, 15 Apr 2016 18:51:28 +0800
Subject: block: loop: fix filesystem corruption in case of aio/dio
From: Ming Lei <[email protected]>
commit a7297a6a3a3322b054592e8e988981d2f5f29cc4 upstream.
Starting from commit e36f620428(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.
--- drivers/block/loop.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/block/loop.c +6 -0
@@ -488,6 +488,12 @@ static int lo_rw_aio(struct loop_device bvec =__bvec_iter_bvec (bio->bi_io_vec, bio->bi_iter);iov_iter_bvec (&iter,ITER_BVEC | rw, bvec,bio_segments (bio),blk_rq_bytes (cmd->rq)); +/* +* This bio may be started from the middle of the 'bvec' +* because of bio splitting, so offset from the bvec must +* be passed to iov iterator +*/ + iter.iov_offset = bio->bi_iter.bi_bvec_done; cmd->iocb.ki_pos = pos; cmd->iocb.ki_filp = file;
Patches currently in stable-queue which might be from [email protected] are
queue-4.5/block-partition-initialize-percpuref-before-sending-out-kobj_add.patch queue-4.5/block-loop-fix-filesystem-corruption-in-case-of-aio-dio.patch