md/raid0: update queue parameter in a safer location.
authorNeilBrown <neilb@suse.com>
Mon, 3 Aug 2015 03:11:47 +0000 (13:11 +1000)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 17 Nov 2015 15:54:41 +0000 (15:54 +0000)
commit1afa0468d0a71d798b24fc3a81f803aba491d22e
treecdc1a7699718006ab9b4bb2e90fc3f3141828bc3
parentc62cf38b9cfadcf548f07c2d0d9fe4b8aa1c2387
md/raid0: update queue parameter in a safer location.

commit 199dc6ed5179251fa6158a461499c24bdd99c836 upstream.

When a (e.g.) RAID5 array is reshaped to RAID0, the updating
of queue parameters (e.g. max number of sectors per bio) is
done in the wrong place.
It should be part of ->run, but it is actually part of ->takeover.
This means it happens before level_store() calls:

blk_set_stacking_limits(&mddev->queue->limits);

and so it ineffective.  This can lead to errors from underlying
devices.

So move all the relevant settings out of create_stripe_zones()
and into raid0_run().

As this can lead to a bug-on it is suitable for any -stable
kernel which supports reshape to RAID0.  So 2.6.35 or later.
As the bug has been present for five years there is no urgency,
so no need to rush into -stable.

Fixes: 9af204cf720c ("md: Add support for Raid5->Raid0 and Raid10->Raid0 takeover")
Reported-by: Yi Zhang <yizhan@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.com>
[bwh: Backported to 3.2:
 - md has no discard or write-same support
 - md is not used by dm-raid so mddev->queue is never null
 - Open-code rdev_for_each()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/md/raid0.c