md/raid1: fix bio handling problems in process_checks()
authorNeilBrown <neilb@suse.de>
Wed, 17 Jul 2013 05:19:29 +0000 (15:19 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2013 08:50:54 +0000 (16:50 +0800)
commit8afb90da9f16abc5e577318544419bfcf3565391
tree1ae562b8f0ea6ca10fe3db9264a004e716d778e9
parent1d83ab8548ff19bad94dcae62ba13ea476974e7f
md/raid1: fix bio handling problems in process_checks()

commit 30bc9b53878a9921b02e3b5bc4283ac1c6de102a upstream.

Recent change to use bio_copy_data() in raid1 when repairing
an array is faulty.

The underlying may have changed the bio in various ways using
bio_advance and these need to be undone not just for the 'sbio' which
is being copied to, but also the 'pbio' (primary) which is being
copied from.

So perform the reset on all bios that were read from and do it early.

This also ensure that the sbio->bi_io_vec[j].bv_len passed to
memcmp is correct.

This fixes a crash during a 'check' of a RAID1 array.  The crash was
introduced in 3.10 so this is suitable for 3.10-stable.

Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/raid1.c