From 0a9f1b376a3d20725eb2b5c27f665ed8608efea8e64455872045c461789ba03a Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 5 Jan 2021 21:14:09 +0000 Subject: [PATCH] Accepting request 860474 from home:colyli:branches:Base:System - Incremental: Remove redundant spare movement logic (jsc#SLE-13700, bsc#1180220) 0112-Incremental-Remove-redundant-spare-movement-logic.patch - Dump: get stat from a wrong metadata file when restoring metadata (jsc#SLE-13700) 0113-Dump-get-stat-from-a-wrong-metadata-file-when-restor.patch OBS-URL: https://build.opensuse.org/request/show/860474 OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=193 --- ...ect-raid-level-when-the-array-is-ina.patch | 11 +- ...e-bitmap-for-raid5-with-journal-disk.patch | 4 + ...nitor-refresh-mdstat-fd-after-select.patch | 4 + ...nitor-stop-notifing-about-containers.patch | 4 + 0099-mdmonitor-set-small-delay-once.patch | 4 + ...Monitor-instance-running-before-fork.patch | 4 + ...w-RAID0-layout-setting-to-be-removed.patch | 4 + ...x-segfault-during-IMSM-raid-creation.patch | 4 + ...ate.c-close-mdfd-and-generate-uevent.patch | 4 + ...m_data_stripes-according-to-dev_size.patch | 7 +- ...move-redundant-calls-to-imsm_get_map.patch | 4 + ...e-default-modes-when-creating-a-file.patch | 4 + ...imit-support-to-first-NVMe-namespace.patch | 4 + 0108-mdadm-Unify-forks-behaviour.patch | 4 + ...ow-correct-state-for-clustered-array.patch | 6 +- ...Make-target-to-install-binaries-only.patch | 4 + ...dev-start-grow-service-automatically.patch | 4 + ...emove-redundant-spare-movement-logic.patch | 115 ++++++++++++++++++ ...om-a-wrong-metadata-file-when-restor.patch | 52 ++++++++ mdadm.changes | 10 ++ mdadm.spec | 6 +- 21 files changed, 254 insertions(+), 9 deletions(-) create mode 100644 0112-Incremental-Remove-redundant-spare-movement-logic.patch create mode 100644 0113-Dump-get-stat-from-a-wrong-metadata-file-when-restor.patch diff --git a/0095-Detail-show-correct-raid-level-when-the-array-is-ina.patch b/0095-Detail-show-correct-raid-level-when-the-array-is-ina.patch index 3820023..120b7f2 100644 --- a/0095-Detail-show-correct-raid-level-when-the-array-is-ina.patch +++ b/0095-Detail-show-correct-raid-level-when-the-array-is-ina.patch @@ -3,6 +3,8 @@ From: Lidong Zhong Date: Mon, 14 Sep 2020 10:52:18 +0800 Subject: [PATCH 01/17] Detail: show correct raid level when the array is inactive +Git-commit: 64bf4dff34301a4b44883a8bc03f7835faef121e +References: jsc#SLE-13700 Sometimes the raid level in the output of `mdadm -D /dev/mdX` is misleading when the array is in inactive state. Here is a testcase for @@ -16,8 +18,7 @@ node1:~ # mdadm --create /dev/md0 --homehost TESTARRAY -o -l 1 -n 2 /dev/sdb 3\ show the detail of raid1 device node1:~ # mdadm -D /dev/md127 -/dev/md127: - Version : 1.2 +/dev/md127: Version : 1.2 Raid Level : raid0 Total Devices : 1 Persistence : Superblock is persistent @@ -39,10 +40,12 @@ mapping_t pers[] = { ... So the misleading "raid0" is shown in this testcase. -Changelog: -v1: don't show "Raid Level" when array is inactive +Changelog: +V1: don't show "Raid Level" when array is inactive Signed-off-by: Lidong Zhong Signed-off-by: Jes Sorensen +Signed-off-by: Coly Li + --- Detail.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/0096-Don-t-create-bitmap-for-raid5-with-journal-disk.patch b/0096-Don-t-create-bitmap-for-raid5-with-journal-disk.patch index 54103a2..e72e97e 100644 --- a/0096-Don-t-create-bitmap-for-raid5-with-journal-disk.patch +++ b/0096-Don-t-create-bitmap-for-raid5-with-journal-disk.patch @@ -2,12 +2,16 @@ From 2ce091724031e18f522994ffd1e5eb0dc404bcba Mon Sep 17 00:00:00 2001 From: Xiao Ni Date: Tue, 15 Sep 2020 15:44:42 +0800 Subject: [PATCH 02/17] Don't create bitmap for raid5 with journal disk +Git-commit: 2ce091724031e18f522994ffd1e5eb0dc404bcba +References: jsc#SLE-13700 Journal disk and bitmap can't exist at the same time. It needs to check if the raid has a journal disk when creating bitmap. Signed-off-by: Xiao Ni Signed-off-by: Jes Sorensen +Signed-off-by: Coly Li + --- Create.c | 1 + 1 file changed, 1 insertion(+) diff --git a/0097-Monitor-refresh-mdstat-fd-after-select.patch b/0097-Monitor-refresh-mdstat-fd-after-select.patch index e6d0df5..d7f93c2 100644 --- a/0097-Monitor-refresh-mdstat-fd-after-select.patch +++ b/0097-Monitor-refresh-mdstat-fd-after-select.patch @@ -2,6 +2,8 @@ From e2308733910a157b0a4d4e78721f239d44b91a24 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Wed, 9 Sep 2020 10:31:17 +0200 Subject: [PATCH 03/17] Monitor: refresh mdstat fd after select +Git-commit: e2308733910a157b0a4d4e78721f239d44b91a24 +References: jsc#SLE-13700 After 52209d6ee118 ("Monitor: release /proc/mdstat fd when no arrays present") mdstat fd is closed if mdstat is empty or cannot be opened. @@ -13,6 +15,8 @@ Refresh mdstat after wake up, don't poll on wrong resource. Signed-off-by: Mariusz Tkaczyk Signed-off-by: Jes Sorensen +Signed-off-by: Coly Li + --- Monitor.c | 6 +++--- mdstat.c | 4 ++-- diff --git a/0098-Monitor-stop-notifing-about-containers.patch b/0098-Monitor-stop-notifing-about-containers.patch index 3c72ac4..f8cb767 100644 --- a/0098-Monitor-stop-notifing-about-containers.patch +++ b/0098-Monitor-stop-notifing-about-containers.patch @@ -2,6 +2,8 @@ From 007087d0898a045901e4e120296e6d9b845b20a6 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Wed, 9 Sep 2020 10:31:18 +0200 Subject: [PATCH 04/17] Monitor: stop notifing about containers. +Git-commit: 007087d0898a045901e4e120296e6d9b845b20a6 +References: jsc#SLE-13700 Stop reporting any events from container but still track them, it is important for spare migration. @@ -10,6 +12,8 @@ There is nothing to follow. Signed-off-by: Mariusz Tkaczyk Signed-off-by: Jes Sorensen +Signed-off-by: Coly Li + --- Monitor.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/0099-mdmonitor-set-small-delay-once.patch b/0099-mdmonitor-set-small-delay-once.patch index 345fc5f..895c384 100644 --- a/0099-mdmonitor-set-small-delay-once.patch +++ b/0099-mdmonitor-set-small-delay-once.patch @@ -2,6 +2,8 @@ From cab9c67d461c65a1138359f9f6d39636466b90e4 Mon Sep 17 00:00:00 2001 From: Blazej Kucman Date: Wed, 9 Sep 2020 10:31:19 +0200 Subject: [PATCH 05/17] mdmonitor: set small delay once +Git-commit: cab9c67d461c65a1138359f9f6d39636466b90e4 +References: jsc#SLE-13700 If mdmonitor is awakened by event, set small delay once to deal with udev and mdadm. @@ -9,6 +11,8 @@ to deal with udev and mdadm. Signed-off-by: Blazej Kucman Signed-off-by: Mariusz Tkaczyk Signed-off-by: Jes Sorensen +Signed-off-by: Coly Li + --- Monitor.c | 14 +++++++++++++- mdadm.h | 2 +- diff --git a/0100-Check-if-other-Monitor-instance-running-before-fork.patch b/0100-Check-if-other-Monitor-instance-running-before-fork.patch index dc9b03a..0759ae2 100644 --- a/0100-Check-if-other-Monitor-instance-running-before-fork.patch +++ b/0100-Check-if-other-Monitor-instance-running-before-fork.patch @@ -2,12 +2,16 @@ From 7f3b2d1d1621cbdc60b5af4a41445391010fe9e1 Mon Sep 17 00:00:00 2001 From: Blazej Kucman Date: Wed, 9 Sep 2020 10:31:20 +0200 Subject: [PATCH 06/17] Check if other Monitor instance running before fork. +Git-commit: 7f3b2d1d1621cbdc60b5af4a41445391010fe9e1 +References: jsc#SLE-13700 Make error message visible to the user. Signed-off-by: Blazej Kucman Signed-off-by: Mariusz Tkaczyk Signed-off-by: Jes Sorensen +Signed-off-by: Coly Li + --- Monitor.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/0101-Super1-allow-RAID0-layout-setting-to-be-removed.patch b/0101-Super1-allow-RAID0-layout-setting-to-be-removed.patch index 1a3c3a5..c2134bd 100644 --- a/0101-Super1-allow-RAID0-layout-setting-to-be-removed.patch +++ b/0101-Super1-allow-RAID0-layout-setting-to-be-removed.patch @@ -2,6 +2,8 @@ From 97b51a2c2d00b79a59f2a8e37134031b0c9e0223 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 14 Oct 2020 13:12:48 +1100 Subject: [PATCH 07/17] Super1: allow RAID0 layout setting to be removed. +Git-commit: 97b51a2c2d00b79a59f2a8e37134031b0c9e0223 +References: jsc#SLE-13700 Once the RAID0 layout has been set, the RAID0 array cannot be assembled on an older kernel which doesn't understand layouts. @@ -16,6 +18,8 @@ an older kernel. Signed-off-by: NeilBrown Signed-off-by: Jes Sorensen +Signed-off-by: Coly Li + --- md.4 | 13 +++++++++++++ mdadm.8.in | 15 +++++++++++++-- diff --git a/0102-Detail-fix-segfault-during-IMSM-raid-creation.patch b/0102-Detail-fix-segfault-during-IMSM-raid-creation.patch index d7db830..3b7651e 100644 --- a/0102-Detail-fix-segfault-during-IMSM-raid-creation.patch +++ b/0102-Detail-fix-segfault-during-IMSM-raid-creation.patch @@ -2,6 +2,8 @@ From c3129b39a7d467eec063681529f46f84a2a85308 Mon Sep 17 00:00:00 2001 From: Lidong Zhong Date: Sun, 22 Nov 2020 23:12:29 +0800 Subject: [PATCH 08/17] Detail: fix segfault during IMSM raid creation +Git-commit: c3129b39a7d467eec063681529f46f84a2a85308 +References: jsc#SLE-13700 It can be reproduced with non IMSM hardware and IMSM_NO_PLATFORM environmental variable set. The array state is inactive when creating @@ -11,6 +13,8 @@ always fails since no intel HBA information could be obtained. Signed-off-by: Lidong Zhong Reported-by: Tkaczyk Mariusz Fixes: 64bf4dff3430 (Detail: show correct raid level when the array is inactive) +Signed-off-by: Coly Li + --- Detail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0103-Create.c-close-mdfd-and-generate-uevent.patch b/0103-Create.c-close-mdfd-and-generate-uevent.patch index 142469f..b2fb9ea 100644 --- a/0103-Create.c-close-mdfd-and-generate-uevent.patch +++ b/0103-Create.c-close-mdfd-and-generate-uevent.patch @@ -2,6 +2,8 @@ From ce559078a5650afb9f635204b31a89a1fa0061e3 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Tue, 24 Nov 2020 13:39:49 +0100 Subject: [PATCH 09/17] Create.c: close mdfd and generate uevent +Git-commit: ce559078a5650afb9f635204b31a89a1fa0061e3 +References: jsc#SLE-13700 During mdfd closing change event is not generated because open() is called before start watching mddevice by udev. @@ -9,6 +11,8 @@ Device is ready at this stage. Unblock device, close fd and generate event to give a chance next layers to work. Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Coly Li + --- Create.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/0104-imsm-update-num_data_stripes-according-to-dev_size.patch b/0104-imsm-update-num_data_stripes-according-to-dev_size.patch index c2832ef..ff129c9 100644 --- a/0104-imsm-update-num_data_stripes-according-to-dev_size.patch +++ b/0104-imsm-update-num_data_stripes-according-to-dev_size.patch @@ -2,9 +2,8 @@ From 895ffd992954069e4ea67efb8a85bb0fd72c3707 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Tue, 24 Nov 2020 14:15:15 +0100 Subject: [PATCH 10/17] imsm: update num_data_stripes according to dev_size -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit +Git-commit: 895ffd992954069e4ea67efb8a85bb0fd72c3707 +References: jsc#SLE-13700 If array was created in UEFI there is possibility that member size is not rounded to 1MB. After any size reconfiguration @@ -19,6 +18,8 @@ num_data_stripes value can be safety updated to smaller value if array doesn't occuppy whole reserved component space. Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Coly Li + --- super-intel.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/0105-imsm-remove-redundant-calls-to-imsm_get_map.patch b/0105-imsm-remove-redundant-calls-to-imsm_get_map.patch index 8f8bdc3..aa12762 100644 --- a/0105-imsm-remove-redundant-calls-to-imsm_get_map.patch +++ b/0105-imsm-remove-redundant-calls-to-imsm_get_map.patch @@ -2,10 +2,14 @@ From b65c1f4a2340e24ae00babc4399fb4030ff99517 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Tue, 24 Nov 2020 15:58:53 +0100 Subject: [PATCH 11/17] imsm: remove redundant calls to imsm_get_map +Git-commit: b65c1f4a2340e24ae00babc4399fb4030ff99517 +References: jsc#SLE-13700 MAP_0 is gotten and the beginning, there is no need to get it again. Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Coly Li + --- super-intel.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/0106-Monitor-don-t-use-default-modes-when-creating-a-file.patch b/0106-Monitor-don-t-use-default-modes-when-creating-a-file.patch index 686e91e..32b15c0 100644 --- a/0106-Monitor-don-t-use-default-modes-when-creating-a-file.patch +++ b/0106-Monitor-don-t-use-default-modes-when-creating-a-file.patch @@ -2,11 +2,15 @@ From ca4b156b2059ee00a9143313267ee4a098967d76 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Tue, 24 Nov 2020 16:41:01 +0100 Subject: [PATCH 12/17] Monitor: don't use default modes when creating a file +Git-commit: ca4b156b2059ee00a9143313267ee4a098967d76 +References: jsc#SLE-13700 Replace fopen() calls by open() with creation mode directly specified. This fixes the potential security issue. Use octal values instead masks. Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Coly Li + --- Monitor.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/0107-imsm-limit-support-to-first-NVMe-namespace.patch b/0107-imsm-limit-support-to-first-NVMe-namespace.patch index 837eac0..8a26f63 100644 --- a/0107-imsm-limit-support-to-first-NVMe-namespace.patch +++ b/0107-imsm-limit-support-to-first-NVMe-namespace.patch @@ -2,10 +2,14 @@ From a8f3cfd54e45c8aabc4a99cdc92b6b9080b26607 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Wed, 4 Nov 2020 10:01:28 +0100 Subject: [PATCH 13/17] imsm: limit support to first NVMe namespace +Git-commit: a8f3cfd54e45c8aabc4a99cdc92b6b9080b26607 +References: jsc#SLE-13700 Due to metadata limitations NVMe multinamespace support has to be removed. Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Coly Li + --- platform-intel.c | 31 +++++++++++++++++++++++++++++++ platform-intel.h | 1 + diff --git a/0108-mdadm-Unify-forks-behaviour.patch b/0108-mdadm-Unify-forks-behaviour.patch index 6768a12..84c26e0 100644 --- a/0108-mdadm-Unify-forks-behaviour.patch +++ b/0108-mdadm-Unify-forks-behaviour.patch @@ -2,6 +2,8 @@ From ff6bb131a46e1bac84a26e5b2c4bf408c0e56926 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Wed, 4 Nov 2020 10:02:36 +0100 Subject: [PATCH 14/17] mdadm: Unify forks behaviour +Git-commit: ff6bb131a46e1bac84a26e5b2c4bf408c0e56926 +References: jsc#SLE-13700 If mdadm is run by udev or systemd, it gets a pipe as each stream. Forks in the background may run after an event or service has been @@ -14,6 +16,8 @@ scanning /proc/self/fd directory. Add generic method for managing systemd services. Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Coly Li + --- Grow.c | 52 +++------------------ Incremental.c | 1 + diff --git a/0109-mdadm-Detail-show-correct-state-for-clustered-array.patch b/0109-mdadm-Detail-show-correct-state-for-clustered-array.patch index b3d13f1..8779050 100644 --- a/0109-mdadm-Detail-show-correct-state-for-clustered-array.patch +++ b/0109-mdadm-Detail-show-correct-state-for-clustered-array.patch @@ -2,16 +2,20 @@ From 9c030dadba89b90a4e52b6afe0290076c809684c Mon Sep 17 00:00:00 2001 From: Zhao Heming Date: Sat, 24 Oct 2020 17:43:12 +0800 Subject: [PATCH 15/17] mdadm/Detail: show correct state for clustered array +Git-commit: 9c030dadba89b90a4e52b6afe0290076c809684c +References: jsc#SLE-13700 After kernel md module commit 480523feae581, in clustered env, mddev->in_sync always zero, it will make array.state never set up MD_SB_CLEAN. it causes "mdadm -D /dev/mdX" show state 'active' all the time. -bitmap.c: add a new API IsBitmapDirty() to support inquiry bitmap +Bitmap.c: add a new API IsBitmapDirty() to support inquiry bitmap dirty or clean. Signed-off-by: Zhao Heming +Signed-off-by: Coly Li + --- Detail.c | 20 ++++++++++++++- bitmap.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++------- diff --git a/0110-Make-target-to-install-binaries-only.patch b/0110-Make-target-to-install-binaries-only.patch index 60a0234..c56af50 100644 --- a/0110-Make-target-to-install-binaries-only.patch +++ b/0110-Make-target-to-install-binaries-only.patch @@ -2,12 +2,16 @@ From b4a5ad4958cb3ad87c3c5fa993e7572c38596d09 Mon Sep 17 00:00:00 2001 From: Kinga Tanska Date: Thu, 22 Oct 2020 14:22:29 +0200 Subject: [PATCH 16/17] Make target to install binaries only +Git-commit: b4a5ad4958cb3ad87c3c5fa993e7572c38596d09 +References: jsc#SLE-13700 Make install causes installation of binaries, udev and man. This commit contains new target make install-bin, which results in installation of binaries only. Signed-off-by: Kinga Tanska +Signed-off-by: Coly Li + --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/0111-udev-start-grow-service-automatically.patch b/0111-udev-start-grow-service-automatically.patch index 205af9a..d4760bb 100644 --- a/0111-udev-start-grow-service-automatically.patch +++ b/0111-udev-start-grow-service-automatically.patch @@ -2,6 +2,8 @@ From a64f1263a56bd8653267c1a9800daa0bc993a743 Mon Sep 17 00:00:00 2001 From: Tkaczyk Mariusz Date: Thu, 15 Oct 2020 10:45:29 +0200 Subject: [PATCH 17/17] udev: start grow service automatically +Git-commit: a64f1263a56bd8653267c1a9800daa0bc993a743 +References: jsc#SLE-13700 Grow continue via service or fork is started during raid assembly. If raid was assembled in initrd it will be newer restarted after @@ -9,6 +11,8 @@ switch root. Add udev support for starting mdadm-grow-continue service. Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Coly Li + --- udev-md-raid-arrays.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/0112-Incremental-Remove-redundant-spare-movement-logic.patch b/0112-Incremental-Remove-redundant-spare-movement-logic.patch new file mode 100644 index 0000000..ab342b2 --- /dev/null +++ b/0112-Incremental-Remove-redundant-spare-movement-logic.patch @@ -0,0 +1,115 @@ +From 69068584f9ed68b8b2736287a1c9863e11b741d5 Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +Date: Fri, 11 Dec 2020 12:28:38 +0100 +Subject: [PATCH 1/2] Incremental: Remove redundant spare movement logic +Git-commit: 69068584f9ed68b8b2736287a1c9863e11b741d5 +References: jsc#SLE-13700, bsc#1180220 + +If policy is set then mdmonitor is responsible for moving spares. +This logic is reduntant and potentialy dangerus, spare could be moved at +initrd stage depending on drives appearance order. + +Remove it. + +Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Jes Sorensen +Signed-off-by: Coly Li + +--- + Incremental.c | 62 --------------------------------------------------- + 1 file changed, 62 deletions(-) + +diff --git a/Incremental.c b/Incremental.c +index ad9ec1c..e849bdd 100644 +--- a/Incremental.c ++++ b/Incremental.c +@@ -1460,12 +1460,6 @@ static int Incremental_container(struct supertype *st, char *devname, + int trustworthy; + struct mddev_ident *match; + int rv = 0; +- struct domainlist *domains; +- struct map_ent *smp; +- int suuid[4]; +- int sfd; +- int ra_blocked = 0; +- int ra_all = 0; + int result = 0; + + st->ss->getinfo_super(st, &info, NULL); +@@ -1509,12 +1503,10 @@ static int Incremental_container(struct supertype *st, char *devname, + struct map_ent *mp; + struct mddev_ident *match = NULL; + +- ra_all++; + /* do not activate arrays blocked by metadata handler */ + if (ra->array.state & (1 << MD_SB_BLOCK_VOLUME)) { + pr_err("Cannot activate array %s in %s.\n", + ra->text_version, devname); +- ra_blocked++; + continue; + } + mp = map_by_uuid(&map, ra->uuid); +@@ -1617,60 +1609,6 @@ static int Incremental_container(struct supertype *st, char *devname, + } + printf("\n"); + } +- +- /* don't move spares to container with volume being activated +- when all volumes are blocked */ +- if (ra_all == ra_blocked) +- return 0; +- +- /* Now move all suitable spares from spare container */ +- domains = domain_from_array(list, st->ss->name); +- memcpy(suuid, uuid_zero, sizeof(int[4])); +- if (domains && +- (smp = map_by_uuid(&map, suuid)) != NULL && +- (sfd = open(smp->path, O_RDONLY)) >= 0) { +- /* spare container found */ +- struct supertype *sst = +- super_imsm.match_metadata_desc("imsm"); +- struct mdinfo *sinfo; +- +- if (!sst->ss->load_container(sst, sfd, NULL)) { +- struct spare_criteria sc = {0, 0}; +- +- if (st->ss->get_spare_criteria) +- st->ss->get_spare_criteria(st, &sc); +- +- close(sfd); +- sinfo = container_choose_spares(sst, &sc, +- domains, NULL, +- st->ss->name, 0); +- sst->ss->free_super(sst); +- if (sinfo){ +- int count = 0; +- struct mdinfo *disks = sinfo->devs; +- while (disks) { +- /* move spare from spare +- * container to currently +- * assembled one +- */ +- if (move_spare( +- smp->path, +- devname, +- makedev(disks->disk.major, +- disks->disk.minor))) +- count++; +- disks = disks->next; +- } +- if (count) +- pr_err("Added %d spare%s to %s\n", +- count, count>1?"s":"", devname); +- } +- sysfs_free(sinfo); +- } else +- close(sfd); +- } +- domain_free(domains); +- map_free(map); + return 0; + } + +-- +2.26.2 + diff --git a/0113-Dump-get-stat-from-a-wrong-metadata-file-when-restor.patch b/0113-Dump-get-stat-from-a-wrong-metadata-file-when-restor.patch new file mode 100644 index 0000000..e3a0c7d --- /dev/null +++ b/0113-Dump-get-stat-from-a-wrong-metadata-file-when-restor.patch @@ -0,0 +1,52 @@ +From 75562b57d43bd252399b55d0004b8eac4b337a67 Mon Sep 17 00:00:00 2001 +From: Lidong Zhong +Date: Mon, 14 Dec 2020 22:51:33 +0800 +Subject: [PATCH 2/2] Dump: get stat from a wrong metadata file when restoring + metadata +Git-commit: 75562b57d43bd252399b55d0004b8eac4b337a67 +References: jsc#SLE-13700 + +The dumped metadata files are shown as below +localhost:~ # ll -ih test/ +total 16K +34565564 -rw-r--r-- 2 root root 1.0G Dec 14 21:15 +scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-3 +34565563 -rw-r--r-- 2 root root 1.0G Dec 14 21:15 +scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4 +34565563 -rw-r--r-- 2 root root 1.0G Dec 14 21:15 sda +34565564 -rw-r--r-- 2 root root 1.0G Dec 14 21:15 sdb + +It reports such error when trying to restore metadata for /dev/sda +localhost:~ # mdadm --restore=test /dev/sda +Mdadm: test/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4 is not the same +size as /dev/sda - cannot restore. +It's because the stb value has been changed to other metadata file in +the while statement. + +Signed-off-by: Lidong Zhong +Signed-off-by: Jes Sorensen +Signed-off-by: Coly Li + +--- + Dump.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Dump.c b/Dump.c +index 38e8f23..736bcb6 100644 +--- a/Dump.c ++++ b/Dump.c +@@ -272,6 +272,11 @@ int Restore_metadata(char *dev, char *dir, struct context *c, + fname); + goto err; + } ++ if (stat(fname, &stb) != 0) { ++ pr_err("Could not stat %s for --restore.\n", ++ fname); ++ goto err; ++ } + if (((unsigned long long)stb.st_size) != size) { + pr_err("%s is not the same size as %s - cannot restore.\n", + fname, dev); +-- +2.26.2 + diff --git a/mdadm.changes b/mdadm.changes index 8043f2e..88b9fa0 100644 --- a/mdadm.changes +++ b/mdadm.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Tue Jan 5 12:02:12 UTC 2021 - Coly Li + +- Incremental: Remove redundant spare movement logic + (jsc#SLE-13700, bsc#1180220) + 0112-Incremental-Remove-redundant-spare-movement-logic.patch +- Dump: get stat from a wrong metadata file when restoring metadata + (jsc#SLE-13700) + 0113-Dump-get-stat-from-a-wrong-metadata-file-when-restor.patch + ------------------------------------------------------------------- Sat Dec 5 13:53:38 UTC 2020 - Coly Li - There are some important fixes merged in mdadm upstream which diff --git a/mdadm.spec b/mdadm.spec index b6f0b0b..dd1fd12 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,7 +1,7 @@ # # spec file for package mdadm # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -148,6 +148,8 @@ Patch108: 0108-mdadm-Unify-forks-behaviour.patch Patch109: 0109-mdadm-Detail-show-correct-state-for-clustered-array.patch Patch110: 0110-Make-target-to-install-binaries-only.patch Patch111: 0111-udev-start-grow-service-automatically.patch +Patch112: 0112-Incremental-Remove-redundant-spare-movement-logic.patch +Patch113: 0113-Dump-get-stat-from-a-wrong-metadata-file-when-restor.patch Patch1001: 1001-display-timeout-status.patch Patch1002: 1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch Patch1003: 1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch @@ -266,6 +268,8 @@ mdadm is a program that can be used to control Linux md devices. %patch109 -p1 %patch110 -p1 %patch111 -p1 +%patch112 -p1 +%patch113 -p1 %patch1001 -p1 %patch1002 -p1 %patch1003 -p1