|
|
b7f731 |
From 68fee4af1703dc0bc0d1c9c99fd750e8dca3a131 Mon Sep 17 00:00:00 2001
|
|
|
b7f731 |
From: Lidong Zhong <lzhong@suse.com>
|
|
|
b7f731 |
Date: Thu, 25 May 2017 17:28:11 +0800
|
|
|
b7f731 |
Subject: [RHEL7.5 PATCH 148/169] super1: fix sb->max_dev when adding a new
|
|
|
b7f731 |
disk in linear array
|
|
|
b7f731 |
|
|
|
b7f731 |
The value of sb->max_dev will always be increased by 1 when adding
|
|
|
b7f731 |
a new disk in linear array. It causes an inconsistence between each
|
|
|
b7f731 |
disk in the array and the "Array State" value of "mdadm --examine DISK"
|
|
|
b7f731 |
is wrong. For example, when adding the first new disk into linear array
|
|
|
b7f731 |
it will be:
|
|
|
b7f731 |
|
|
|
b7f731 |
Array State : RAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
b7f731 |
('A' == active, '.' == missing, 'R' == replacing)
|
|
|
b7f731 |
|
|
|
b7f731 |
Adding the second disk into linear array it will be
|
|
|
b7f731 |
|
|
|
b7f731 |
Array State : .AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
b7f731 |
('A' == active, '.' == missing, 'R' == replacing)
|
|
|
b7f731 |
|
|
|
b7f731 |
Signed-off-by: Lidong Zhong <lzhong@suse.com>
|
|
|
b7f731 |
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
|
b7f731 |
---
|
|
|
b7f731 |
super1.c | 7 ++++++-
|
|
|
b7f731 |
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
b7f731 |
|
|
|
b7f731 |
diff --git a/super1.c b/super1.c
|
|
|
b7f731 |
index 2fcb814..86ec850 100644
|
|
|
b7f731 |
--- a/super1.c
|
|
|
b7f731 |
+++ b/super1.c
|
|
|
b7f731 |
@@ -1267,8 +1267,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
|
b7f731 |
break;
|
|
|
b7f731 |
sb->dev_number = __cpu_to_le32(i);
|
|
|
b7f731 |
info->disk.number = i;
|
|
|
b7f731 |
- if (max >= __le32_to_cpu(sb->max_dev))
|
|
|
b7f731 |
+ if (i >= max) {
|
|
|
b7f731 |
sb->max_dev = __cpu_to_le32(max+1);
|
|
|
b7f731 |
+ }
|
|
|
b7f731 |
|
|
|
b7f731 |
random_uuid(sb->device_uuid);
|
|
|
b7f731 |
|
|
|
b7f731 |
@@ -1293,7 +1294,11 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
|
b7f731 |
}
|
|
|
b7f731 |
}
|
|
|
b7f731 |
} else if (strcmp(update, "linear-grow-update") == 0) {
|
|
|
b7f731 |
+ int max = __le32_to_cpu(sb->max_dev);
|
|
|
b7f731 |
sb->raid_disks = __cpu_to_le32(info->array.raid_disks);
|
|
|
b7f731 |
+ if (info->array.raid_disks > max) {
|
|
|
b7f731 |
+ sb->max_dev = __cpu_to_le32(max+1);
|
|
|
b7f731 |
+ }
|
|
|
b7f731 |
sb->dev_roles[info->disk.number] =
|
|
|
b7f731 |
__cpu_to_le16(info->disk.raid_disk);
|
|
|
b7f731 |
} else if (strcmp(update, "resync") == 0) {
|
|
|
b7f731 |
--
|
|
|
b7f731 |
2.7.4
|
|
|
b7f731 |
|