From patchwork Wed Dec 5 22:31:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3.5.y.z, extended, stable] Patch "md/raid1: Fix assembling of arrays containing Replacements." has been added to staging queue Date: Wed, 05 Dec 2012 12:31:12 -0000 From: Herton Ronaldo Krzesinski X-Patchwork-Id: 204011 Message-Id: <1354746672-22046-1-git-send-email-herton.krzesinski@canonical.com> To: NeilBrown Cc: kernel-team@lists.ubuntu.com This is a note to let you know that I have just added a patch titled md/raid1: Fix assembling of arrays containing Replacements. to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree which can be found at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.5.y.z tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Herton ------ >From a590509a21053d307457e1e3966caf2eef309c73 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 31 Oct 2012 11:42:03 +1100 Subject: [PATCH] md/raid1: Fix assembling of arrays containing Replacements. X-Extended-Stable: 3.5 commit 02b898f2f04e418094f0093a3ad0b415bcdbe8eb upstream. setup_conf in raid1.c uses conf->raid_disks before assigning a value. It is used when including 'Replacement' devices. The consequence is that assembling an array which contains a replacement will misbehave and either not include the replacement, or not include the device being replaced. Though this doesn't lead directly to data corruption, it could lead to reduced data safety. So use mddev->raid_disks, which is initialised, instead. Bug was introduced by commit c19d57980b38a5bb613a898937a1cf85f422fb9b md/raid1: recognise replacements when assembling arrays. in 3.3, so fix is suitable for 3.3.y thru 3.6.y. Signed-off-by: NeilBrown Signed-off-by: Herton Ronaldo Krzesinski --- drivers/md/raid1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 53aec45..cb781a1 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2563,7 +2563,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) || disk_idx < 0) continue; if (test_bit(Replacement, &rdev->flags)) - disk = conf->mirrors + conf->raid_disks + disk_idx; + disk = conf->mirrors + mddev->raid_disks + disk_idx; else disk = conf->mirrors + disk_idx;