diff --git a/SOURCES/mdadm-3.2.6-mdmon-.service-Change-type-of-process-start-up-to-fo.patch b/SOURCES/mdadm-3.2.6-mdmon-.service-Change-type-of-process-start-up-to-fo.patch new file mode 100644 index 0000000..8e130b7 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-mdmon-.service-Change-type-of-process-start-up-to-fo.patch @@ -0,0 +1,41 @@ +From 2167de78aab599e7a7a8d057ef04bf18527bc129 Mon Sep 17 00:00:00 2001 +From: Pawel Baldysiak +Date: Thu, 6 Mar 2014 15:51:44 +0100 +Subject: [PATCH] mdmon@.service: Change type of process start-up to 'forking'. + +Mdadm does not wait enough time when mdmon is started by systemd. +It causes various problems with behaviour of a RAID volume with external metadata. +For example: mdmon does not update a value of checkpoint during migration +and second RAID5 volume is read-only after reboot done during +container reshape (both problems occur with IMSM matadata). +If a type of process start-up is changed to 'forking', systemctl will +wait until mdmon (parent) process exits after calling fork. +This way mdmon will always be fully initialized after start_mdmon +and these problems will not occur. +In this case it is recommended to add a path to PIDFile, so that systemd +does not have to guess a PID of the mdmon process. + +Signed-off-by: Pawel Baldysiak +Reviewed-by: Artur Paszkiewicz +Reviewed-by: Lukasz Dorau +Signed-off-by: NeilBrown +--- + systemd/mdmon@.service | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/systemd/mdmon@.service b/systemd/mdmon@.service +index 5520cd0..304b26e 100644 +--- a/systemd/mdmon@.service ++++ b/systemd/mdmon@.service +@@ -11,7 +11,10 @@ + Before=initrd-switch-root.target + + [Service] +-ExecStart=/sbin/mdmon --foreground %I ++Environment=IMSM_NO_PLATFORM=1 ++ExecStart=/sbin/mdmon %I ++Type=forking ++PIDFile=/run/mdadm/%I.pid + StandardInput=null + StandardOutput=null + StandardError=null diff --git a/SOURCES/mdadm-3.2.6-mdmon-honour-offroot-again.patch b/SOURCES/mdadm-3.2.6-mdmon-honour-offroot-again.patch new file mode 100644 index 0000000..d7aab09 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-mdmon-honour-offroot-again.patch @@ -0,0 +1,40 @@ +From 5d79c72e16b32d7d6d0f535348286a7f2a966092 Mon Sep 17 00:00:00 2001 +From: "mwilck@arcor.de" +Date: Wed, 11 Sep 2013 22:15:19 +0200 +Subject: [PATCH] mdmon: honour --offroot, again + +commit 3e32ba9d removed support for --offroot, and a9c15847 made +mdmon use @ in argv[0] only when started from initrd. + +This breaks mdadm in OpenSUSE 12.3, which starts mdmon from the +root file system and relies on --offroot to work as documented earlier. + +Reintroducing --offroot as an undocumented option, as its use is going to +go away soon anyway. + +If this can't be applied, it should probably be included as distro-specific +patch if mdadm 3.3 is built for OpenSUSE 12.3. I haven't checked if the +patch is necesary for OpenSUSE Factory, too. + +Signed-off-by: Martin Wilck +Signed-off-by: NeilBrown +--- + mdmon.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mdmon.c b/mdmon.c +index f0b0623..8cd53d8 100644 +--- a/mdmon.c ++++ b/mdmon.c +@@ -320,7 +320,7 @@ int main(int argc, char *argv[]) + dofork = 0; + break; + case OffRootOpt: +- /* silently ignore old option */ ++ argv[0][0] = '@'; + break; + case 'h': + default: +-- +1.9.3 + diff --git a/SOURCES/mdadm-3.2.6-systemd-various-fixes-for-boot-with-container-arrays.patch b/SOURCES/mdadm-3.2.6-systemd-various-fixes-for-boot-with-container-arrays.patch new file mode 100644 index 0000000..9b20396 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-systemd-various-fixes-for-boot-with-container-arrays.patch @@ -0,0 +1,84 @@ +From 8d1d32bb33da1bd08a398d26f364b84e69ac7b41 Mon Sep 17 00:00:00 2001 +From: NeilBrown +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 +--- + 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 + +diff --git a/systemd/mdadm.shutdown b/systemd/mdadm.shutdown +new file mode 100644 +index 0000000..1bbbb6f +--- /dev/null ++++ b/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 +diff --git a/systemd/mdmon@.service b/systemd/mdmon@.service +index 304b26e..af0a2a3 100644 +--- a/systemd/mdmon@.service ++++ b/systemd/mdmon@.service +@@ -12,9 +12,17 @@ Before=initrd-switch-root.target + + [Service] + 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 + StandardInput=null + StandardOutput=null + StandardError=null +diff --git a/udev-md-raid-arrays.rules b/udev-md-raid-arrays.rules +index 4abbe35..92aec36 100644 +--- mdadm-3.2.6/udev-md-raid.rules.sysd 2014-06-18 12:10:38.363633555 +0200 ++++ mdadm-3.2.6/udev-md-raid.rules 2014-06-18 12:13:17.927934585 +0200 +@@ -46,4 +46,10 @@ + ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" + ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + ++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" diff --git a/SPECS/mdadm.spec b/SPECS/mdadm.spec index b3cef7e..32ef230 100644 --- a/SPECS/mdadm.spec +++ b/SPECS/mdadm.spec @@ -1,7 +1,7 @@ Summary: The mdadm program controls Linux md devices (software RAID arrays) Name: mdadm Version: 3.2.6 -Release: 31%{?dist} +Release: 31%{?dist}.2 Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz Source1: mdmonitor.init Source2: raid-check @@ -34,6 +34,9 @@ Patch84: mdadm-3.2.6-Don-t-lie-to-systemd-about-mdadm-s-status.patch Patch85: mdadm-3.2.6-mdmon-don-t-lie-to-systemd.patch Patch86: mdadm-3.2.6-Grow-exit-background-thread-cleanly-on-SIGTERM.patch Patch87: mdadm-3.2.6-in_initrd-fix-gcc-compiler-error.patch +Patch88: mdadm-3.2.6-mdmon-.service-Change-type-of-process-start-up-to-fo.patch +Patch89: mdadm-3.2.6-mdmon-honour-offroot-again.patch +Patch90: mdadm-3.2.6-systemd-various-fixes-for-boot-with-container-arrays.patch # Fedora customization patches Patch97: mdadm-3.2.6-udev.patch Patch98: mdadm-2.5.2-static.patch @@ -46,6 +49,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Obsoletes: mdctl,raidtools Obsoletes: mdadm-sysvinit Conflicts: dracut < 024-25 +Conflicts: selinux-policy < 3.12.1-153 Requires(post): systemd-units chkconfig coreutils BuildRequires: systemd-units binutils-devel Requires(preun): systemd-units @@ -87,6 +91,10 @@ file can be used to help with some common tasks. %patch85 -p1 -b .initram %patch86 -p1 -b .sigterm %patch87 -p1 -b .sign +%patch88 -p1 -b .mdmonlaunch +%patch89 -p1 -b .offroot2 +%patch90 -p1 -b .sysd + # Fedora customization patches %patch97 -p1 -b .udev @@ -151,6 +159,17 @@ rm -rf %{buildroot} /etc/libreport/events.d/* %changelog +* Fri Aug 22 2014 Jes Sorensen - 3.2.6-31.2 +- Fix problem with spare disk not being added correctly to IMSM array + because mdmon is unable to write metadata to it. +- Resolves bz1132829 + +* Mon Jul 28 2014 Jes Sorensen - 3.2.6-31.1 +- Fix issue with mdmon not being launched correctly after reboot + during container reshape second of a second RAID5 array, resulting in + it being read-only and cannot be mounted. +- Resolves bz1123031 + * Mon Mar 10 2014 Jes Sorensen - 3.2.6-31 - Fix problem of IMSM platform capabilities not being detected in UEFI mode when only the second SATA controller is enabled.