1 |
From 02b898f2f04e418094f0093a3ad0b415bcdbe8eb Mon Sep 17 00:00:00 2001 |
2 |
From: NeilBrown <neilb@suse.de> |
3 |
Date: Wed, 31 Oct 2012 11:42:03 +1100 |
4 |
Subject: md/raid1: Fix assembling of arrays containing Replacements. |
5 |
|
6 |
From: NeilBrown <neilb@suse.de> |
7 |
|
8 |
commit 02b898f2f04e418094f0093a3ad0b415bcdbe8eb upstream. |
9 |
|
10 |
setup_conf in raid1.c uses conf->raid_disks before assigning |
11 |
a value. It is used when including 'Replacement' devices. |
12 |
|
13 |
The consequence is that assembling an array which contains a |
14 |
replacement will misbehave and either not include the replacement, or |
15 |
not include the device being replaced. |
16 |
|
17 |
Though this doesn't lead directly to data corruption, it could lead to |
18 |
reduced data safety. |
19 |
|
20 |
So use mddev->raid_disks, which is initialised, instead. |
21 |
|
22 |
Bug was introduced by commit c19d57980b38a5bb613a898937a1cf85f422fb9b |
23 |
md/raid1: recognise replacements when assembling arrays. |
24 |
|
25 |
in 3.3, so fix is suitable for 3.3.y thru 3.6.y. |
26 |
|
27 |
Signed-off-by: NeilBrown <neilb@suse.de> |
28 |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
29 |
|
30 |
--- |
31 |
drivers/md/raid1.c | 2 +- |
32 |
1 file changed, 1 insertion(+), 1 deletion(-) |
33 |
|
34 |
--- a/drivers/md/raid1.c |
35 |
+++ b/drivers/md/raid1.c |
36 |
@@ -2699,7 +2699,7 @@ static struct r1conf *setup_conf(struct |
37 |
|| disk_idx < 0) |
38 |
continue; |
39 |
if (test_bit(Replacement, &rdev->flags)) |
40 |
- disk = conf->mirrors + conf->raid_disks + disk_idx; |
41 |
+ disk = conf->mirrors + mddev->raid_disks + disk_idx; |
42 |
else |
43 |
disk = conf->mirrors + disk_idx; |
44 |
|