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