mdadm/0057-super1-fix-sb-max_dev-when-adding-a-new-disk-in-line.patch
Neil Brown 850cf2857b Accepting request 517978 from home:colyli:branches:Base:System
- SLE15 continues to use mdadm-4.0, synchronize mdadm package from
  SLE12-SP3 to SLE15, re-order all patches.
- Rename the following patches, they are deleted and re-add in next
  part of patches
    0001-Generic-support-for-consistency-policy-and-PPL.patch
    0002-Detail-show-consistency-policy.patch
    0002-The-mdcheck-script-now-adds-messages-to-the-system.patch
    0003-imsm-PPL-support.patch
    0004-super1-PPL-support.patch
    0005-Add-ppl-and-no-ppl-options-for-update.patch
    0006-Grow-support-consistency-policy-change.patch
    0007-udev-md-raid-assembly.rules-Skip-non-ready-devices.patch
    0008-Retry-HOT_REMOVE_DISK-a-few-times.patch
    0009-Introduce-sys_hot_remove_disk.patch
    0010-Add-force-flag-to-hot_remove_disk.patch
    0011-Detail-handle-non-existent-arrays-better.patch
- Synchronize patches from mdadm of SLE12-SP3, the above renamed
  patches are re-add here,
    0001-Makefile-Fix-date-to-be-output-in-ISO-format.patch
    0002-imsm-fix-missing-error-message-during-migration.patch
    0003-Fix-oddity-where-mdadm-did-not-recognise-a-relative-.patch
    0004-mdadm-check-the-nodes-when-operate-clustered-array.patch
    0005-examine-tidy-up-some-code.patch
    0006-mdadm-add-man-page-for-symlinks.patch
    0007-mdadm-add-checking-clustered-bitmap-in-assemble-mode.patch
    0008-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch
    0009-mdadm-Specify-enough-length-when-write-to-buffer.patch
    0010-mdadm-it-doesn-t-make-sense-to-set-bitmap-twice.patch
    0011-mdadm-Monitor-Fix-NULL-pointer-dereference-when-stat.patch
    0012-Replace-snprintf-with-strncpy-at-some-places-to-avoi.patch

OBS-URL: https://build.opensuse.org/request/show/517978
OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=150
2017-08-22 22:29:34 +00:00

59 lines
1.9 KiB
Diff

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