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 new file mode 100644 index 0000000..ff7a2b4 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-Don-t-lie-to-systemd-about-mdadm-s-status.patch @@ -0,0 +1,39 @@ +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 new file mode 100644 index 0000000..a82fb42 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-Fix-is_resync_complete-for-RAID10.patch @@ -0,0 +1,44 @@ +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 new file mode 100644 index 0000000..e6b4cca --- /dev/null +++ b/SOURCES/mdadm-3.2.6-Grow-exit-background-thread-cleanly-on-SIGTERM.patch @@ -0,0 +1,89 @@ +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 new file mode 100644 index 0000000..2f419cc --- /dev/null +++ b/SOURCES/mdadm-3.2.6-IMSM-don-t-crash-when-creating-an-array-with-missing.patch @@ -0,0 +1,30 @@ +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-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 new file mode 100644 index 0000000..39dbaed --- /dev/null +++ b/SOURCES/mdadm-3.2.6-Monitor-Don-t-write-metadata-in-inactive-array-state.patch @@ -0,0 +1,34 @@ +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-imsm-improved-platform-capabilities-checking.patch b/SOURCES/mdadm-3.2.6-imsm-improved-platform-capabilities-checking.patch new file mode 100644 index 0000000..f6b7ee0 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-imsm-improved-platform-capabilities-checking.patch @@ -0,0 +1,140 @@ +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-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 new file mode 100644 index 0000000..a63210a --- /dev/null +++ b/SOURCES/mdadm-3.2.6-imsm-support-for-second-AHCI-controller-in-EFI-mode.patch @@ -0,0 +1,55 @@ +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 new file mode 100644 index 0000000..3df3da2 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-in_initrd-fix-gcc-compiler-error.patch @@ -0,0 +1,30 @@ +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-always-get-layout-from-sysfs.patch b/SOURCES/mdadm-3.2.6-mdmon-always-get-layout-from-sysfs.patch new file mode 100644 index 0000000..bb076e6 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-mdmon-always-get-layout-from-sysfs.patch @@ -0,0 +1,26 @@ +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 new file mode 100644 index 0000000..41bc16c --- /dev/null +++ b/SOURCES/mdadm-3.2.6-mdmon-clear-safe_mode_delay-on-shutdown.patch @@ -0,0 +1,56 @@ +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 new file mode 100644 index 0000000..5a9ca63 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-mdmon-don-t-lie-to-systemd.patch @@ -0,0 +1,87 @@ +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 new file mode 100644 index 0000000..bdde9f3 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-mdmon-don-t-use-ghost-values-from-an-inactive-array.patch @@ -0,0 +1,40 @@ +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-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 new file mode 100644 index 0000000..5916db6 --- /dev/null +++ b/SOURCES/mdadm-3.2.6-policy-NULL-path-isn-t-really-acceptable-use-the-dev.patch @@ -0,0 +1,68 @@ +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.rules b/SOURCES/mdadm.rules index 73e9c83..a2c1e18 100644 --- a/SOURCES/mdadm.rules +++ b/SOURCES/mdadm.rules @@ -26,12 +26,6 @@ ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end" # array members either) SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \ RUN+="/sbin/mdadm -I $env{DEVNAME}" -SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \ - ENV{ID_FS_TYPE}=="linux_raid_member", \ - RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}" -SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \ - ENV{ID_FS_TYPE}=="linux_raid_member", \ - RUN+="/sbin/mdadm -If $name" # Next, check to make sure the BIOS raid stuff wasn't turned off via cmdline IMPORT{cmdline}="noiswmd" @@ -40,13 +34,12 @@ ENV{noiswmd}=="?*", GOTO="md_imsm_inc_end" ENV{nodmraid}=="?*", GOTO="md_imsm_inc_end" SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="isw_raid_member", \ RUN+="/sbin/mdadm -I $env{DEVNAME}" +LABEL="md_imsm_inc_end" + SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \ - ENV{ID_FS_TYPE}=="isw_raid_member", \ RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}" SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \ - ENV{ID_FS_TYPE}=="isw_raid_member", \ RUN+="/sbin/mdadm -If $name" -LABEL="md_imsm_inc_end" # Next make sure that this isn't a dm device we should skip for some reason ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_change_end" diff --git a/SPECS/mdadm.spec b/SPECS/mdadm.spec index ed6a0a2..b3cef7e 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: 22%{?dist} +Release: 31%{?dist} Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz Source1: mdmonitor.init Source2: raid-check @@ -17,10 +17,23 @@ 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 -Patch93: mdadm-3.2.6-Remove-offroot-argument-and-default-to-always-settin.patch -Patch94: mdadm-3.2.6-Add-support-for-launching-mdmon-via-systemctl-instea.patch -Patch95: mdadm-3.2.6-In-case-launching-mdmon-fails-print-an-error-message.patch -Patch96: mdadm-3.2.6-mdmon-add-foreground-option.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 # Fedora customization patches Patch97: mdadm-3.2.6-udev.patch Patch98: mdadm-2.5.2-static.patch @@ -54,12 +67,26 @@ file can be used to help with some common tasks. %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 -%patch93 -p1 -b .nooffroot -%patch94 -p1 -b .sysctl -%patch95 -p1 -b .mdmonfail -%patch96 -p1 -b .foreground +%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 # Fedora customization patches %patch97 -p1 -b .udev @@ -124,6 +151,44 @@ rm -rf %{buildroot} /etc/libreport/events.d/* %changelog +* Mon Mar 10 2014 Jes Sorensen - 3.2.6-31 +- Fix problem of IMSM platform capabilities not being detected in UEFI + mode when only the second SATA controller is enabled. +- Resolves bz1074161 + +* Mon Mar 3 2014 Jes Sorensen - 3.2.6-30 +- Fix problem where Resync and recovery of RAID10 stopped at more than + 50% does not continue after reassemblation +- Resolves bz1068154 + +* Wed Jan 29 2014 Jes Sorensen - 3.2.6-29 +- Fix problem with mdadm crashing, if trying to create an IMSM array, with + missing devices. +- Resolves bz1056466 + +* Wed Jan 29 2014 Jes Sorensen - 3.2.6-28 +- Fix problem with policy with path=* not working if there is no + /dev/disk/by-path/ directory, as is the case with (S)ATA only systems +- Resovles bz1045510 + +* Wed Jan 29 2014 Jes Sorensen - 3.2.6-27 +- Fix problem with failed disk staying available in IMSM volume/container +- Resolves bz1052904 + +* Wed Jan 29 2014 Jes Sorensen - 3.2.6-26 +- Fix problem with reshape not proceeding after reboot on RAID 0 and RAID 5 +- Resolves bz1046064 + +* Fri Jan 24 2014 Daniel Mach - 3.2.6-25 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 3.2.6-24 +- Mass rebuild 2013-12-27 + +* Thu Nov 21 2013 Jes Sorensen - 3.2.6-23 +- Fix problem with rebuild not restarting on stopped RAID1/10 IMSM arrays +- Resolves bz1032911 + * Thu Oct 10 2013 Jes Sorensen - 3.2.6-22 - Check for DM_UDEV_DISABLE_OTHER_RULES_FLAG instead of DM_UDEV_DISABLE_DISK_RULES_FLAG in 65-md-incremental.rules