forked from pool/mdadm
- 0001-systemd-various-fixes-for-boot-with-container-arrays.patch
various fixes to improve boot-from-DDF or IMSM (bnc#866660) OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=106
This commit is contained in:
committed by
Git OBS Bridge
parent
ceac01b560
commit
19460dbde5
@@ -0,0 +1,83 @@
|
||||
From 8d1d32bb33da1bd08a398d26f364b84e69ac7b41 Mon Sep 17 00:00:00 2001
|
||||
From: NeilBrown <neilb@suse.de>
|
||||
Date: Tue, 8 Apr 2014 17:22:18 +1000
|
||||
Subject: [PATCH] systemd: various fixes for boot with container-arrays.
|
||||
|
||||
1/ Add systemd shutdown script to ensure DDF and IMSM are
|
||||
clean before we actually shutdown
|
||||
|
||||
2/ Get udev to tell systemd to run the mdmon@mdXXX.service
|
||||
units when a member array appears.
|
||||
|
||||
If we boot off a member array (with dracut at least),
|
||||
the mdmon started in the initramfs will lose track of
|
||||
/sys etc, so we need to restart it.
|
||||
systemd will try to forget about it too (but not actually
|
||||
kill it because we said not to do this).
|
||||
Having udev tell it to start it will allow a new mdmon to
|
||||
run which can see /sys, and systemd will know about it.
|
||||
|
||||
3/ Always use --offroot and --takeover when starting mdmon with
|
||||
systemd
|
||||
--offroot is needed else shutdown will hang.
|
||||
--takeover is needed incase an mdmon was started earlier
|
||||
(e.g. in initramfs).
|
||||
Neither hurt if they aren't actually needed.
|
||||
|
||||
Signed-off-by: NeilBrown <neilb@suse.de>
|
||||
---
|
||||
Makefile | 1 +
|
||||
systemd/mdadm.shutdown | 4 ++++
|
||||
systemd/mdmon@.service | 12 ++++++++++--
|
||||
udev-md-raid-arrays.rules | 4 ++++
|
||||
4 files changed, 19 insertions(+), 2 deletions(-)
|
||||
create mode 100644 systemd/mdadm.shutdown
|
||||
|
||||
--- mdadm-3.3.orig/Makefile
|
||||
+++ mdadm-3.3/Makefile
|
||||
@@ -286,6 +286,7 @@ install-udev: udev-md-raid-arrays.rules
|
||||
install-systemd: systemd/mdmon@.service
|
||||
$(INSTALL) -D -m 644 systemd/mdmon@.service $(DESTDIR)$(SYSTEMD_DIR)/mdmon@.service
|
||||
$(INSTALL) -D -m 644 systemd/mdmonitor.service $(DESTDIR)$(SYSTEMD_DIR)/mdmonitor.service
|
||||
+ $(INSTALL) -D -m 755 systemd/mdadm.shutdown $(DESTDIR)$(SYSTEMD_DIR)-shutdown/mdadm.shutdown
|
||||
[ -f /etc/SuSE-release -o -n "$(SUSE)" ] && $(INSTALL) -D -m 755 systemd/SUSE-mdadm_env.sh $(DESTDIR)$(SYSTEMD_DIR)/../scripts/mdadm_env.sh || true
|
||||
|
||||
uninstall:
|
||||
--- /dev/null
|
||||
+++ mdadm-3.3/systemd/mdadm.shutdown
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/sh
|
||||
+# We need to ensure all md arrays with external metadata
|
||||
+# (e.g. IMSM, DDF) are clean before completing the shutdown.
|
||||
+/sbin/mdadm --wait-clean --scan
|
||||
--- mdadm-3.3.orig/systemd/mdmon@.service
|
||||
+++ mdadm-3.3/systemd/mdmon@.service
|
||||
@@ -14,7 +14,15 @@ Before=initrd-switch-root.target
|
||||
# mdmon should never complain due to lack of a platform,
|
||||
# that is mdadm's job if at all.
|
||||
Environment=IMSM_NO_PLATFORM=1
|
||||
-ExecStart=/sbin/mdmon %I
|
||||
+# The mdmon starting in the initramfs (with dracut at least)
|
||||
+# cannot see sysfs after root is mounted, so we will have to
|
||||
+# 'takeover'. As the '--offroot --takeover' don't hurt when
|
||||
+# not necessary, are are useful with root-on-md in dracut,
|
||||
+# have them always present.
|
||||
+ExecStart=/sbin/mdmon --offroot --takeover %I
|
||||
Type=forking
|
||||
-PIDFile=/run/mdadm/%I.pid
|
||||
+# Don't set the PIDFile. It isn't necessary (systemd can work
|
||||
+# it out) and systemd will remove it when transitioning from
|
||||
+# initramfs to rootfs.
|
||||
+#PIDFile=/run/mdadm/%I.pid
|
||||
KillMode=none
|
||||
--- mdadm-3.3.orig/udev-md-raid-arrays.rules
|
||||
+++ mdadm-3.3/udev-md-raid-arrays.rules
|
||||
@@ -34,4 +34,8 @@ ENV{ID_FS_USAGE}=="filesystem|other", EN
|
||||
|
||||
ENV{MD_LEVEL}=="raid[1-9]*", ENV{SYSTEMD_WANTS}+="mdmonitor.service"
|
||||
|
||||
+# Tell systemd to run mdmon for our container, if we need it.
|
||||
+ENV{MD_LEVEL}=="raid[1-9]*", ENV{MD_CONTAINER}=="?*", PROGRAM="/usr/bin/readlink $env{MD_CONTAINER}", ENV{MD_MON_THIS}="%c"
|
||||
+ENV{MD_MON_THIS}=="?*", PROGRAM="/usr/bin/basename $env{MD_MON_THIS}", ENV{SYSTEMD_WANTS}+="mdmon@%c.service"
|
||||
+
|
||||
LABEL="md_end"
|
@@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 8 07:38:42 UTC 2014 - nfbrown@suse.com
|
||||
|
||||
- 0001-systemd-various-fixes-for-boot-with-container-arrays.patch
|
||||
various fixes to improve boot-from-DDF or IMSM
|
||||
(bnc#866660)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 2 04:41:53 UTC 2014 - nfbrown@suse.com
|
||||
|
||||
|
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
# We need to ensure all md array with external metadata
|
||||
# (e.g. IMSM) are clean before completing the shutdown.
|
||||
/sbin/mdadm --wait-clean --scan
|
@@ -40,7 +40,6 @@ Source2: sysconfig.mdadm
|
||||
Source5: mkinitrd-setup.sh
|
||||
Source6: mkinitrd-boot.sh
|
||||
Source7: mdadm.cron
|
||||
Source8: mdadm.shutdown
|
||||
Source9: systemd-mdadm-last-resort@.timer
|
||||
Source10: systemd-mdadm-last-resort@.service
|
||||
# PATCH-FIX-UPSTREAM config-set-auto_seen-after-processing-the-auto-line.patch upstream-bugfix nfbrown@suse.de
|
||||
@@ -121,6 +120,8 @@ Patch40: 0002-DDF-guard-against-pdnum-being-negative.patch
|
||||
Patch41: 0003-DDF-fix-possible-mdmon-crash-when-updating-metadata.patch
|
||||
# PATCH-FIX-UPSTREAM 0004-DDF-Don-t-fail-compare_super_ddf-due-to-re-configure.patch bnc#866660 nfbrown@suse.de
|
||||
Patch42: 0004-DDF-Don-t-fail-compare_super_ddf-due-to-re-configure.patch
|
||||
# PATCH-FIX-UPSTREAM 0001-systemd-various-fixes-for-boot-with-container-arrays.patch bnc#866660 nfbrown@suse.de
|
||||
Patch43: 0001-systemd-various-fixes-for-boot-with-container-arrays.patch
|
||||
|
||||
%define _udevdir %(pkg-config --variable=udevdir udev)
|
||||
%define _systemdshutdowndir %{_unitdir}/../system-shutdown
|
||||
@@ -171,6 +172,7 @@ programs but with a very different interface.
|
||||
%patch40 -p1
|
||||
%patch41 -p1
|
||||
%patch42 -p1
|
||||
%patch43 -p1
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} CC="%__cc" CXFLAGS="$RPM_OPT_FLAGS -Wno-error" SUSE=yes
|
||||
@@ -190,7 +192,6 @@ install -d %{buildroot}/etc/cron.daily
|
||||
install -m 755 %{S:7} %{buildroot}/etc/cron.daily/mdadm
|
||||
install -m 644 %{S:2} %{buildroot}%{_var}/adm/fillup-templates/
|
||||
install -d %{buildroot}%{_systemdshutdowndir}
|
||||
install -m 755 %{S:8} %{buildroot}%{_systemdshutdowndir}/mdadm.shutdown
|
||||
install -m 644 %{S:9} %{buildroot}%{_unitdir}/mdadm-last-resort@.timer
|
||||
install -m 644 %{S:10} %{buildroot}%{_unitdir}/mdadm-last-resort@.service
|
||||
|
||||
|
Reference in New Issue
Block a user