fix mdadm blocking caused by incorrect stop of inactive MD devices during shutdown
This commit is contained in:
parent
4bfea02ae3
commit
611dea4c36
72
backport-shutdown-get-only-active-md-arrays.patch
Normal file
72
backport-shutdown-get-only-active-md-arrays.patch
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
From 3a3b022d2cc112803ea7b9beea98bbcad110368a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||||
|
Date: Tue, 29 Mar 2022 12:49:54 +0200
|
||||||
|
Subject: [PATCH] shutdown: get only active md arrays.
|
||||||
|
|
||||||
|
Current md_list_get() implementation filters all block devices, started from
|
||||||
|
"md*". This is ambiguous because list could contain:
|
||||||
|
- partitions created upon md device (mdXpY)
|
||||||
|
- external metadata container- specific type of md array.
|
||||||
|
|
||||||
|
For partitions there is no issue, because they aren't handle STOP_ARRAY
|
||||||
|
ioctl sent later. It generates misleading errors only.
|
||||||
|
|
||||||
|
Second case is more problematic because containers are not locked in kernel.
|
||||||
|
They are stopped even if container member array is active. For that reason
|
||||||
|
reboot or shutdown flow could be blocked because metadata manager cannot be
|
||||||
|
restarted after switch root on shutdown.
|
||||||
|
|
||||||
|
Add filters to remove partitions and containers from md_list. Partitions
|
||||||
|
can be excluded by DEVTYPE. Containers are determined by MD_LEVEL
|
||||||
|
property, we are excluding all with "container" value.
|
||||||
|
|
||||||
|
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||||
|
|
||||||
|
Conflict:NA
|
||||||
|
Reference:https://github.com/systemd/systemd/commit/3a3b022d2cc112803ea7b9beea98bbcad110368a
|
||||||
|
|
||||||
|
---
|
||||||
|
src/shutdown/umount.c | 18 +++++++++++++++++-
|
||||||
|
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c
|
||||||
|
index 3e9e241499..820aa8e286 100644
|
||||||
|
--- a/src/shutdown/umount.c
|
||||||
|
+++ b/src/shutdown/umount.c
|
||||||
|
@@ -352,9 +352,14 @@ static int md_list_get(MountPoint **head) {
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
+ /* Filter out partitions. */
|
||||||
|
+ r = sd_device_enumerator_add_match_property(e, "DEVTYPE", "disk");
|
||||||
|
+ if (r < 0)
|
||||||
|
+ return r;
|
||||||
|
+
|
||||||
|
FOREACH_DEVICE(e, d) {
|
||||||
|
_cleanup_free_ char *p = NULL;
|
||||||
|
- const char *dn;
|
||||||
|
+ const char *dn, *md_level;
|
||||||
|
MountPoint *m;
|
||||||
|
dev_t devnum;
|
||||||
|
|
||||||
|
@@ -362,6 +367,17 @@ static int md_list_get(MountPoint **head) {
|
||||||
|
sd_device_get_devname(d, &dn) < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
+ r = sd_device_get_property_value(d, "MD_LEVEL", &md_level);
|
||||||
|
+ if (r < 0) {
|
||||||
|
+ log_warning_errno(r, "Failed to get MD_LEVEL property for %s, ignoring: %m", dn);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* MD "containers" are a special type of MD devices, used for external metadata.
|
||||||
|
+ * Since it doesn't provide RAID functionality in itself we don't need to stop it. */
|
||||||
|
+ if (streq(md_level, "container"))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
p = strdup(dn);
|
||||||
|
if (!p)
|
||||||
|
return -ENOMEM;
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -21,7 +21,7 @@
|
|||||||
Name: systemd
|
Name: systemd
|
||||||
Url: https://www.freedesktop.org/wiki/Software/systemd
|
Url: https://www.freedesktop.org/wiki/Software/systemd
|
||||||
Version: 249
|
Version: 249
|
||||||
Release: 73
|
Release: 74
|
||||||
License: MIT and LGPLv2+ and GPLv2+
|
License: MIT and LGPLv2+ and GPLv2+
|
||||||
Summary: System and Service Manager
|
Summary: System and Service Manager
|
||||||
|
|
||||||
@ -636,6 +636,7 @@ Patch6587: backport-basic-fix-overflow-detection-in-sigbus_pop.patch
|
|||||||
Patch6588: backport-busctl-avoid-asserting-on-NULL-message.patch
|
Patch6588: backport-busctl-avoid-asserting-on-NULL-message.patch
|
||||||
Patch6589: backport-resolve-don-t-add-sockets-to-the-graveyard-on-shutdo.patch
|
Patch6589: backport-resolve-don-t-add-sockets-to-the-graveyard-on-shutdo.patch
|
||||||
Patch6590: backport-sd-journal-check-sd-event-state-before-setting-up-po.patch
|
Patch6590: backport-sd-journal-check-sd-event-state-before-setting-up-po.patch
|
||||||
|
Patch6591: backport-shutdown-get-only-active-md-arrays.patch
|
||||||
|
|
||||||
Patch9001: update-rtc-with-system-clock-when-shutdown.patch
|
Patch9001: update-rtc-with-system-clock-when-shutdown.patch
|
||||||
Patch9002: udev-add-actions-while-rename-netif-failed.patch
|
Patch9002: udev-add-actions-while-rename-netif-failed.patch
|
||||||
@ -2140,6 +2141,9 @@ grep -q -E '^KEYMAP="?fi-latin[19]"?' /etc/vconsole.conf 2>/dev/null &&
|
|||||||
%{_libdir}/security/pam_systemd.so
|
%{_libdir}/security/pam_systemd.so
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Mar 16 2024 huyubiao <huyubiao@huawei.com> - 249-74
|
||||||
|
- fix mdadm blocking caused by incorrect stop of inactive MD devices during shutdown
|
||||||
|
|
||||||
* Mon Mar 4 2024 huyubiao <huyubiao@huawei.com> - 249-73
|
* Mon Mar 4 2024 huyubiao <huyubiao@huawei.com> - 249-73
|
||||||
- move the architecture patches after Patch9800 (excluding Patch9800)
|
- move the architecture patches after Patch9800 (excluding Patch9800)
|
||||||
delete the duplicate systemd-coredump.socket
|
delete the duplicate systemd-coredump.socket
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user