diff --git a/.gitignore b/.gitignore index bbe3088..9fcc1f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/mdadm-3.2.6.tar.xz +SOURCES/mdadm-3.3.2.tar.xz diff --git a/.mdadm.metadata b/.mdadm.metadata index 3b6dc26..36bcfe8 100644 --- a/.mdadm.metadata +++ b/.mdadm.metadata @@ -1 +1 @@ -b2ee8e482c71685d77f1b19c5b9730962aaec448 SOURCES/mdadm-3.2.6.tar.xz +c649601d84553501c2f3b452cf93d1fbc53f976a SOURCES/mdadm-3.3.2.tar.xz diff --git a/SOURCES/mdadm-3.2.4-map-dir.patch b/SOURCES/mdadm-3.2.4-map-dir.patch deleted file mode 100644 index f1e9865..0000000 --- a/SOURCES/mdadm-3.2.4-map-dir.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- mdadm-3.2.4/Makefile.map-dir 2012-05-10 12:29:09.687578525 +0200 -+++ mdadm-3.2.4/Makefile 2012-05-10 12:28:05.514380800 +0200 -@@ -67,12 +67,12 @@ - # Both MAP_DIR and MDMON_DIR should be somewhere that persists across the - # pivotroot from early boot to late boot. - # /run is best, but for distros that don't support that, /dev can work. --MAP_DIR=/run/mdadm --MAP_FILE = map -+MAP_DIR=/dev/md -+MAP_FILE = md-device-map - MAP_PATH = $(MAP_DIR)/$(MAP_FILE) - MDMON_DIR = $(MAP_DIR) - # place for autoreplace cookies --FAILED_SLOTS_DIR = /run/mdadm/failed-slots -+FAILED_SLOTS_DIR = $(MDMON_DIR)/failed-slots - DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\" - DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\" - DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\" diff --git a/SOURCES/mdadm-3.2.6-Add-support-for-launching-mdmon-via-systemctl-instea.patch b/SOURCES/mdadm-3.2.6-Add-support-for-launching-mdmon-via-systemctl-instea.patch deleted file mode 100644 index b7b6dfa..0000000 --- a/SOURCES/mdadm-3.2.6-Add-support-for-launching-mdmon-via-systemctl-instea.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 0f7bdf8946316548500858303549e396655450c5 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 1 Feb 2013 16:15:18 +0100 -Subject: [PATCH 2/4] Add support for launching mdmon via systemctl instead of - fork/exec - -If launching mdmon via systemctl fails, we fall back to the old method -of fork/exec. This allows for having mdmon launched via systemctl -which avoids problems with it getting killed by systemd due to it -ending up in the parent's cgroup (udev). - -Signed-off-by: Jes Sorensen -Signed-off-by: NeilBrown ---- - Makefile | 4 ++++ - systemd/mdmon@.service | 18 ++++++++++++++++++ - util.c | 28 ++++++++++++++++++++++++++++ - 3 files changed, 50 insertions(+) - create mode 100644 systemd/mdmon@.service - -diff --git a/Makefile b/Makefile -index b9787d6..b6edb23 100644 ---- a/Makefile -+++ b/Makefile -@@ -73,6 +73,7 @@ MAP_PATH = $(MAP_DIR)/$(MAP_FILE) - MDMON_DIR = $(MAP_DIR) - # place for autoreplace cookies - FAILED_SLOTS_DIR = /run/mdadm/failed-slots -+SYSTEMD_DIR=/lib/systemd/system - DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\" - DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\" - DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\" -@@ -264,6 +265,9 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8 - install-udev: udev-md-raid.rules - $(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)$(UDEVDIR)/rules.d/64-md-raid.rules - -+install-systemd: systemd/mdmon@.service -+ $(INSTALL) -D -m 644 systemd/mdmon@.service $(DESTDIR)$(SYSTEMD_DIR)/mdmon@.service -+ - uninstall: - rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 $(DESTDIR)$(MAN8DIR)/mdmon.8 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm - -diff --git a/systemd/mdmon@.service b/systemd/mdmon@.service -new file mode 100644 -index 0000000..ddb475f ---- /dev/null -+++ b/systemd/mdmon@.service -@@ -0,0 +1,18 @@ -+# 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 Metadata Monitor on /dev/%I -+DefaultDependencies=no -+Before=initrd-switch-root.target -+ -+[Service] -+ExecStart=/sbin/mdmon %I -+StandardInput=null -+StandardOutput=null -+StandardError=null -+KillMode=none -diff --git a/util.c b/util.c -index e75b754..01af0b5 100644 ---- a/util.c -+++ b/util.c -@@ -1660,6 +1660,34 @@ int start_mdmon(int devnum) - } else - pathbuf[0] = '\0'; - -+ /* First try to run systemctl */ -+ switch(fork()) { -+ case 0: -+ /* FIXME yuk. CLOSE_EXEC?? */ -+ skipped = 0; -+ for (i = 3; skipped < 20; i++) -+ if (close(i) < 0) -+ skipped++; -+ else -+ skipped = 0; -+ -+ snprintf(pathbuf, sizeof(pathbuf), "mdmon@%s.service", -+ devnum2devname(devnum)); -+ status = execl("/usr/bin/systemctl", "systemctl", "start", -+ pathbuf, NULL); -+ status = execl("/bin/systemctl", "systemctl", "start", -+ pathbuf, NULL); -+ exit(1); -+ case -1: fprintf(stderr, Name "cannot run mdmon. " -+ "Array remains readonly\n"); -+ return -1; -+ default: /* parent - good */ -+ pid = wait(&status); -+ if (pid >= 0 && status == 0) -+ return 0; -+ } -+ -+ /* That failed, try running mdmon directly */ - switch(fork()) { - case 0: - /* FIXME yuk. CLOSE_EXEC?? */ --- -1.7.11.7 - diff --git a/SOURCES/mdadm-3.2.6-Add-updating-component_size-to-manager-thread-of-mdm.patch b/SOURCES/mdadm-3.2.6-Add-updating-component_size-to-manager-thread-of-mdm.patch deleted file mode 100644 index bc51a39..0000000 --- a/SOURCES/mdadm-3.2.6-Add-updating-component_size-to-manager-thread-of-mdm.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 4edb8530e889fc7b5e1b5471a0fbfd6c3c116b4a Mon Sep 17 00:00:00 2001 -From: Pawel Baldysiak -Date: Wed, 3 Apr 2013 12:43:42 +1100 -Subject: [PATCH] Add updating component_size to manager thread of mdmon - -Mdmon does not update component_size now. It is wrong because in case -of size's expansion component_size is changed by mdadm but mdmon does not -reread its new value and uses a wrong, old one. As a result the metadata -is incorrect during size's expansion. It contains no information that -resync is in progress (there is no checkpoint too). The metadata is -as if resync has already been finished but it has not. - -Component_size will be set to match information in sysfs. This value -will be updated by manager thread in manage_member() function. -Now mdmon uses the correct, current value of component_size and the -correct metadata (containing information about resync and checkpoint) -is written. - -Signed-off-by: Pawel Baldysiak -Signed-off-by: NeilBrown ---- - managemon.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/managemon.c b/managemon.c -index d155b04..2c55b3c 100644 ---- a/managemon.c -+++ b/managemon.c -@@ -444,6 +444,7 @@ static void manage_member(struct mdstat_ent *mdstat, - char buf[64]; - int frozen; - struct supertype *container = a->container; -+ unsigned long long int component_size = 0; - - if (container == NULL) - /* Raced with something */ -@@ -453,6 +454,9 @@ static void manage_member(struct mdstat_ent *mdstat, - a->info.array.raid_disks = mdstat->raid_disks; - // MORE - -+ if (sysfs_get_ll(&a->info, NULL, "component_size", &component_size) >= 0) -+ a->info.component_size = component_size << 1; -+ - /* honor 'frozen' */ - if (sysfs_get_str(&a->info, NULL, "metadata_version", buf, sizeof(buf)) > 0) - frozen = buf[9] == '-'; --- -1.8.1.4 - diff --git a/SOURCES/mdadm-3.2.6-Create.c-check-if-freesize-is-equal-0.patch b/SOURCES/mdadm-3.2.6-Create.c-check-if-freesize-is-equal-0.patch deleted file mode 100644 index 59ad001..0000000 --- a/SOURCES/mdadm-3.2.6-Create.c-check-if-freesize-is-equal-0.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 066e92f017df22c879c455494d2c1743ef7f3aca Mon Sep 17 00:00:00 2001 -From: Lukasz Dorau -Date: Fri, 16 Nov 2012 17:24:36 +0100 -Subject: [PATCH] Create.c: check if freesize is equal 0 - -"freesize" can be equal 0, particularly after rounding to the chunk's size. -Creating should be aborted in such case. - -Signed-off-by: Lukasz Dorau -Signed-off-by: NeilBrown ---- - Create.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/Create.c b/Create.c -index afcf1a5..436bd1d 100644 ---- a/Create.c -+++ b/Create.c -@@ -407,6 +407,11 @@ - do_default_chunk = 0; - } - } -+ if (!freesize) { -+ fprintf(stderr, Name ": no free space left on %s\n", dname); -+ fail = 1; -+ continue; -+ } - - if (size && freesize < size) { - fprintf(stderr, Name ": %s is smaller than given size." diff --git a/SOURCES/mdadm-3.2.6-Don-t-lie-to-systemd-about-mdadm-s-status.patch b/SOURCES/mdadm-3.2.6-Don-t-lie-to-systemd-about-mdadm-s-status.patch deleted file mode 100644 index ff7a2b4..0000000 --- a/SOURCES/mdadm-3.2.6-Don-t-lie-to-systemd-about-mdadm-s-status.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 879982efa90c8cf6b7afc708316cf47c4247bfe3 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 1 Aug 2013 14:04:07 +1000 -Subject: [PATCH] Don't lie to systemd about mdadm's status. - -Telling systemd that mdadm was started from the initrd -is often a lie and never necessary. Now that the reshape monitoring -thread handles SIGTERM gracefully it is OK for system to kill -and mdadm that it finds running. - -mdmon still have a bit of a question mark over it so I won't remove -the '@' from there just yet. - -Signed-off-by: NeilBrown ---- - mdadm.c | 7 ------- - 1 file changed, 7 deletions(-) - -diff --git a/mdadm.c b/mdadm.c -index a46a716..86a4fad 100644 ---- a/mdadm.c -+++ b/mdadm.c -@@ -116,13 +116,6 @@ int main(int argc, char *argv[]) - ident.container = NULL; - ident.member = NULL; - -- /* -- * set first char of argv[0] to @. This is used by -- * systemd to signal that the task was launched from -- * initrd/initramfs and should be preserved during shutdown -- */ -- argv[0][0] = '@'; -- - while ((option_index = -1) , - (opt=getopt_long(argc, argv, - shortopt, long_options, --- -1.8.4.2 - diff --git a/SOURCES/mdadm-3.2.6-Fix-is_resync_complete-for-RAID10.patch b/SOURCES/mdadm-3.2.6-Fix-is_resync_complete-for-RAID10.patch deleted file mode 100644 index a82fb42..0000000 --- a/SOURCES/mdadm-3.2.6-Fix-is_resync_complete-for-RAID10.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 71d68ff62f945254240575cd836f5f2a09ced5d2 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Wed, 31 Jul 2013 09:18:57 +1000 -Subject: [PATCH] Fix is_resync_complete for RAID10 - -For RAID10, 'sync' numbers go up to the array size rather than the -component size. is_resync_complete() needs to allow for this. - -Reported-by: Pawel Baldysiak -Signed-off-by: NeilBrown ---- - mdmon.h | 20 +++++++++++++++++--- - 1 file changed, 17 insertions(+), 3 deletions(-) - -diff --git a/mdmon.h b/mdmon.h -index 60fda38..5a8e120 100644 ---- a/mdmon.h -+++ b/mdmon.h -@@ -91,8 +91,22 @@ extern int monitor_loop_cnt; - */ - static inline int is_resync_complete(struct mdinfo *array) - { -- if (array->resync_start >= array->component_size) -- return 1; -- return 0; -+ unsigned long long sync_size = 0; -+ int ncopies, l; -+ switch(array->array.level) { -+ case 1: -+ case 4: -+ case 5: -+ case 6: -+ sync_size = array->component_size; -+ break; -+ case 10: -+ l = array->array.layout; -+ ncopies = (l & 0xff) * ((l >> 8) && 0xff); -+ sync_size = array->component_size * array->array.raid_disks; -+ sync_size /= ncopies; -+ break; -+ } -+ return array->resync_start >= sync_size; - } - diff --git a/SOURCES/mdadm-3.2.6-Grow-exit-background-thread-cleanly-on-SIGTERM.patch b/SOURCES/mdadm-3.2.6-Grow-exit-background-thread-cleanly-on-SIGTERM.patch deleted file mode 100644 index e6b4cca..0000000 --- a/SOURCES/mdadm-3.2.6-Grow-exit-background-thread-cleanly-on-SIGTERM.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 84d11e6c6a3b827b2daa32e16303235ce33d49f5 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 1 Aug 2013 11:16:14 +1000 -Subject: [PATCH] Grow: exit background thread cleanly on SIGTERM. - -If the mdadm thread that monitors a reshape gets SIGTERM it should -exit cleanly and clear the 'suspended' region of the array. -However it mustn't clear 'sync_max' as that would allow the -reshape to continue unmonitored. - -If the thread ever does get killed, the array should really be -shutdown soon after if possible. - -Signed-off-by: NeilBrown ---- - Grow.c | 15 +++++++++++++-- - super-intel.c | 2 ++ - 2 files changed, 15 insertions(+), 2 deletions(-) - -diff --git a/Grow.c b/Grow.c -index ff4ed5d..ce80c52 100644 ---- a/Grow.c -+++ b/Grow.c -@@ -24,6 +24,7 @@ - #include "mdadm.h" - #include "dlink.h" - #include -+#include - - #if ! defined(__BIG_ENDIAN) && ! defined(__LITTLE_ENDIAN) - #error no endian defined -@@ -729,7 +730,8 @@ void abort_reshape(struct mdinfo *sra) - sysfs_set_num(sra, NULL, "suspend_hi", 0); - sysfs_set_num(sra, NULL, "suspend_lo", 0); - sysfs_set_num(sra, NULL, "sync_min", 0); -- sysfs_set_str(sra, NULL, "sync_max", "max"); -+ // It isn't safe to reset sync_max as we aren't monitoring. -+ // Array really should be stopped at this point. - } - - int remove_disks_for_takeover(struct supertype *st, -@@ -2726,6 +2728,12 @@ static int impose_level(int fd, int level, char *devname, int verbose) - return ret_val; - } - -+int sigterm = 0; -+static void catch_term(int sig) -+{ -+ sigterm = 1; -+} -+ - static int reshape_array(char *container, int fd, char *devname, - struct supertype *st, struct mdinfo *info, - int force, struct mddev_dev *devlist, -@@ -3260,6 +3268,8 @@ started: - fd = -1; - mlockall(MCL_FUTURE); - -+ signal(SIGTERM, catch_term); -+ - if (st->ss->external) { - /* metadata handler takes it from here */ - done = st->ss->manage_reshape( -@@ -4243,7 +4253,8 @@ int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape, - forget_backup(dests, destfd, - destoffsets, 1); - } -- -+ if (sigterm) -+ rv = -2; - if (rv < 0) { - if (rv == -1) - done = 1; -diff --git a/super-intel.c b/super-intel.c -index 4df33f4..7b24068 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -10444,6 +10444,8 @@ static int imsm_manage_reshape( - dprintf("wait_for_reshape_imsm returned error!\n"); - goto abort; - } -+ if (sigterm) -+ goto abort; - - if (save_checkpoint_imsm(st, sra, UNIT_SRC_NORMAL) == 1) { - /* ignore error == 2, this can mean end of reshape here --- -1.8.4.2 - diff --git a/SOURCES/mdadm-3.2.6-IMSM-don-t-crash-when-creating-an-array-with-missing.patch b/SOURCES/mdadm-3.2.6-IMSM-don-t-crash-when-creating-an-array-with-missing.patch deleted file mode 100644 index 2f419cc..0000000 --- a/SOURCES/mdadm-3.2.6-IMSM-don-t-crash-when-creating-an-array-with-missing.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 1ca5c8e0c74946f4fcd74e97c5f48fba482d9596 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Tue, 21 Jan 2014 09:40:02 +1100 -Subject: [PATCH] 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 ---- - super-intel.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/super-intel.c b/super-intel.c -index c103ffd..f0a7ab5 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -5210,6 +5210,8 @@ static int create_array(struct supertype *st, int dev_idx) - 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); --- -1.8.5.3 - diff --git a/SOURCES/mdadm-3.2.6-In-case-launching-mdmon-fails-print-an-error-message.patch b/SOURCES/mdadm-3.2.6-In-case-launching-mdmon-fails-print-an-error-message.patch deleted file mode 100644 index b9dd836..0000000 --- a/SOURCES/mdadm-3.2.6-In-case-launching-mdmon-fails-print-an-error-message.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 15c10423aa9435ed72bd292fecca69224a20fdc8 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 1 Feb 2013 16:15:19 +0100 -Subject: [PATCH 3/4] In case launching mdmon fails, print an error message - before exiting - -Signed-off-by: Jes Sorensen -Signed-off-by: NeilBrown ---- - util.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/util.c b/util.c -index 01af0b5..8817a3e 100644 ---- a/util.c -+++ b/util.c -@@ -1709,8 +1709,11 @@ int start_mdmon(int devnum) - return -1; - default: /* parent - good */ - pid = wait(&status); -- if (pid < 0 || status != 0) -+ if (pid < 0 || status != 0) { -+ fprintf(stderr, Name "failed to launch mdmon. " -+ "Array remains readonly\n"); - return -1; -+ } - } - return 0; - } --- -1.7.11.7 - diff --git a/SOURCES/mdadm-3.2.6-Manage_runstop-call-flush_mdmon-if-O_EXCL-fails-on-s.patch b/SOURCES/mdadm-3.2.6-Manage_runstop-call-flush_mdmon-if-O_EXCL-fails-on-s.patch deleted file mode 100644 index a13e8fa..0000000 --- a/SOURCES/mdadm-3.2.6-Manage_runstop-call-flush_mdmon-if-O_EXCL-fails-on-s.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 2fdf559d74a48806900b63f1b4504a18dec048a9 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Mon, 22 Apr 2013 17:05:33 +1000 -Subject: [PATCH] Manage_runstop: call flush_mdmon if O_EXCL fails on stopping - mdmon array. - -When stopping an mdmon array, at reshape might be being aborted -which inhibets O_EXCL. So if that is possible, call flush_mdmon -to make sure mdmon isn't still busy. - -Reported-by: Pawel Baldysiak -Signed-off-by: NeilBrown ---- - Manage.c | 29 ++++++++++++++++++++++++----- - 1 file changed, 24 insertions(+), 5 deletions(-) - -diff --git a/Manage.c b/Manage.c -index e3d3041..e37f415 100644 ---- a/Manage.c -+++ b/Manage.c -@@ -221,8 +222,19 @@ int Manage_runstop(char *devname, int fd, int runstop, - /* Get EXCL access first. If this fails, then attempting - * to stop is probably a bad idea. - */ -- close(fd); -- fd = open(devname, O_RDONLY|O_EXCL); -+ mdi = sysfs_read(fd, -1, GET_LEVEL|GET_VERSION); -+ close(fd); -+ count = 5; -+ while (((fd = open(devname, O_RDONLY|O_EXCL)) < 0 -+ || fd2devnum(fd) != devnum) -+ && mdi && !is_subarray(mdi->text_version) -+ && mdmon_running(devname2devnum(mdi->sys_name)) -+ && count) { -+ if (fd >= 0) -+ close(fd); -+ flush_mdmon(mdi->sys_name); -+ count--; -+ } - if (fd < 0 || fd2devnum(fd) != devnum) { - if (fd >= 0) - close(fd); -@@ -237,7 +257,6 @@ int Manage_runstop(char *devname, int fd, int runstop, - devname); - return 1; - } -- mdi = sysfs_read(fd, -1, GET_LEVEL|GET_VERSION); - if (mdi && - mdi->array.level > 0 && - is_subarray(mdi->text_version)) { - --- -1.8.3.1 - diff --git a/SOURCES/mdadm-3.2.6-Monitor-Don-t-write-metadata-in-inactive-array-state.patch b/SOURCES/mdadm-3.2.6-Monitor-Don-t-write-metadata-in-inactive-array-state.patch deleted file mode 100644 index 39dbaed..0000000 --- a/SOURCES/mdadm-3.2.6-Monitor-Don-t-write-metadata-in-inactive-array-state.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 24a216bf408db4ec61ec6f735d1eb84a0618bfbb Mon Sep 17 00:00:00 2001 -From: "mwilck@arcor.de" -Date: Mon, 8 Jul 2013 23:50:38 +0200 -Subject: [PATCH] Monitor: Don't write metadata in inactive array state - -The kernel docs state that meta data is never written in states -clear, inactive, suspended, readonly, and read_auto. -Why should this be different for containers? - -We need to write metadata when the array is disabled, though. -Tested with the DDF (10*) and IMSM (9*) tests, works. - -Signed-off-by: NeilBrown ---- - monitor.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/monitor.c b/monitor.c -index 47432b2..67b40b1 100644 ---- a/monitor.c -+++ b/monitor.c -@@ -416,7 +416,8 @@ static int read_and_act(struct active_array *a) - if (sync_completed > a->last_checkpoint) - a->last_checkpoint = sync_completed; - -- a->container->ss->sync_metadata(a->container); -+ if (deactivate || a->curr_state >= clean) -+ a->container->ss->sync_metadata(a->container); - dprintf("%s(%d): state:%s action:%s next(", __func__, a->info.container_member, - array_states[a->curr_state], sync_actions[a->curr_action]); - --- -1.8.3.1 - diff --git a/SOURCES/mdadm-3.2.6-Remove-offroot-argument-and-default-to-always-settin.patch b/SOURCES/mdadm-3.2.6-Remove-offroot-argument-and-default-to-always-settin.patch deleted file mode 100644 index 66975dc..0000000 --- a/SOURCES/mdadm-3.2.6-Remove-offroot-argument-and-default-to-always-settin.patch +++ /dev/null @@ -1,214 +0,0 @@ -From 3e23ba9d7bd3c2a9fbddc286014480672763e563 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 1 Feb 2013 16:15:17 +0100 -Subject: [PATCH 1/4] Remove --offroot argument and default to always setting - argv[0] to @ - -We still allow --offroot to be given - for compatibility with scripts -- but ignore it. - -The whole point of --offroot is to get systemd to not auto-kill mdmon, -and we always want that. - -Signed-off-by: Jes Sorensen -Signed-off-by: NeilBrown ---- - ReadMe.c | 4 ---- - mdadm.8.in | 11 ----------- - mdadm.c | 15 ++++++++------- - mdadm.h | 2 -- - mdmon.8 | 11 +---------- - mdmon.c | 14 ++++++-------- - util.c | 13 ++----------- - 7 files changed, 17 insertions(+), 53 deletions(-) - -diff --git a/ReadMe.c b/ReadMe.c -index 4214cb0..c4bb730 100644 ---- a/ReadMe.c -+++ b/ReadMe.c -@@ -259,10 +259,6 @@ char OptionHelp[] = - " --query -Q : Display general information about how a\n" - " device relates to the md driver\n" - " --auto-detect : Start arrays auto-detected by the kernel\n" --" --offroot : Set first character of argv[0] to @ to indicate the\n" --" application was launched from initrd/initramfs and\n" --" should not be shutdown by systemd as part of the\n" --" regular shutdown process.\n" - ; - /* - "\n" -diff --git a/mdadm.8.in b/mdadm.8.in -index c1881cd..a3abc2d 100644 ---- a/mdadm.8.in -+++ b/mdadm.8.in -@@ -255,17 +255,6 @@ Avoid printing purely informative messages. With this, - .I mdadm - will be silent unless there is something really important to report. - --.TP --.BR \-\-offroot --Set first character of argv[0] to @ to indicate mdadm was launched --from initrd/initramfs and should not be shutdown by systemd as part of --the regular shutdown process. This option is normally only used by --the system's initscripts. Please see here for more details on how --systemd handled argv[0]: --.IP --.B http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons --.PP -- - - .TP - .BR \-f ", " \-\-force -diff --git a/mdadm.c b/mdadm.c -index 26e8cec..f22fd7b 100644 ---- a/mdadm.c -+++ b/mdadm.c -@@ -116,6 +116,13 @@ int main(int argc, char *argv[]) - ident.container = NULL; - ident.member = NULL; - -+ /* -+ * set first char of argv[0] to @. This is used by -+ * systemd to signal that the task was launched from -+ * initrd/initramfs and should be preserved during shutdown -+ */ -+ argv[0][0] = '@'; -+ - while ((option_index = -1) , - (opt=getopt_long(argc, argv, - shortopt, long_options, -@@ -159,14 +166,8 @@ int main(int argc, char *argv[]) - homehost = optarg; - continue; - -- /* -- * --offroot sets first char of argv[0] to @. This is used -- * by systemd to signal that the tast was launched from -- * initrd/initramfs and should be preserved during shutdown -- */ - case OffRootOpt: -- argv[0][0] = '@'; -- __offroot = 1; -+ /* Silently ignore old option */ - continue; - - case Prefer: -diff --git a/mdadm.h b/mdadm.h -index be760d2..a761f29 100644 ---- a/mdadm.h -+++ b/mdadm.h -@@ -1487,5 +1487,3 @@ char *xstrdup(const char *str); - * v1.x can support 1920 - */ - #define MAX_DISKS 4096 -- --extern int __offroot; -diff --git a/mdmon.8 b/mdmon.8 -index 598d904..559dd90 100644 ---- a/mdmon.8 -+++ b/mdmon.8 -@@ -5,7 +5,7 @@ mdmon \- monitor MD external metadata arrays - - .SH SYNOPSIS - --.BI mdmon " [--all] [--takeover] [--offroot] CONTAINER" -+.BI mdmon " [--all] [--takeover] CONTAINER" - - .SH OVERVIEW - The 2.6.27 kernel brings the ability to support external metadata arrays. -@@ -166,15 +166,6 @@ containers with names longer than 5 characters, this argument can be - arbitrarily extended, e.g. to - .BR \-\-all-active-arrays . - .TP --.BR \-\-offroot --Set first character of argv[0] to @ to indicate mdmon was launched --from initrd/initramfs and should not be shutdown by systemd as part of --the regular shutdown process. This option is normally only used by --the system's initscripts. Please see here for more details on how --systemd handled argv[0]: --.IP --.B http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons --.PP - - .PP - Note that -diff --git a/mdmon.c b/mdmon.c -index 5d5ae94..8720aa5 100644 ---- a/mdmon.c -+++ b/mdmon.c -@@ -184,9 +184,6 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock) - buf[sizeof(buf)-1] = 0; - close(fd); - -- /* Note that if started with --offroot, the name -- * might be "@dmon" -- */ - if (n < 0 || !(strstr(buf, "mdmon") || - strstr(buf, "@dmon"))) - return; -@@ -276,10 +273,6 @@ void usage(void) - " --help -h : This message\n" - " --all : All devices\n" - " --takeover -t : Takeover container\n" --" --offroot : Set first character of argv[0] to @ to indicate the\n" --" application was launched from initrd/initramfs and\n" --" should not be shutdown by systemd as part of the\n" --" regular shutdown process.\n" - ); - exit(2); - } -@@ -303,6 +296,11 @@ int main(int argc, char *argv[]) - {NULL, 0, NULL, 0} - }; - -+ /* -+ * Always change process name to @dmon to avoid systemd killing it -+ */ -+ argv[0][0] = '@'; -+ - while ((opt = getopt_long(argc, argv, "tha", options, NULL)) != -1) { - switch (opt) { - case 'a': -@@ -313,7 +311,7 @@ int main(int argc, char *argv[]) - takeover = 1; - break; - case OffRootOpt: -- argv[0][0] = '@'; -+ /* silently ignore old option */ - break; - case 'h': - default: -diff --git a/util.c b/util.c -index fc9043b..e75b754 100644 ---- a/util.c -+++ b/util.c -@@ -32,8 +32,6 @@ - #include - #include - --int __offroot; -- - /* - * following taken from linux/blkpg.h because they aren't - * anywhere else and it isn't safe to #include linux/ * stuff. -@@ -1674,15 +1672,8 @@ int start_mdmon(int devnum) - - for (i=0; paths[i]; i++) - if (paths[i][0]) { -- if (__offroot) { -- execl(paths[i], "mdmon", "--offroot", -- devnum2devname(devnum), -- NULL); -- } else { -- execl(paths[i], "mdmon", -- devnum2devname(devnum), -- NULL); -- } -+ execl(paths[i], "mdmon", -+ devnum2devname(devnum), NULL); - } - exit(1); - case -1: fprintf(stderr, Name ": cannot run mdmon. " --- -1.7.11.7 - diff --git a/SOURCES/mdadm-3.2.6-imsm-Forbid-spanning-between-multiple-controllers.patch b/SOURCES/mdadm-3.2.6-imsm-Forbid-spanning-between-multiple-controllers.patch deleted file mode 100644 index b5959ae..0000000 --- a/SOURCES/mdadm-3.2.6-imsm-Forbid-spanning-between-multiple-controllers.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 3c309c82699ae3bebc716dbd5abea079dd41184a Mon Sep 17 00:00:00 2001 -From: Marcin Tomczak -Date: Fri, 9 Nov 2012 15:46:36 +0100 -Subject: [PATCH] imsm: Forbid spanning between multiple controllers. - -Attaching disks to multiple controllers of the same type has been -allowed so far. Now spanning between multiple controllers is disallowed -at all by IMSM metadata. - -Signed-off-by: Marcin Tomczak -Reviewed-by: Lukasz Dorau -Signed-off-by: NeilBrown ---- - super-intel.c | 25 ++++++++----------------- - 1 file changed, 8 insertions(+), 17 deletions(-) - -diff --git a/super-intel.c b/super-intel.c -index 202b83f..4ac9d42 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -558,20 +558,11 @@ static int attach_hba_to_super(struct intel_super *super, struct sys_dev *device - if (super->hba == NULL) { - super->hba = alloc_intel_hba(device); - return 1; -- } -- -- hba = super->hba; -- /* Intel metadata allows for all disks attached to the same type HBA. -- * Do not sypport odf HBA types mixing -- */ -- if (device->type != hba->type) -+ } else -+ /* IMSM metadata disallows to attach disks to multiple -+ * controllers. -+ */ - return 2; -- -- while (hba->next) -- hba = hba->next; -- -- hba->next = alloc_intel_hba(device); -- return 1; - } - - static struct sys_dev* find_disk_attached_hba(int fd, const char *devname) -@@ -3073,11 +3064,11 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst) - */ - if (!check_env("IMSM_NO_PLATFORM")) { -- if (!first->hba || !sec->hba || -- (first->hba->type != sec->hba->type)) { -+ if (first->hba && sec->hba && -+ strcmp(first->hba->path, sec->hba->path) != 0) { - fprintf(stderr, - "HBAs of devices does not match %s != %s\n", -- first->hba ? get_sys_dev_type(first->hba->type) : NULL, -- sec->hba ? get_sys_dev_type(sec->hba->type) : NULL); -+ first->hba ? first->hba->path : NULL, -+ sec->hba ? sec->hba->path : NULL); - return 3; - } - } -@@ -3819,7 +3810,7 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de - } - - fprintf(stderr, ").\n" -- " Mixing devices attached to different controllers " -+ " Mixing devices attached to multiple controllers " - "is not allowed.\n"); - } - free_sys_dev(&hba_name); --- -1.7.11.7 - diff --git a/SOURCES/mdadm-3.2.6-imsm-improved-platform-capabilities-checking.patch b/SOURCES/mdadm-3.2.6-imsm-improved-platform-capabilities-checking.patch deleted file mode 100644 index f6b7ee0..0000000 --- a/SOURCES/mdadm-3.2.6-imsm-improved-platform-capabilities-checking.patch +++ /dev/null @@ -1,140 +0,0 @@ -From d71612d0bdfa0da58261b970a5188c98b1412c6e Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Fri, 28 Feb 2014 11:29:28 +0100 -Subject: [PATCH 2/2] imsm: improved platform capabilities checking - -This patch ensures that on Intel platforms only AHCI controllers with -RAID mode enabled are seen as IMSM capable by mdadm. - -Signed-off-by: Artur Paszkiewicz -Reviewed-by: Lukasz Dorau ---- - platform-intel.c | 16 +++++++++++++--- - platform-intel.h | 3 ++- - super-intel.c | 13 ++++++------- - 3 files changed, 21 insertions(+), 11 deletions(-) - -diff --git a/platform-intel.c b/platform-intel.c -index 77f8639..3d4d9c7 100644 ---- a/platform-intel.c -+++ b/platform-intel.c -@@ -59,6 +59,7 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver) - struct sys_dev *list = NULL; - enum sys_dev_type type; - unsigned long long dev_id; -+ unsigned long long class; - - if (strcmp(driver, "isci") == 0) - type = SYS_DEV_SAS; -@@ -99,6 +100,9 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver) - if (devpath_to_ll(path, "device", &dev_id) != 0) - continue; - -+ if (devpath_to_ll(path, "class", &class) != 0) -+ continue; -+ - /* start / add list entry */ - if (!head) { - head = malloc(sizeof(*head)); -@@ -114,6 +118,7 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver) - } - - list->dev_id = (__u16) dev_id; -+ list->class = (__u32) class; - list->type = type; - list->path = canonicalize_file_name(path); - list->next = NULL; -@@ -348,6 +353,8 @@ static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id) - #define VENDOR_GUID \ - EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, 0x1a, 0x04, 0xc6) - -+#define PCI_CLASS_RAID_CNTRL 0x010400 -+ - int populated_efi[SYS_DEV_MAX] = { 0, 0 }; - - static struct imsm_orom imsm_efi[SYS_DEV_MAX]; -@@ -445,14 +452,16 @@ const struct imsm_orom *find_imsm_orom(void) - return find_imsm_hba_orom(SYS_DEV_SATA); - } - --const struct imsm_orom *find_imsm_capability(enum sys_dev_type hba_id) -+const struct imsm_orom *find_imsm_capability(struct sys_dev *hba) - { - const struct imsm_orom *cap=NULL; - -- -- if ((cap = find_imsm_efi(hba_id)) != NULL) -+ if (hba->type == SYS_DEV_SATA && hba->class != PCI_CLASS_RAID_CNTRL) -+ return NULL; -+ -+ if ((cap = find_imsm_efi(hba->type)) != NULL) - return cap; -- if ((cap = find_imsm_hba_orom(hba_id)) != NULL) -+ if ((cap = find_imsm_hba_orom(hba->type)) != NULL) - return cap; - return NULL; - } -diff --git a/platform-intel.h b/platform-intel.h -index bcd84b7..6887097 100644 ---- a/platform-intel.h -+++ b/platform-intel.h -@@ -180,6 +180,7 @@ struct sys_dev { - char *path; - char *pci_id; - __u16 dev_id; -+ __u32 class; - struct sys_dev *next; - }; - -@@ -202,9 +202,9 @@ static inline char *guid_str(char *buf, struct efi_guid guid) - char *diskfd_to_devpath(int fd); - struct sys_dev *find_driver_devices(const char *bus, const char *driver); - struct sys_dev *find_intel_devices(void); - void free_sys_dev(struct sys_dev **list); --const struct imsm_orom *find_imsm_capability(enum sys_dev_type hba_id); -+const struct imsm_orom *find_imsm_capability(struct sys_dev *hba); - const struct imsm_orom *find_imsm_orom(void); - int disk_attached_to_hba(int fd, const char *hba_path); - char *devt_to_devpath(dev_t dev); - int path_attached_to_hba(const char *disk_path, const char *hba_path); -diff --git a/super-intel.c b/super-intel.c -index f0a7ab5..b21fe67 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -1886,12 +1886,13 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle - if (!list) - return 2; - for (hba = list; hba; hba = hba->next) { -- orom = find_imsm_capability(hba->type); -- if (!orom) { -- result = 2; -+ if (find_imsm_capability(hba)) { -+ result = 0; - break; - } -+ else -+ result = 2; - } - free_sys_dev(&list); - return result; - } -@@ -1909,7 +1908,7 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle - print_found_intel_controllers(list); - - for (hba = list; hba; hba = hba->next) { -- orom = find_imsm_capability(hba->type); -+ orom = find_imsm_capability(hba); - if (!orom) - fprintf(stderr, Name ": imsm capabilities not found for controller: %s (type %s)\n", - hba->path, get_sys_dev_type(hba->type)); -@@ -3839,9 +3838,9 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de - } - free_sys_dev(&hba_name); - return 2; - } -- super->orom = find_imsm_capability(hba_name->type); -+ super->orom = find_imsm_capability(hba_name); - free_sys_dev(&hba_name); - if (!super->orom) - return 3; - return 0; diff --git a/SOURCES/mdadm-3.2.6-imsm-monitor-do-not-finish-migration-if-there-are-no.patch b/SOURCES/mdadm-3.2.6-imsm-monitor-do-not-finish-migration-if-there-are-no.patch deleted file mode 100644 index 202f61e..0000000 --- a/SOURCES/mdadm-3.2.6-imsm-monitor-do-not-finish-migration-if-there-are-no.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 79b68f1b48b0967da999945e310aef628c9bca4c Mon Sep 17 00:00:00 2001 -From: Przemyslaw Czarnowski -Date: Thu, 18 Apr 2013 10:51:37 +0200 -Subject: [PATCH] imsm: monitor: do not finish migration if there are no failed - disks - -Transition from "degraded" to "recovery" made in OROM is slightly different -than the same transision in mdadm. Missing disk is not removed from list of -raid devices, but just from map. Therefore mdadm should not end migration -basing on existence of list of missing disks but should rely on count of -failed disks. - -Signed-off-by: Przemyslaw Czarnowski -Tested-by: Pawel Baldysiak -Signed-off-by: NeilBrown ---- - super-intel.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/super-intel.c b/super-intel.c -index 24016b7..3f15b0f 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -6886,6 +6886,12 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev) - if (!super->missing) - return; - -+ /* When orom adds replacement for missing disk it does -+ * not remove entry of missing disk, but just updates map with -+ * new added disk. So it is not enough just to test if there is -+ * any missing disk, we have to look if there are any failed disks -+ * in map to stop migration */ -+ - dprintf("imsm: mark missing\n"); - /* end process for initialization and rebuild only - */ -@@ -6896,7 +6902,8 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev) - failed = imsm_count_failed(super, dev, MAP_0); - map_state = imsm_check_degraded(super, dev, failed, MAP_0); - -- end_migration(dev, super, map_state); -+ if (failed) -+ end_migration(dev, super, map_state); - } - for (dl = super->missing; dl; dl = dl->next) - mark_missing(dev, &dl->disk, dl->index); --- -1.8.1.4 - diff --git a/SOURCES/mdadm-3.2.6-imsm-support-for-second-AHCI-controller-in-EFI-mode.patch b/SOURCES/mdadm-3.2.6-imsm-support-for-second-AHCI-controller-in-EFI-mode.patch deleted file mode 100644 index a63210a..0000000 --- a/SOURCES/mdadm-3.2.6-imsm-support-for-second-AHCI-controller-in-EFI-mode.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 70f82e7201fd2d85b99113395e386f7e4923e276 Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Fri, 28 Feb 2014 11:29:27 +0100 -Subject: [PATCH 1/2] imsm: support for second AHCI controller in EFI mode - -mdadm was unable to find IMSM platform capabilities when only the second -AHCI controller was enabled on a platform in EFI mode. The second AHCI -controller uses a different EFI variable and this patch adds support for -reading this variable. - -Signed-off-by: Artur Paszkiewicz -Reviewed-by: Lukasz Dorau ---- - platform-intel.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/platform-intel.c b/platform-intel.c -index f347382..77f8639 100644 ---- a/platform-intel.c -+++ b/platform-intel.c -@@ -343,6 +343,7 @@ static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id) - #define SYS_EFI_VAR_PATH "/sys/firmware/efi/vars" - #define SCU_PROP "RstScuV" - #define AHCI_PROP "RstSataV" -+#define AHCI_SSATA_PROP "RstsSatV" - - #define VENDOR_GUID \ - EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, 0x1a, 0x04, 0xc6) -@@ -397,6 +398,8 @@ int read_efi_variable(void *buffer, ssize_t buf_size, char *variable_name, struc - - const struct imsm_orom *find_imsm_efi(enum sys_dev_type hba_id) - { -+ int err; -+ - if (hba_id >= SYS_DEV_MAX) - return NULL; - -@@ -419,7 +422,13 @@ const struct imsm_orom *find_imsm_efi(enum sys_dev_type hba_id) - if (check_env("IMSM_TEST_OROM")) - return NULL; - -- if (read_efi_variable(&imsm_efi[hba_id], sizeof(imsm_efi[0]), hba_id == SYS_DEV_SAS ? SCU_PROP : AHCI_PROP, VENDOR_GUID)) { -+ err = read_efi_variable(&imsm_efi[hba_id], sizeof(imsm_efi[0]), hba_id == SYS_DEV_SAS ? SCU_PROP : AHCI_PROP, VENDOR_GUID); -+ -+ /* try to read variable for second AHCI controller */ -+ if (err && hba_id == SYS_DEV_SATA) -+ err = read_efi_variable(&imsm_efi[hba_id], sizeof(imsm_efi[0]), AHCI_SSATA_PROP, VENDOR_GUID); -+ -+ if (err) { - populated_efi[hba_id] = 0; - return NULL; - } --- -1.8.5.3 - diff --git a/SOURCES/mdadm-3.2.6-in_initrd-fix-gcc-compiler-error.patch b/SOURCES/mdadm-3.2.6-in_initrd-fix-gcc-compiler-error.patch deleted file mode 100644 index 3df3da2..0000000 --- a/SOURCES/mdadm-3.2.6-in_initrd-fix-gcc-compiler-error.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 7ac5d47e8ab465cb2321eaceb3a0f62748312ffe Mon Sep 17 00:00:00 2001 -From: "mwilck@arcor.de" -Date: Fri, 16 Aug 2013 20:21:59 +0200 -Subject: [PATCH] in_initrd: fix gcc compiler error - -On some systems, this code caused a "comparison between signed -and unsigned" error. - -Signed-off-by: Martin Wilck -Signed-off-by: NeilBrown ---- - util.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/util.c b/util.c -index 8096e29..491a107 100644 ---- a/util.c -+++ b/util.c -@@ -1949,6 +1949,6 @@ int in_initrd(void) - /* This is based on similar function in systemd. */ - struct statfs s; - return statfs("/", &s) >= 0 && -- (s.f_type == TMPFS_MAGIC || -- s.f_type == RAMFS_MAGIC); -+ ((unsigned long)s.f_type == TMPFS_MAGIC || -+ (unsigned long)s.f_type == RAMFS_MAGIC); - } --- -1.8.4.2 - 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 deleted file mode 100644 index 8e130b7..0000000 --- a/SOURCES/mdadm-3.2.6-mdmon-.service-Change-type-of-process-start-up-to-fo.patch +++ /dev/null @@ -1,41 +0,0 @@ -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-add-foreground-option.patch b/SOURCES/mdadm-3.2.6-mdmon-add-foreground-option.patch deleted file mode 100644 index 36ce25e..0000000 --- a/SOURCES/mdadm-3.2.6-mdmon-add-foreground-option.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 030419821fb77f9955f2017b4a6d3d8139d6db25 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Tue, 5 Feb 2013 15:57:09 +1100 -Subject: [PATCH 4/4] mdmon: add --foreground option - -While not strictly necessary for systemd, it is cleaner to avoid -forking when running from a management daemon. So add a --foreground -option to mdmon. - -Signed-off-by: NeilBrown ---- - mdmon.8 | 10 +++++++++- - mdmon.c | 9 +++++++-- - systemd/mdmon@.service | 2 +- - 3 files changed, 17 insertions(+), 4 deletions(-) - -diff --git a/mdmon.8 b/mdmon.8 -index 559dd90..a968cdb 100644 ---- a/mdmon.8 -+++ b/mdmon.8 -@@ -5,7 +5,7 @@ mdmon \- monitor MD external metadata arrays - - .SH SYNOPSIS - --.BI mdmon " [--all] [--takeover] CONTAINER" -+.BI mdmon " [--all] [--takeover] [--foreground] CONTAINER" - - .SH OVERVIEW - The 2.6.27 kernel brings the ability to support external metadata arrays. -@@ -131,6 +131,14 @@ The - device to monitor. It can be a full path like /dev/md/container, or a - simple md device name like md127. - .TP -+.B \-\-foreground -+Normally, -+.I mdmon -+will fork and continue in the background. Adding this option will -+skip that step and run -+.I mdmon -+in the foreground. -+.TP - .B \-\-takeover - This instructs - .I mdmon -diff --git a/mdmon.c b/mdmon.c -index 8720aa5..007071b 100644 ---- a/mdmon.c -+++ b/mdmon.c -@@ -288,11 +288,13 @@ int main(int argc, char *argv[]) - int opt; - int all = 0; - int takeover = 0; -+ int dofork = 1; - static struct option options[] = { - {"all", 0, NULL, 'a'}, - {"takeover", 0, NULL, 't'}, - {"help", 0, NULL, 'h'}, - {"offroot", 0, NULL, OffRootOpt}, -+ {"foreground", 0, NULL, 'F'}, - {NULL, 0, NULL, 0} - }; - -@@ -301,7 +303,7 @@ int main(int argc, char *argv[]) - */ - argv[0][0] = '@'; - -- while ((opt = getopt_long(argc, argv, "tha", options, NULL)) != -1) { -+ while ((opt = getopt_long(argc, argv, "thaF", options, NULL)) != -1) { - switch (opt) { - case 'a': - container_name = argv[optind-1]; -@@ -310,6 +312,9 @@ int main(int argc, char *argv[]) - case 't': - takeover = 1; - break; -+ case 'F': -+ dofork = 0; -+ break; - case OffRootOpt: - /* silently ignore old option */ - break; -@@ -381,7 +386,7 @@ int main(int argc, char *argv[]) - container_name); - exit(1); - } -- return mdmon(devname, devnum, do_fork(), takeover); -+ return mdmon(devname, devnum, dofork && do_fork(), takeover); - } - - static int mdmon(char *devname, int devnum, int must_fork, int takeover) -diff --git a/systemd/mdmon@.service b/systemd/mdmon@.service -index ddb475f..809f527 100644 ---- a/systemd/mdmon@.service -+++ b/systemd/mdmon@.service -@@ -11,7 +11,7 @@ DefaultDependencies=no - Before=initrd-switch-root.target - - [Service] --ExecStart=/sbin/mdmon %I -+ExecStart=/sbin/mdmon --foreground %I - StandardInput=null - StandardOutput=null - StandardError=null --- -1.7.11.7 - diff --git a/SOURCES/mdadm-3.2.6-mdmon-always-get-layout-from-sysfs.patch b/SOURCES/mdadm-3.2.6-mdmon-always-get-layout-from-sysfs.patch deleted file mode 100644 index bb076e6..0000000 --- a/SOURCES/mdadm-3.2.6-mdmon-always-get-layout-from-sysfs.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0c5d6054e499369cb6be74d9867743b2af8e4c05 Mon Sep 17 00:00:00 2001 -From: "mwilck@arcor.de" -Date: Fri, 2 Aug 2013 00:35:14 +0200 -Subject: [PATCH] mdmon: always get layout from sysfs - -commit 71d68ff62 uses the array layout. It needs to be initialized. - -Signed-off-by: Martin Wilck -Signed-off-by: NeilBrown ---- - managemon.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/managemon.c b/managemon.c -index 6cd93e5..21bf2bd 100644 ---- a/managemon.c -+++ b/managemon.c -@@ -652,7 +652,7 @@ static void manage_new(struct mdstat_ent *mdstat, - mdi = sysfs_read(-1, mdstat->devnum, - GET_LEVEL|GET_CHUNK|GET_DISKS|GET_COMPONENT| - GET_DEGRADED|GET_SAFEMODE| -- GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE); -+ GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE|GET_LAYOUT); - - new = malloc(sizeof(*new)); - diff --git a/SOURCES/mdadm-3.2.6-mdmon-clear-safe_mode_delay-on-shutdown.patch b/SOURCES/mdadm-3.2.6-mdmon-clear-safe_mode_delay-on-shutdown.patch deleted file mode 100644 index 41bc16c..0000000 --- a/SOURCES/mdadm-3.2.6-mdmon-clear-safe_mode_delay-on-shutdown.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 2ef219630b7e1baa72fce420b6bc41cf8071c5e8 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 1 Aug 2013 15:45:17 +1000 -Subject: [PATCH] mdmon: clear safe_mode_delay on shutdown - -When we receive a signal, set the safemode delay to v.small -so that we can ge clean arrays and exit quickly - -Signed-off-by: NeilBrown o ---- - managemon.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/managemon.c b/managemon.c -index 40c863f..6cd93e5 100644 ---- a/managemon.c -+++ b/managemon.c -@@ -492,6 +492,11 @@ static void manage_member(struct mdstat_ent *mdstat, - if (a->container == NULL) - return; - -+ if (sigterm && a->info.safe_mode_delay > 1) { -+ sysfs_set_safemode(&a->info, 1); -+ a->info.safe_mode_delay = 1; -+ } -+ - /* We don't check the array while any update is pending, as it - * might container a change (such as a spare assignment) which - * could affect our decisions. -@@ -646,7 +651,8 @@ static void manage_new(struct mdstat_ent *mdstat, - - mdi = sysfs_read(-1, mdstat->devnum, - GET_LEVEL|GET_CHUNK|GET_DISKS|GET_COMPONENT| -- GET_DEGRADED|GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE); -+ GET_DEGRADED|GET_SAFEMODE| -+ GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE); - - new = malloc(sizeof(*new)); - -@@ -692,6 +698,16 @@ static void manage_new(struct mdstat_ent *mdstat, - dprintf("%s: inst: %d action: %d state: %d\n", __func__, atoi(inst), - new->action_fd, new->info.state_fd); - -+ if (sigterm) -+ new->info.safe_mode_delay = 1; -+ else if (mdi->safe_mode_delay >= 50) -+ /* Normal start, mdadm set this. */ -+ new->info.safe_mode_delay = mdi->safe_mode_delay; -+ else -+ /* Restart, just pick a number */ -+ new->info.safe_mode_delay = 5000; -+ sysfs_set_safemode(&new->info, new->info.safe_mode_delay); -+ - /* reshape_position is set by mdadm in sysfs - * read this information for new arrays only (empty victim) - */ diff --git a/SOURCES/mdadm-3.2.6-mdmon-don-t-lie-to-systemd.patch b/SOURCES/mdadm-3.2.6-mdmon-don-t-lie-to-systemd.patch deleted file mode 100644 index 5a9ca63..0000000 --- a/SOURCES/mdadm-3.2.6-mdmon-don-t-lie-to-systemd.patch +++ /dev/null @@ -1,87 +0,0 @@ -From a9c15847579ce3ac210b2dcc41e2af6c5f8bd65c Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 1 Aug 2013 15:59:24 +1000 -Subject: [PATCH] mdmon: don't lie to systemd. - -Now that mdmon responds fairly well to SIGTERM, stop lying to -systemd about being started on the initrd. - -Note that if mdmon is rerun (--takeover) for some reason, and systemd -chooses to kill processes before remounting / readonly, then the -unmount will hang. - -If systemd ever lets us tell it that we don't want to be killed until -root is readonly, then we should do that. - -Signed-off-by: NeilBrown ---- - mdadm.h | 2 ++ - mdmon.c | 12 ++++++++---- - util.c | 11 +++++++++++ - 3 files changed, 21 insertions(+), 4 deletions(-) - -diff --git a/mdadm.h b/mdadm.h -index c5d9c30..43f3a57 100644 ---- a/mdadm.h -+++ b/mdadm.h -@@ -1390,6 +1390,8 @@ extern void fmt_devname(char *name, int num); - extern int stat2devnum(struct stat *st); - extern int fd2devnum(int fd); - -+extern int in_initrd(void); -+ - static inline int dev2major(int d) - { - if (d >= 0) -diff --git a/mdmon.c b/mdmon.c -index 13f9510..f0b0623 100644 ---- a/mdmon.c -+++ b/mdmon.c -@@ -298,10 +298,14 @@ int main(int argc, char *argv[]) - {NULL, 0, NULL, 0} - }; - -- /* -- * Always change process name to @dmon to avoid systemd killing it -- */ -- argv[0][0] = '@'; -+ if (in_initrd()) { -+ /* -+ * set first char of argv[0] to @. This is used by -+ * systemd to signal that the task was launched from -+ * initrd/initramfs and should be preserved during shutdown -+ */ -+ argv[0][0] = '@'; -+ } - - while ((opt = getopt_long(argc, argv, "thaF", options, NULL)) != -1) { - switch (opt) { -diff --git a/util.c b/util.c -index 3965f43..aa2c8be 100644 ---- a/util.c -+++ b/util.c -@@ -29,6 +29,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -1937,3 +1939,12 @@ void enable_fds(int devices) - } - return disks; - } -+ -+int in_initrd(void) -+{ -+ /* This is based on similar function in systemd. */ -+ struct statfs s; -+ return statfs("/", &s) >= 0 && -+ (s.f_type == TMPFS_MAGIC || -+ s.f_type == RAMFS_MAGIC); -+} --- -1.8.4.2 - diff --git a/SOURCES/mdadm-3.2.6-mdmon-don-t-use-ghost-values-from-an-inactive-array.patch b/SOURCES/mdadm-3.2.6-mdmon-don-t-use-ghost-values-from-an-inactive-array.patch deleted file mode 100644 index bdde9f3..0000000 --- a/SOURCES/mdadm-3.2.6-mdmon-don-t-use-ghost-values-from-an-inactive-array.patch +++ /dev/null @@ -1,40 +0,0 @@ -From e49a8a80265ab2150c96b636450f5825bcd69d4a Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Mon, 5 Aug 2013 15:40:16 +1000 -Subject: [PATCH] mdmon: don't use 'ghost' values from an inactive array. - -It is possible for mdmon to see (in /proc/mdstat) and array -in 'inactive' state, "mdadm -S" has written "inactive" to -"array_state". - -In this state values such as "raid_disk" are not meaningful -and so should be ignored by manage_member(). - -Reported-by: "Dorau, Lukasz" -Signed-off-by: NeilBrown ---- - managemon.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/managemon.c b/managemon.c -index c245655..f40bbdb 100644 ---- a/managemon.c -+++ b/managemon.c -@@ -450,9 +450,11 @@ static void manage_member(struct mdstat_ent *mdstat, - /* Raced with something */ - return; - -- // FIXME -- a->info.array.raid_disks = mdstat->raid_disks; -- // MORE -+ if (mdstat->active) { -+ // FIXME -+ a->info.array.raid_disks = mdstat->raid_disks; -+ // MORE -+ } - - if (sysfs_get_ll(&a->info, NULL, "component_size", &component_size) >= 0) - a->info.component_size = component_size << 1; --- -1.8.5.3 - diff --git a/SOURCES/mdadm-3.2.6-mdmon-honour-offroot-again.patch b/SOURCES/mdadm-3.2.6-mdmon-honour-offroot-again.patch deleted file mode 100644 index d7aab09..0000000 --- a/SOURCES/mdadm-3.2.6-mdmon-honour-offroot-again.patch +++ /dev/null @@ -1,40 +0,0 @@ -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-policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch b/SOURCES/mdadm-3.2.6-policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch deleted file mode 100644 index 5916db6..0000000 --- a/SOURCES/mdadm-3.2.6-policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 75a721fd7d5e5ee7e578571fe58755fe07e446fc Mon Sep 17 00:00:00 2001 -From: Lukasz Dorau -Date: Thu, 19 Dec 2013 13:02:12 +0100 -Subject: [PATCH] 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 -Signed-off-by: NeilBrown ---- - policy.c | 35 +++++++++++++++++------------------ - 1 file changed, 17 insertions(+), 18 deletions(-) - -diff --git a/policy.c b/policy.c -index b4f3943..104695d 100644 ---- a/policy.c -+++ b/policy.c -@@ -200,26 +200,25 @@ static char *disk_path(struct mdinfo *disk) - 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 strdup(ent->d_name); -+ } - closedir(by_path); -- return strdup(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); --- -1.8.5.3 - diff --git a/SOURCES/mdadm-3.2.6-query-udev-dir-via-pkg-config.patch b/SOURCES/mdadm-3.2.6-query-udev-dir-via-pkg-config.patch deleted file mode 100644 index 874c403..0000000 --- a/SOURCES/mdadm-3.2.6-query-udev-dir-via-pkg-config.patch +++ /dev/null @@ -1,54 +0,0 @@ -From fa0d79e2b2642a2f8b04d34dfef866dbabc69e1e Mon Sep 17 00:00:00 2001 -From: Samuli Suominen -Date: Mon, 13 Aug 2012 13:44:22 -0400 -Subject: [PATCH] query udev dir via pkg-config - -Since udev is moving its internal dir around, query it via pkg-config -rather than hardcoding the old path. This should work with new/old -versions. - -Signed-off-by: Samuli Suominen -Signed-off-by: Mike Frysinger -Signed-off-by: NeilBrown ---- - Makefile | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index 72f609e..a3e4027 100644 ---- a/Makefile -+++ b/Makefile -@@ -57,6 +57,8 @@ else - DEFAULT_METADATA=1.2 - endif - -+PKG_CONFIG ?= pkg-config -+ - SYSCONFDIR = /etc - CONFFILE = $(SYSCONFDIR)/mdadm.conf - CONFFILE2 = $(SYSCONFDIR)/mdadm/mdadm.conf -@@ -96,6 +98,11 @@ MAN4DIR = $(MANDIR)/man4 - MAN5DIR = $(MANDIR)/man5 - MAN8DIR = $(MANDIR)/man8 - -+UDEVDIR := $(shell $(PKG_CONFIG) --variable=udevdir udev 2>/dev/null) -+ifndef UDEVDIR -+ UDEVDIR = /lib/udev -+endif -+ - OBJS = mdadm.o config.o policy.o mdstat.o ReadMe.o util.o maps.o lib.o \ - Manage.o Assemble.o Build.o \ - Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \ -@@ -255,7 +262,7 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8 - $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 - - install-udev: udev-md-raid.rules -- $(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)/lib/udev/rules.d/64-md-raid.rules -+ $(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)$(UDEVDIR)/rules.d/64-md-raid.rules - - uninstall: - rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 $(DESTDIR)$(MAN8DIR)/mdmon.8 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm - --- -1.8.1.4 - 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 deleted file mode 100644 index 9b20396..0000000 --- a/SOURCES/mdadm-3.2.6-systemd-various-fixes-for-boot-with-container-arrays.patch +++ /dev/null @@ -1,84 +0,0 @@ -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/SOURCES/mdadm-3.2.6-udev.patch b/SOURCES/mdadm-3.2.6-udev.patch deleted file mode 100644 index a2084ce..0000000 --- a/SOURCES/mdadm-3.2.6-udev.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- mdadm-3.2.3/udev-md-raid.rules.udev 2011-12-15 05:13:08.000000000 +0100 -+++ mdadm-3.2.3/udev-md-raid.rules 2011-12-28 17:18:02.753053345 +0100 -@@ -2,19 +2,21 @@ - - SUBSYSTEM!="block", GOTO="md_end" - -+# In Fedora we handle the raid components in 65-md-incremental.rules so that -+# we can do things like honor anaconda command line options and such - # handle potential components of arrays (the ones supported by md) --ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_inc" --GOTO="md_inc_skip" -- --LABEL="md_inc" -+#ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_inc" -+#GOTO="md_inc_skip" -+# -+#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", RUN+="/sbin/mdadm --incremental $tempnode --offroot" --ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}" --ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name" -+#ACTION=="add", RUN+="/sbin/mdadm --incremental $tempnode --offroot" -+#ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}" -+#ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name" - --LABEL="md_inc_skip" -+#LABEL="md_inc_skip" - - # handle md arrays - ACTION!="add|change", GOTO="md_end" diff --git a/SOURCES/mdadm-3.3-udev.patch b/SOURCES/mdadm-3.3-udev.patch new file mode 100644 index 0000000..1dfac7b --- /dev/null +++ b/SOURCES/mdadm-3.3-udev.patch @@ -0,0 +1,13 @@ +--- mdadm-3.3.1/udev-md-raid-assembly.rules~ 2014-06-10 13:29:41.192829830 +0200 ++++ mdadm-3.3.1/udev-md-raid-assembly.rules 2014-06-10 13:30:20.838613208 +0200 +@@ -5,6 +5,10 @@ + ENV{ANACONDA}=="?*", GOTO="md_inc_end" + # assemble md arrays + ++# In Fedora we handle the raid components in 65-md-incremental.rules so that ++# we can do things like honor anaconda command line options and such ++GOTO="md_inc_end" ++ + SUBSYSTEM!="block", GOTO="md_inc_end" + + # handle potential components of arrays (the ones supported by md) diff --git a/SOURCES/mdadm-3.3.2-skip-rules.patch b/SOURCES/mdadm-3.3.2-skip-rules.patch new file mode 100644 index 0000000..4f6a91c --- /dev/null +++ b/SOURCES/mdadm-3.3.2-skip-rules.patch @@ -0,0 +1,11 @@ +--- mdadm-3.3.2/Makefile~ 2015-01-19 12:52:27.986672493 -0500 ++++ mdadm-3.3.2/Makefile 2015-01-19 12:53:20.727044132 -0500 +@@ -281,7 +281,7 @@ + $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 + + install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules +- @for file in 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \ ++ @for file in 63-md-raid-arrays.rules ; \ + do sed -e 's,BINDIR,$(BINDIR),g' udev-$${file#??-} > .install.tmp.1 && \ + echo $(INSTALL) -D -m 644 udev-$${file#??-} $(DESTDIR)$(UDEVDIR)/rules.d/$$file ; \ + $(INSTALL) -D -m 644 .install.tmp.1 $(DESTDIR)$(UDEVDIR)/rules.d/$$file ; \ diff --git a/SPECS/mdadm.spec b/SPECS/mdadm.spec index 32ef230..bf19f8a 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}.2 +Version: 3.3.2 +Release: 2%{?dist} Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz Source1: mdmonitor.init Source2: raid-check @@ -11,37 +11,10 @@ Source5: mdadm-cron Source6: mdmonitor.service Source7: mdadm.conf Source8: mdadm_event.conf -Patch1: mdadm-3.2.6-Create.c-check-if-freesize-is-equal-0.patch -Patch2: mdadm-3.2.6-imsm-Forbid-spanning-between-multiple-controllers.patch -Patch3: mdadm-3.2.6-query-udev-dir-via-pkg-config.patch -Patch4: mdadm-3.2.6-Add-updating-component_size-to-manager-thread-of-mdm.patch -Patch5: mdadm-3.2.6-imsm-monitor-do-not-finish-migration-if-there-are-no.patch -Patch6: mdadm-3.2.6-Manage_runstop-call-flush_mdmon-if-O_EXCL-fails-on-s.patch -Patch7: mdadm-3.2.6-Monitor-Don-t-write-metadata-in-inactive-array-state.patch -Patch8: mdadm-3.2.6-policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch -Patch9: mdadm-3.2.6-IMSM-don-t-crash-when-creating-an-array-with-missing.patch -Patch10: mdadm-3.2.6-Fix-is_resync_complete-for-RAID10.patch -Patch11: mdadm-3.2.6-mdmon-clear-safe_mode_delay-on-shutdown.patch -Patch12: mdadm-3.2.6-mdmon-always-get-layout-from-sysfs.patch -Patch13: mdadm-3.2.6-mdmon-don-t-use-ghost-values-from-an-inactive-array.patch -Patch14: mdadm-3.2.6-imsm-support-for-second-AHCI-controller-in-EFI-mode.patch -Patch15: mdadm-3.2.6-imsm-improved-platform-capabilities-checking.patch -Patch80: mdadm-3.2.6-Remove-offroot-argument-and-default-to-always-settin.patch -Patch81: mdadm-3.2.6-Add-support-for-launching-mdmon-via-systemctl-instea.patch -Patch82: mdadm-3.2.6-In-case-launching-mdmon-fails-print-an-error-message.patch -Patch83: mdadm-3.2.6-mdmon-add-foreground-option.patch -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 +# RHEL customization patches +Patch96: mdadm-3.3.2-skip-rules.patch +Patch97: mdadm-3.3-udev.patch Patch98: mdadm-2.5.2-static.patch -# Fedora 17 - only -Patch99: mdadm-3.2.4-map-dir.patch URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ License: GPLv2+ Group: System Environment/Base @@ -49,7 +22,6 @@ 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 @@ -65,38 +37,9 @@ file can be used to help with some common tasks. %prep %setup -q -%patch1 -p1 -b .raidsize -%patch2 -p1 -b .multictrl -%patch3 -p1 -b .udevquery -%patch4 -p1 -b .component -%patch5 -p1 -b .migration -%patch6 -p1 -b .runstop -%patch7 -p1 -b .metastate -%patch8 -p1 -b .nullpath -%patch9 -p1 -b .imsmmissing -%patch10 -p1 -b .complete -%patch11 -p1 -b .safe_mode -%patch12 -p1 -b .layout -%patch13 -p1 -b .ghost -%patch14 -p1 -b .efimode -%patch15 -p1 -b .platcheck - -# Use systemctl to launch mdmon on F18 and higher -%patch80 -p1 -b .nooffroot -%patch81 -p1 -b .sysctl -%patch82 -p1 -b .mdmonfail -%patch83 -p1 -b .foreground - -%patch84 -p1 -b .lies -%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 + +# RHEL customization patches +%patch96 -p1 -b .rules %patch97 -p1 -b .udev %patch98 -p1 -b .static @@ -152,6 +95,7 @@ rm -rf %{buildroot} %{_sbindir}/* %{_unitdir}/* %{_mandir}/man*/md* +/usr/lib/systemd/system-shutdown/* %config(noreplace) %{_sysconfdir}/cron.d/* %config(noreplace) %{_sysconfdir}/sysconfig/* %dir %{_localstatedir}/run/%{name}/ @@ -159,16 +103,24 @@ rm -rf %{buildroot} /etc/libreport/events.d/* %changelog -* Fri Aug 22 2014 Jes Sorensen - 3.2.6-31.2 +* Mon Jan 19 2015 Jes Sorensen - 3.3.2-2 +- Do not install 64-md-raid-assembly.rules +- Resolves rhbz#1181620 + +* Wed Aug 27 2014 Jes Sorensen - 3.3.2-1 +- Update to upstream mdadm-3.3.2 +- Resolves rhbz#1085533 + +* Fri Jul 25 2014 Jes Sorensen - 3.2.6-33 - Fix problem with spare disk not being added correctly to IMSM array because mdmon is unable to write metadata to it. -- Resolves bz1132829 +- Resolves bz1072979 -* Mon Jul 28 2014 Jes Sorensen - 3.2.6-31.1 +* Thu Jul 24 2014 Jes Sorensen - 3.2.6-32 - 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 +- Resolves bz1074970 * Mon Mar 10 2014 Jes Sorensen - 3.2.6-31 - Fix problem of IMSM platform capabilities not being detected in UEFI