btrfs: cloned bios must not be iterated by bio_for_each_segment_all
authorDavid Sterba <dsterba@suse.com>
Thu, 13 Jul 2017 16:10:07 +0000 (18:10 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 14 Jul 2017 18:39:31 +0000 (20:39 +0200)
commitc09abff87f90c81d74b6483837a665f97448a475
tree72371fad2cc4dce6180e8399d94ff053a879c607
parent1014f3d68fc4034966b15234dc12b81147ee83b2
btrfs: cloned bios must not be iterated by bio_for_each_segment_all

We've started using cloned bios more in 4.13, there are some specifics
regarding the iteration.  Filipe found [1] that the raid56 iterated a
cloned bio using bio_for_each_segment_all, which is incorrect. The
cloned bios have wrong bi_vcnt and this could lead to silent
corruptions.  This patch adds assertions to all remaining
bio_for_each_segment_all cases.

[1] https://patchwork.kernel.org/patch/9838535/

Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c
fs/btrfs/disk-io.c
fs/btrfs/extent_io.c
fs/btrfs/inode.c