Hello community, here is the log from the commit of package mdadm for openSUSE:Factory checked in at 2014-01-30 12:52:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mdadm (Old) and /work/SRC/openSUSE:Factory/.mdadm.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mdadm" Changes: -------- --- /work/SRC/openSUSE:Factory/mdadm/mdadm.changes 2013-12-06 11:46:06.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.mdadm.new/mdadm.changes 2014-01-30 12:52:07.000000000 +0100 @@ -1,0 +2,25 @@ +Wed Jan 22 23:45:34 UTC 2014 - [email protected] + +- remove boot.md. It no longer does anything useful. + +------------------------------------------------------------------- +Wed Jan 22 04:54:22 UTC 2014 - [email protected] + +- mdmonitor + run "mdadm --monitor" from systemd instead of init.d + sciprt (bnc#849523) +- remove mdadmd due to above. +- udev-rules-try-mdadm-I-on-change-events.patch + (bnc#851993) +- policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch +- DDF-really-ignore-DDF-metadata-on-partitions.patch +- Assemble-avoid-infinite-loop-when-auto-assembling-pa.patch +- DDF-fix-detection-of-failed-devices-during-assembly.patch +- Grow-fix-problems-with-prematurely-aborting-of-resha.patch +- IMSM-don-t-crash-when-creating-an-array-with-missing.patch +- mdmon-don-t-complain-about-notifying-parent-when-the.patch +- systemd-mdmon-set-IMSM_NO_PLATFORM-1.patch +- mdmon-.service-remove-over-ride-of-Standard-IO.patch + Various upstream bug fixes. + +------------------------------------------------------------------- Old: ---- boot.md mdadmd New: ---- Assemble-avoid-infinite-loop-when-auto-assembling-pa.patch DDF-fix-detection-of-failed-devices-during-assembly.patch DDF-really-ignore-DDF-metadata-on-partitions.patch Grow-fix-problems-with-prematurely-aborting-of-resha.patch IMSM-don-t-crash-when-creating-an-array-with-missing.patch mdmon-.service-remove-over-ride-of-Standard-IO.patch mdmon-don-t-complain-about-notifying-parent-when-the.patch mdmonitor policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch systemd-mdmon-set-IMSM_NO_PLATFORM-1.patch udev-rules-try-mdadm-I-on-change-events.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mdadm.spec ++++++ --- /var/tmp/diff_new_pack.3Bo0Wb/_old 2014-01-30 12:52:08.000000000 +0100 +++ /var/tmp/diff_new_pack.3Bo0Wb/_new 2014-01-30 12:52:08.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package mdadm # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -37,8 +37,6 @@ Source: https://www.kernel.org/pub/linux/utils/raid/mdadm/%{name}-%{version}.tar.bz2 Source1: Software-RAID.HOWTO.tar.bz2 Source2: sysconfig.mdadm -Source3: mdadmd -Source4: boot.md Source5: mkinitrd-setup.sh Source6: mkinitrd-boot.sh Source7: mdadm.cron @@ -79,6 +77,28 @@ Patch16: Incremental-improve-support-for-DEVICE-based-restric.patch # PATCH-FIX-UPSTREAM Assemble-Incremental-don-t-hold-O_EXCL-on-mddev-afte.patch [email protected] Patch17: Assemble-Incremental-don-t-hold-O_EXCL-on-mddev-afte.patch +# PATCH-FIX-UPSTREAM mdmonitor bnc#849523 [email protected] +Patch18: mdmonitor +# PATCH-FIX-UPSTREAM udev-rules-try-mdadm-I-on-change-events.patch bnc#851993 [email protected] +Patch19: udev-rules-try-mdadm-I-on-change-events.patch +# PATCH-FIX-UPSTREAM policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch [email protected] +Patch20: policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch +# PATCH-FIX-UPSTREAM DDF-really-ignore-DDF-metadata-on-partitions.patch [email protected] +Patch21: DDF-really-ignore-DDF-metadata-on-partitions.patch +# PATCH-FIX-UPSTREAM Assemble-avoid-infinite-loop-when-auto-assembling-pa.patch [email protected] +Patch22: Assemble-avoid-infinite-loop-when-auto-assembling-pa.patch +# PATCH-FIX-UPSTREAM DDF-fix-detection-of-failed-devices-during-assembly.patch [email protected] +Patch23: DDF-fix-detection-of-failed-devices-during-assembly.patch +# PATCH-FIX-UPSTREAM Grow-fix-problems-with-prematurely-aborting-of-resha.patch [email protected] +Patch24: Grow-fix-problems-with-prematurely-aborting-of-resha.patch +# PATCH-FIX-UPSTREAM IMSM-don-t-crash-when-creating-an-array-with-missing.patch [email protected] +Patch25: IMSM-don-t-crash-when-creating-an-array-with-missing.patch +# PATCH-FIX-UPSTREAM mdmon-don-t-complain-about-notifying-parent-when-the.patch [email protected] +Patch26: mdmon-don-t-complain-about-notifying-parent-when-the.patch +# PATCH-FIX-UPSTREAM systemd-mdmon-set-IMSM_NO_PLATFORM-1.patch [email protected] +Patch27: systemd-mdmon-set-IMSM_NO_PLATFORM-1.patch +# PATCH-FIX-UPSTREAM mdmon-.service-remove-over-ride-of-Standard-IO.patch [email protected] +Patch28: mdmon-.service-remove-over-ride-of-Standard-IO.patch %define _udevdir %(pkg-config --variable=udevdir udev) %define _systemdshutdowndir %{_unitdir}/../system-shutdown @@ -107,26 +127,35 @@ %patch15 -p1 %patch16 -p1 %patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 %build -make %{?_smp_mflags} CC="%__cc" CXFLAGS="$RPM_OPT_FLAGS -Wno-error" +make %{?_smp_mflags} CC="%__cc" CXFLAGS="$RPM_OPT_FLAGS -Wno-error" SUSE=yes cd Software-RAID.HOWTO sgml2html Software-RAID.HOWTO.sgml sgml2txt Software-RAID.HOWTO.sgml %install -make install install-systemd install-udev DESTDIR=%{buildroot} SYSTEMD_DIR=%{_unitdir} UDEVDIR=%{_udevdir} +make install install-systemd install-udev DESTDIR=%{buildroot} SYSTEMD_DIR=%{_unitdir} UDEVDIR=%{_udevdir} SUSE=yes rm -rf %{buildroot}/lib/udev install -d %{buildroot}%{_var}/adm/fillup-templates -install -d %{buildroot}{%{_sbindir},%{_sysconfdir}/init.d} -install -m 755 %{S:4} %{S:3} %{buildroot}%{_sysconfdir}/init.d/ +install -d %{buildroot}{%{_sbindir} install -d %{buildroot}/lib/mkinitrd/scripts install -m 755 %{S:5} %{buildroot}/lib/mkinitrd/scripts/setup-md.sh install -m 755 %{S:6} %{buildroot}/lib/mkinitrd/scripts/boot-md.sh 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/ -ln -sf ../../etc/init.d/mdadmd %{buildroot}/%{_sbindir}/rcmdadmd install -d %{buildroot}%{_systemdshutdowndir} install -m 755 %{S:8} %{buildroot}%{_systemdshutdowndir}/mdadm.shutdown install -m 644 %{S:9} %{buildroot}%{_unitdir}/[email protected] @@ -141,10 +170,9 @@ /sbin/mkinitrd fi -%{fillup_and_insserv -y boot.md} +%fillup_only %postun -%restart_on_update mdadmd [ -x /sbin/mkinitrd_setup ] && mkinitrd_setup if [ -e /var/lib/no_initrd_recreation_by_suspend ]; then echo "Skipping recreation of existing initial ramdisks, due" @@ -156,19 +184,16 @@ %{insserv_cleanup} %preun -%stop_on_removal mdadmd %clean rm -rf %{buildroot} %files %defattr(-,root,root) -%attr(0755,root,root) %config %{_sysconfdir}/init.d/* %doc COPYING ChangeLog README.initramfs TODO mdadm.conf-example mkinitramfs %doc Software-RAID.HOWTO/Software-RAID.HOWTO*{.txt,.html} %doc %{_mandir}/man?/* /sbin/* -%{_sbindir}/* %{_var}/adm/fillup-templates/sysconfig.mdadm %dir /lib/mkinitrd %dir /lib/mkinitrd/scripts @@ -176,12 +201,14 @@ /lib/mkinitrd/scripts/boot-md.sh %{_udevdir}/rules.d/63-md-raid-arrays.rules %{_udevdir}/rules.d/64-md-raid-assembly.rules -%dir /etc %dir /etc/cron.daily /etc/cron.daily/mdadm %{_systemdshutdowndir}/mdadm.shutdown %{_unitdir}/[email protected] +%{_unitdir}/mdmonitor.service %{_unitdir}/[email protected] %{_unitdir}/[email protected] +%dir %{_unitdir}/../scripts +%{_unitdir}/../scripts/mdadm_env.sh %changelog ++++++ Assemble-avoid-infinite-loop-when-auto-assembling-pa.patch ++++++ >From 284546ef89168c9003da192a177cae774199f889 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Mon, 20 Jan 2014 15:23:31 +1100 Subject: [PATCH 07/13] Assemble: avoid infinite loop when auto-assembling partial container. When auto-assembling we loop until we get no successes. If a device is found that look like it is part of an already-existing container, but we subsequently fail to add that device, then the fact that the container is running looks like a success. This can result in infinite looping. So if a container was already partially assemble, and is still only partially assembled after we try to add devices, then don't treat that as success. Signed-off-by: NeilBrown <[email protected]> --- Assemble.c | 4 ++++ 1 file changed, 4 insertions(+) --- mdadm-3.3.orig/Assemble.c +++ mdadm-3.3/Assemble.c @@ -990,6 +990,10 @@ static int start_array(int mdfd, } st->ss->free_super(st); sysfs_uevent(content, "change"); + if (err_ok && okcnt < (unsigned)content->array.raid_disks) + /* Was partial, is still partial, so signal an error + * to ensure we don't retry */ + return 1; return 0; } ++++++ DDF-fix-detection-of-failed-devices-during-assembly.patch ++++++ >From f0e876ce03a63f150bb87b2734c139bc8bb285b2 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Mon, 20 Jan 2014 15:27:29 +1100 Subject: [PATCH 08/13] DDF: fix detection of failed devices during assembly. When we call "getinfo_super", we report the working/failed status of the particular device, and also (via the 'map') the working/failed status of every other device that this metadata is aware of. It is important that the way we calculate "working or failed" is consistent. As it is, getinfo_super_ddf() will report a spare as "working", but every other device will see it as "failed", which leads to failure to assemble arrays with spares. For getinfo_super_ddf (i.e. for the container), a device is assumed "working" unless flagged as DDF_Failed. For getinfo_super_ddf_bvd (for a member array), a device is assumed "failed" unless DDF_Online is set, and DDF_Failed is not set. Reported-by: "David F." <[email protected]> Signed-off-by: NeilBrown <[email protected]> --- super-ddf.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) --- mdadm-3.3.orig/super-ddf.c +++ mdadm-3.3/super-ddf.c @@ -1914,6 +1914,7 @@ static void getinfo_super_ddf(struct sup info->disk.major = 0; info->disk.minor = 0; if (ddf->dlist) { + struct phys_disk_entry *pde = NULL; info->disk.number = be32_to_cpu(ddf->dlist->disk.refnum); info->disk.raid_disk = find_phys(ddf, ddf->dlist->disk.refnum); @@ -1921,12 +1922,19 @@ static void getinfo_super_ddf(struct sup entries[info->disk.raid_disk]. config_size); info->component_size = ddf->dlist->size - info->data_offset; + if (info->disk.raid_disk >= 0) + pde = ddf->phys->entries + info->disk.raid_disk; + if (pde && + !(be16_to_cpu(pde->state) & DDF_Failed)) + info->disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE); + else + info->disk.state = 1 << MD_DISK_FAULTY; } else { info->disk.number = -1; info->disk.raid_disk = -1; // info->disk.raid_disk = find refnum in the table and use index; + info->disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE); } - info->disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE); info->recovery_start = MaxSector; info->reshape_active = 0; @@ -1944,8 +1952,6 @@ static void getinfo_super_ddf(struct sup int i; for (i = 0 ; i < map_disks; i++) { if (i < info->array.raid_disks && - (be16_to_cpu(ddf->phys->entries[i].state) - & DDF_Online) && !(be16_to_cpu(ddf->phys->entries[i].state) & DDF_Failed)) map[i] = 1; @@ -2018,7 +2024,11 @@ static void getinfo_super_ddf_bvd(struct info->disk.raid_disk = cd + conf->sec_elmnt_seq * be16_to_cpu(conf->prim_elmnt_count); info->disk.number = dl->pdnum; - info->disk.state = (1<<MD_DISK_SYNC)|(1<<MD_DISK_ACTIVE); + info->disk.state = 0; + if (info->disk.number >= 0 && + (be16_to_cpu(ddf->phys->entries[info->disk.number].state) & DDF_Online) && + !(be16_to_cpu(ddf->phys->entries[info->disk.number].state) & DDF_Failed)) + info->disk.state = (1<<MD_DISK_SYNC)|(1<<MD_DISK_ACTIVE); } info->container_member = ddf->currentconf->vcnum; ++++++ DDF-really-ignore-DDF-metadata-on-partitions.patch ++++++ >From a34fea0eae78fbabb289a5bce6d7a04bf889156d Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Mon, 20 Jan 2014 12:25:23 +1100 Subject: [PATCH 06/13] DDF - really ignore DDF metadata on partitions. See commit 357ac1067835d1cdd5f80acc28501db0ffc64957 which made a similar change for super-intel, and really should have fixed DDF at the same time. Signed-off-by: NeilBrown <[email protected]> --- super-ddf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- mdadm-3.3.orig/super-ddf.c +++ mdadm-3.3/super-ddf.c @@ -1126,7 +1126,7 @@ static int load_super_ddf(struct superty if (get_dev_size(fd, devname, &dsize) == 0) return 1; - if (!st->ignore_hw_compat && test_partition(fd)) + if (test_partition(fd)) /* DDF is not allowed on partitions */ return 1; ++++++ Grow-fix-problems-with-prematurely-aborting-of-resha.patch ++++++ >From 5e7be8389446a4afa016351e65d1ead31a978f16 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Mon, 20 Jan 2014 15:31:45 +1100 Subject: [PATCH 09/13] Grow: fix problems with prematurely aborting of reshapes. 1/ when unfreezing, make sure the array is frozen first. If it isn't we might end up interrupting a reshape. 2/ When the child finishes, don't call abort_reshape() as that will interrupt the reshape. Just set suspend_* etc explicitly. Signed-off-by: NeilBrown <[email protected]> --- Grow.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) --- mdadm-3.3.orig/Grow.c +++ mdadm-3.3/Grow.c @@ -612,9 +612,14 @@ static void unfreeze(struct supertype *s return unfreeze_container(st); else { struct mdinfo *sra = sysfs_read(-1, st->devnm, GET_VERSION); + char buf[20]; - if (sra) + if (sra && + sysfs_get_str(sra, NULL, "sync_action", buf, 20) > 0 + && strcmp(buf, "frozen\n") == 0) { + printf("unfreeze\n"); sysfs_set_str(sra, NULL, "sync_action", "idle"); + } sysfs_free(sra); } } @@ -2666,7 +2671,7 @@ static int impose_level(int fd, int leve for (d = 0, found = 0; d < MAX_DISKS && found < array.nr_disks; d++) { - mdu_disk_info_t disk; + mdu_disk_info_t disk; disk.number = d; if (ioctl(fd, GET_DISK_INFO, &disk) < 0) continue; @@ -4316,7 +4321,12 @@ int child_monitor(int afd, struct mdinfo } /* FIXME maybe call progress_reshape one more time instead */ - abort_reshape(sra); /* remove any remaining suspension */ + /* remove any remaining suspension */ + sysfs_set_num(sra, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL); + sysfs_set_num(sra, NULL, "suspend_hi", 0); + sysfs_set_num(sra, NULL, "suspend_lo", 0); + sysfs_set_num(sra, NULL, "sync_min", 0); + if (reshape->before.data_disks == reshape->after.data_disks) sysfs_set_num(sra, NULL, "sync_speed_min", speed); free(buf); ++++++ IMSM-don-t-crash-when-creating-an-array-with-missing.patch ++++++ >From 1ca5c8e0c74946f4fcd74e97c5f48fba482d9596 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Tue, 21 Jan 2014 09:40:02 +1100 Subject: [PATCH 10/13] IMSM: don't crash when creating an array with missing devices. 'missing' devices are in a different list so when collection the serial numbers of all devices we need to check both lists. Signed-off-by: NeilBrown <[email protected]> --- super-intel.c | 2 ++ 1 file changed, 2 insertions(+) --- mdadm-3.3.orig/super-intel.c +++ mdadm-3.3/super-intel.c @@ -5210,6 +5210,8 @@ static int create_array(struct supertype int idx = get_imsm_disk_idx(dev, i, MAP_X); disk = get_imsm_disk(super, idx); + if (!disk) + disk = get_imsm_missing(super, idx); serialcpy(inf[i].serial, disk->serial); } append_metadata_update(st, u, len); ++++++ mdmon-.service-remove-over-ride-of-Standard-IO.patch ++++++ >From 1f6b069494c1ecf8014a76fb10e8c8f5f6c27365 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Wed, 22 Jan 2014 12:53:31 +1100 Subject: [PATCH 13/13] [email protected]: remove over-ride of Standard IO. Redirecting output to /dev/null is unnecessary and hides any error messages there might be. So leave as defaults which are none, journal, inherit. Signed-off-by: NeilBrown <[email protected]> --- systemd/[email protected] | 3 --- 1 file changed, 3 deletions(-) --- mdadm-3.3.orig/systemd/[email protected] +++ mdadm-3.3/systemd/[email protected] @@ -15,7 +15,4 @@ Before=initrd-switch-root.target # that is mdadm's job if at all. Environment=IMSM_NO_PLATFORM=1 ExecStart=/sbin/mdmon --foreground %I -StandardInput=null -StandardOutput=null -StandardError=null KillMode=none ++++++ mdmon-don-t-complain-about-notifying-parent-when-the.patch ++++++ >From 5e57245e3feba65385fc100e0f2c3d1214d79915 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Tue, 21 Jan 2014 09:43:31 +1100 Subject: [PATCH 11/13] mdmon: don't complain about notifying parent when there is no need When run with --foreground mdmon has no need to notify any parent, so it shouldn't even try, let alone complain when it fails. Also close an end of a pipe which is no longer used. Signed-off-by: NeilBrown <[email protected]> --- mdmon.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- mdadm-3.3.orig/mdmon.c +++ mdadm-3.3/mdmon.c @@ -429,6 +429,7 @@ static int mdmon(char *devnm, int must_f wait(&status); status = WEXITSTATUS(status); } + close(pfd[0]); return status; } } else @@ -516,10 +517,12 @@ static int mdmon(char *devnm, int must_f container->sock = make_control_sock(devnm); status = 0; - if (write(pfd[1], &status, sizeof(status)) < 0) - pr_err("failed to notify our parent: %d\n", - getppid()); - close(pfd[1]); + if (pfd[1] >= 0) { + if (write(pfd[1], &status, sizeof(status)) < 0) + pr_err("failed to notify our parent: %d\n", + getppid()); + close(pfd[1]); + } mlockall(MCL_CURRENT | MCL_FUTURE); ++++++ mdmonitor ++++++ >From 61c094715836e76b66d7a69adcb6769127b5b77d Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Wed, 11 Dec 2013 10:47:54 +1100 Subject: [PATCH] Add mdmonitor.service systemd unit file. References: bnc#849523 This systemd unit file runs mdadm in --monitor mode. It is started by a SYSTEMD_WANTS signal from udev whenever an md array is started that would benefit from mdadm --monitor. Commandline arguments can be provided by a script /usr/lib/systemd/scripts/mdadm_env.sh which should write an MDADM_MONITOR_ARGS=.... line to /run/sysconfig/mdadm A script to extra args from SUSE's /etc/sysconfig/mdadm file is provided. If no mdadm_env.sh is provided, then args are "--scan" which requires "mail" or "program" to be set in /etc/mdadm.conf. I believe this is suitable for Fedora. Signed-off-by: NeilBrown <[email protected]> --- Makefile | 2 ++ systemd/SUSE-mdadm_env.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ systemd/mdmonitor.service | 16 ++++++++++++++++ udev-md-raid-arrays.rules | 2 ++ 4 files changed, 65 insertions(+) --- mdadm-3.3.orig/Makefile +++ mdadm-3.3/Makefile @@ -285,6 +285,8 @@ install-udev: udev-md-raid-arrays.rules install-systemd: systemd/[email protected] $(INSTALL) -D -m 644 systemd/[email protected] $(DESTDIR)$(SYSTEMD_DIR)/[email protected] + $(INSTALL) -D -m 644 systemd/mdmonitor.service $(DESTDIR)$(SYSTEMD_DIR)/mdmonitor.service + [ -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: rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 $(DESTDIR)$(MAN8DIR)/mdmon.8 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm --- /dev/null +++ mdadm-3.3/systemd/SUSE-mdadm_env.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# extract configuration from /etc/sysconfig/mdadm and write +# environment to /run/sysconfig/mdadm to be used by +# systemd unit files. + +MDADM_SCAN="yes" + +# Following adapted from /etc/init.d/mdadmd on openSUSE + +mdadmd_CONFIG=/etc/sysconfig/mdadm +if test -r $mdadmd_CONFIG; then + . $mdadmd_CONFIG +fi + +if [ x$MDADM_DELAY != x"" ]; then + MDADM_DELAY="-d "$MDADM_DELAY; +fi + +if [ x$MDADM_MAIL != x"" ]; then + MDADM_MAIL="-m \"$MDADM_MAIL\"" +fi + +if [ x$MDADM_PROGRAM != x"" ]; then + MDADM_PROGRAM="-p \"$MDADM_PROGRAM\"" +fi + +if [ x$MDADM_SCAN = x"yes" ]; then + MDADM_SCAN="--scan" +else + MDADM_SCAN="" +fi + +if [ x$MDADM_SEND_MAIL_ON_START = x"yes" ]; then + MDADM_SEND_MAIL="-t" +else + MDADM_SEND_MAIL="" +fi + +if [ x$MDADM_CONFIG != x"" ]; then + MDADM_CONFIG="-c \"$MDADM_CONFIG\"" +fi + +mkdir -p /run/sysconfig +echo "MDADM_MONITOR_ARGS=$MDADM_RAIDDEVICES $MDADM_DELAY $MDADM_MAIL $MDADM_PROGRAM $MDADM_SCAN $MDADM_SEND_MAIL $MDADM_CONFIG" > /run/sysconfig/mdadm --- /dev/null +++ mdadm-3.3/systemd/mdmonitor.service @@ -0,0 +1,16 @@ +# This file is part of mdadm. +# +# mdadm is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +[Unit] +Description=MD array monitor +DefaultDependencies=no + +[Service] +Environment= MDADM_MONITOR_ARGS=--scan +EnvironmentFile=-/run/sysconfig/mdadm +ExecStartPre=-/usr/lib/systemd/scripts/mdadm_env.sh +ExecStart=/sbin/mdadm --monitor $MDADM_MONITOR_ARGS --- mdadm-3.3.orig/udev-md-raid-arrays.rules +++ mdadm-3.3/udev-md-raid-arrays.rules @@ -32,4 +32,6 @@ OPTIONS+="watch" 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" + LABEL="md_end" ++++++ policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch ++++++ >From 75a721fd7d5e5ee7e578571fe58755fe07e446fc Mon Sep 17 00:00:00 2001 From: Lukasz Dorau <[email protected]> Date: Thu, 19 Dec 2013 13:02:12 +0100 Subject: [PATCH 05/13] policy: NULL path isn't really acceptable - use the devname According to: commit b451aa4846c5ccca5447a6b6d45e5623b8c8e961 Fix handling for "auto" line in mdadm.conf a NULL path isn't really acceptable and the devname should be used instead. Signed-off-by: Lukasz Dorau <[email protected]> Signed-off-by: NeilBrown <[email protected]> --- policy.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) --- mdadm-3.3.orig/policy.c +++ mdadm-3.3/policy.c @@ -200,26 +200,25 @@ static char *disk_path(struct mdinfo *di int rv; by_path = opendir(symlink); - if (!by_path) - return NULL; - prefix_len = strlen(symlink); - - while ((ent = readdir(by_path)) != NULL) { - if (ent->d_type != DT_LNK) - continue; - strncpy(symlink + prefix_len, - ent->d_name, - sizeof(symlink) - prefix_len); - if (stat(symlink, &stb) < 0) - continue; - if ((stb.st_mode & S_IFMT) != S_IFBLK) - continue; - if (stb.st_rdev != makedev(disk->disk.major, disk->disk.minor)) - continue; + if (by_path) { + prefix_len = strlen(symlink); + while ((ent = readdir(by_path)) != NULL) { + if (ent->d_type != DT_LNK) + continue; + strncpy(symlink + prefix_len, + ent->d_name, + sizeof(symlink) - prefix_len); + if (stat(symlink, &stb) < 0) + continue; + if ((stb.st_mode & S_IFMT) != S_IFBLK) + continue; + if (stb.st_rdev != makedev(disk->disk.major, disk->disk.minor)) + continue; + closedir(by_path); + return xstrdup(ent->d_name); + } closedir(by_path); - return xstrdup(ent->d_name); } - closedir(by_path); /* A NULL path isn't really acceptable - use the devname.. */ sprintf(symlink, "/sys/dev/block/%d:%d", disk->disk.major, disk->disk.minor); rv = readlink(symlink, nm, sizeof(nm)-1); ++++++ [email protected] ++++++ --- /var/tmp/diff_new_pack.3Bo0Wb/_old 2014-01-30 12:52:08.000000000 +0100 +++ /var/tmp/diff_new_pack.3Bo0Wb/_new 2014-01-30 12:52:08.000000000 +0100 @@ -1,6 +1,7 @@ [Unit] Description=Timer to wait for more drives before activating degraded array. DefaultDependencies=no +Conflicts=sys-devices-virtual-block-%i.device [Timer] OnActiveSec=30 ++++++ systemd-mdmon-set-IMSM_NO_PLATFORM-1.patch ++++++ >From 67ee238316785481a8ad440e531cae6c4dce36a4 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Tue, 21 Jan 2014 09:46:07 +1100 Subject: [PATCH 12/13] systemd/mdmon: set IMSM_NO_PLATFORM=1 As mdmon doesn't inherit environment from mdadm when it is started by system, it cannot inherit IMSM_NO_PLATFORM. But if an imsm array as assembled then mdmon really should handle it whether there is a platform present or not. So always set this var. Signed-off-by: NeilBrown <[email protected]> --- systemd/[email protected] | 3 +++ 1 file changed, 3 insertions(+) --- mdadm-3.3.orig/systemd/[email protected] +++ mdadm-3.3/systemd/[email protected] @@ -11,6 +11,9 @@ DefaultDependencies=no Before=initrd-switch-root.target [Service] +# 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 --foreground %I StandardInput=null StandardOutput=null ++++++ udev-rules-try-mdadm-I-on-change-events.patch ++++++ >From 25392f5fc59f96fb766ecb5617d5276f8c87d489 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Wed, 11 Dec 2013 12:29:22 +1100 Subject: [PATCH 02/13] udev rules: try "mdadm -I" on "change" events. References: bnc#851993 We need to attempt "mdadm -I" on "change" events as well as "add" events, as the "change" make make a device ready to be part of an array. This is particularly important for stacked md devices. When the member devices are "add"ed they don't have any content visible yet. That doesn't happen until a "change". Idea taken from Fedora udev file. Signed-off-by: NeilBrown <[email protected]> --- udev-md-raid-assembly.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- mdadm-3.3.orig/udev-md-raid-assembly.rules +++ mdadm-3.3/udev-md-raid-assembly.rules @@ -12,8 +12,8 @@ LABEL="md_inc" # remember you can limit what gets auto/incrementally assembled by # mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY' -ACTION=="add", IMPORT{program}="/sbin/mdadm --incremental --export $devnode --offroot ${DEVLINKS}" -ACTION=="add", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer" +ACTION=="add|change", IMPORT{program}="/sbin/mdadm --incremental --export $devnode --offroot ${DEVLINKS}" +ACTION=="add|change", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer" ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}" ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name" -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
