diff --git a/.gitignore b/.gitignore index 9fcc1f2..094b437 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/mdadm-3.3.2.tar.xz +SOURCES/mdadm-3.4.tar.xz diff --git a/.mdadm.metadata b/.mdadm.metadata index 36bcfe8..01a9c90 100644 --- a/.mdadm.metadata +++ b/.mdadm.metadata @@ -1 +1 @@ -c649601d84553501c2f3b452cf93d1fbc53f976a SOURCES/mdadm-3.3.2.tar.xz +0b6c284970567bfa30dbc14ea5c0e2320582b80c SOURCES/mdadm-3.4.tar.xz diff --git a/SOURCES/mdadm-3.3.2-Grow-close-file-descriptor-earlier-to-avoid-still-in.patch b/SOURCES/mdadm-3.3.2-Grow-close-file-descriptor-earlier-to-avoid-still-in.patch deleted file mode 100644 index b63705b..0000000 --- a/SOURCES/mdadm-3.3.2-Grow-close-file-descriptor-earlier-to-avoid-still-in.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 10df72a080f71f01553a14ed8112cee6af7912e8 Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Wed, 23 Dec 2015 12:57:10 +0100 -Subject: [PATCH] Grow: close file descriptor earlier to avoid "still in use" - when stopping - -Close fd2 as soon as it is no longer needed, before calling -Grow_continue(). Otherwise, we won't be able to stop an array with -external metadata during reshape, because mdadm running in background -will be keeping it open. - -Signed-off-by: Artur Paszkiewicz -Signed-off-by: Pawel Baldysiak -Signed-off-by: NeilBrown ---- - Grow.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/Grow.c b/Grow.c -index 89e4c34..bbdd46c 100755 ---- a/Grow.c -+++ b/Grow.c -@@ -4885,6 +4885,9 @@ int Grow_continue_command(char *devname, int fd, - - sysfs_init(content, fd2, mdstat->devnm); - -+ close(fd2); -+ fd2 = -1; -+ - /* start mdmon in case it is not running - */ - if (!mdmon_running(container)) --- -2.5.0 - diff --git a/SOURCES/mdadm-3.3.2-IMSM-Clear-migration-record-on-disks-more-often.patch b/SOURCES/mdadm-3.3.2-IMSM-Clear-migration-record-on-disks-more-often.patch deleted file mode 100644 index de9773f..0000000 --- a/SOURCES/mdadm-3.3.2-IMSM-Clear-migration-record-on-disks-more-often.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 71e5411eeaf7e97a67dfed20ea8c365e28c7481c Mon Sep 17 00:00:00 2001 -From: Pawel Baldysiak -Date: Tue, 20 Jan 2015 13:52:25 +0100 -Subject: [PATCH] IMSM: Clear migration record on disks more often - -Migration record is not always cleared after successful migration. This can -block another reshape from being started. Migration will not be continued via -systemd service due to error in verifying reshape position. This patch added -clearing migration record when disk is added to container, and after successful -migration. - -Signed-off-by: Pawel Baldysiak -Signed-off-by: NeilBrown ---- - super-intel.c | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -diff --git a/super-intel.c b/super-intel.c -index 4c53019..4b23b9a 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -5055,6 +5055,14 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, - } - - get_dev_size(fd, NULL, &size); -+ /* clear migr_rec when adding disk to container */ -+ memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SIZE); -+ if (lseek64(fd, size - MIGR_REC_POSITION, SEEK_SET) >= 0) { -+ if (write(fd, super->migr_rec_buf, -+ MIGR_REC_BUF_SIZE) != MIGR_REC_BUF_SIZE) -+ perror("Write migr_rec failed"); -+ } -+ - size /= 512; - serialcpy(dd->disk.serial, dd->serial); - set_total_blocks(&dd->disk, size); -@@ -10648,6 +10656,24 @@ static int imsm_manage_reshape( - - } - -+ /* clear migr_rec on disks after successful migration */ -+ struct dl *d; -+ -+ memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SIZE); -+ for (d = super->disks; d; d = d->next) { -+ if (d->index < 0 || is_failed(&d->disk)) -+ continue; -+ unsigned long long dsize; -+ -+ get_dev_size(d->fd, NULL, &dsize); -+ if (lseek64(d->fd, dsize - MIGR_REC_POSITION, -+ SEEK_SET) >= 0) { -+ if (write(d->fd, super->migr_rec_buf, -+ MIGR_REC_BUF_SIZE) != MIGR_REC_BUF_SIZE) -+ perror("Write migr_rec failed"); -+ } -+ } -+ - /* return '1' if done */ - ret_val = 1; - abort: --- -2.1.0 - diff --git a/SOURCES/mdadm-3.3.2-fix-problem-with-grow-continue.patch b/SOURCES/mdadm-3.3.2-fix-problem-with-grow-continue.patch deleted file mode 100644 index 4ad9428..0000000 --- a/SOURCES/mdadm-3.3.2-fix-problem-with-grow-continue.patch +++ /dev/null @@ -1,52 +0,0 @@ -commit 8e7ddc5f50af00e569ef115e25c635e2d74e90f0 -Author: NeilBrown -Date: Thu May 28 16:43:15 2015 +1000 - - Grow: fix problem with --grow --continue - - If an array is being reshaped using backup space on a 'spare' device, - then - mdadm --grow --continue - won't find it as by the time it runs, nothing looks like a spare are - more. The spare has been added to the array, but has no data yet. - - So allow reshape_prepare_fdlist to find a newly-incorporated spare and - report this so it can be used. - - Reported-by: Xiao Ni - Signed-off-by: NeilBrown - -diff --git a/Grow.c b/Grow.c -index a20ff3e..85de1d2 100644 ---- a/Grow.c -+++ b/Grow.c -@@ -850,7 +850,8 @@ int reshape_prepare_fdlist(char *devname, - for (sd = sra->devs; sd; sd = sd->next) { - if (sd->disk.state & (1<disk.state & (1<disk.state & (1<disk.raid_disk < raid_disks) { - char *dn = map_dev(sd->disk.major, - sd->disk.minor, 1); - fdlist[sd->disk.raid_disk] -@@ -3184,7 +3185,7 @@ started: - d = reshape_prepare_fdlist(devname, sra, odisks, - nrdisks, blocks, backup_file, - fdlist, offsets); -- if (d < 0) { -+ if (d < odisks) { - goto release; - } - if ((st->ss->manage_reshape == NULL) || -@@ -3196,7 +3197,7 @@ started: - devname); - pr_err(" Please provide one with \"--backup=...\"\n"); - goto release; -- } else if (sra->array.spare_disks == 0) { -+ } else if (d == odisks) { - pr_err("%s: Cannot grow - " - "need a spare or backup-file to backup " - "critical section\n", devname); - goto release; - } diff --git a/SOURCES/mdadm-3.3.2-fix-resize-of-array-component-size-to-32bits.patch b/SOURCES/mdadm-3.3.2-fix-resize-of-array-component-size-to-32bits.patch deleted file mode 100644 index 5084809..0000000 --- a/SOURCES/mdadm-3.3.2-fix-resize-of-array-component-size-to-32bits.patch +++ /dev/null @@ -1,30 +0,0 @@ -commit 0448027b765ec7ede580a1630c23fe7cf4bd0b05 -Author: Justin Maggard -Date: Fri Oct 24 17:55:02 2014 -0700 - - Grow: fix resize of array component size to > 32bits - - If the request --size to --grow an array to is larger - than 32bits, then mdadm may make the wrong choice and - use ioctl instead of setting component_size via sysfs - and the change is ignored. - - Instead of using casts to check for a 32-bit overflow, - just check for set bits outside of INT32_MAX. - - Fixes: 4e9a3dd16d656b269f5602624ac4f7109a571368 - Signed-off-by: NeilBrown - -diff --git a/Grow.c b/Grow.c -index 76bb35a..a0f7526 100644 ---- a/Grow.c -+++ b/Grow.c -@@ -1818,7 +1818,7 @@ int Grow_reshape(char *devname, int fd, - if (s->size == MAX_SIZE) - s->size = 0; - array.size = s->size; -- if (array.size != (signed)s->size) { -+ if (s->size & ~INT32_MAX) { - /* got truncated to 32bit, write to - * component_size instead - */ diff --git a/SOURCES/mdadm-3.3.2-imsm-abort-reshape-if-sync_action-is-not-reshape.patch b/SOURCES/mdadm-3.3.2-imsm-abort-reshape-if-sync_action-is-not-reshape.patch deleted file mode 100644 index a5a27b2..0000000 --- a/SOURCES/mdadm-3.3.2-imsm-abort-reshape-if-sync_action-is-not-reshape.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d7d3809a1b93f9f7b7ca7d874c17632cb3305c76 Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Wed, 23 Dec 2015 12:57:11 +0100 -Subject: [PATCH] imsm: abort reshape if sync_action is not "reshape" - -When reshape was interrupted, an incorrect checkpoint would be saved in -the migration record. Change wait_for_reshape_imsm() to return -1 when -sync_action is not "reshape" to abort early in imsm_manage_reshape() -without writing the migration record. - -Signed-off-by: Artur Paszkiewicz -Signed-off-by: NeilBrown ---- - super-intel.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/super-intel.c b/super-intel.c -index e609e0c..c7efa98 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -10300,8 +10300,10 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) - sysfs_wait(fd, NULL); - if (sysfs_get_str(sra, NULL, "sync_action", - action, 20) > 0 && -- strncmp(action, "reshape", 7) != 0) -- break; -+ strncmp(action, "reshape", 7) != 0) { -+ close(fd); -+ return -1; -+ } - if (sysfs_fd_get_ll(fd, &completed) < 0) { - dprintf("imsm: wait_for_reshape_imsm() " - "cannot read reshape_position (in loop)\n"); diff --git a/SOURCES/mdadm-3.3.2-imsm-add-support-for-NVMe-devices.patch b/SOURCES/mdadm-3.3.2-imsm-add-support-for-NVMe-devices.patch deleted file mode 100644 index a10ecbc..0000000 --- a/SOURCES/mdadm-3.3.2-imsm-add-support-for-NVMe-devices.patch +++ /dev/null @@ -1,202 +0,0 @@ -From 614902f64e856b4cffc26687fac74412c4a6d91c Mon Sep 17 00:00:00 2001 -From: Pawel Baldysiak -Date: Wed, 19 Nov 2014 13:53:28 +0100 -Subject: [PATCH] imsm: add support for NVMe devices - -Recognize Intel(R) NVMe devices as IMSM-capable. - -Signed-off-by: Pawel Baldysiak -Signed-off-by: Artur Paszkiewicz -Signed-off-by: NeilBrown ---- - platform-intel.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- - platform-intel.h | 5 +++++ - super-intel.c | 11 +++++++---- - 3 files changed, 56 insertions(+), 6 deletions(-) - -diff --git a/platform-intel.c b/platform-intel.c -index c5a0aa4..ae72827 100644 ---- a/platform-intel.c -+++ b/platform-intel.c -@@ -65,6 +65,8 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver) - type = SYS_DEV_SAS; - else if (strcmp(driver, "ahci") == 0) - type = SYS_DEV_SATA; -+ else if (strcmp(driver, "nvme") == 0) -+ type = SYS_DEV_NVME; - else - type = SYS_DEV_UNKNOWN; - -@@ -174,7 +176,7 @@ static __u16 devpath_to_vendor(const char *dev_path) - - struct sys_dev *find_intel_devices(void) - { -- struct sys_dev *ahci, *isci; -+ struct sys_dev *ahci, *isci, *nvme; - - if (valid_time > time(0) - 10) - return intel_devices; -@@ -184,14 +186,24 @@ struct sys_dev *find_intel_devices(void) - - isci = find_driver_devices("pci", "isci"); - ahci = find_driver_devices("pci", "ahci"); -+ nvme = find_driver_devices("pci", "nvme"); - -- if (!ahci) { -+ if (!isci && !ahci) { -+ ahci = nvme; -+ } else if (!ahci) { - ahci = isci; -+ struct sys_dev *elem = ahci; -+ while (elem->next) -+ elem = elem->next; -+ elem->next = nvme; - } else { - struct sys_dev *elem = ahci; - while (elem->next) - elem = elem->next; - elem->next = isci; -+ while (elem->next) -+ elem = elem->next; -+ elem->next = nvme; - } - intel_devices = ahci; - valid_time = time(0); -@@ -497,6 +509,33 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) - return ret; - } - -+const struct imsm_orom *find_imsm_nvme(struct sys_dev *hba) -+{ -+ static const struct imsm_orom *nvme_orom; -+ -+ if (hba->type != SYS_DEV_NVME) -+ return NULL; -+ -+ if (!nvme_orom) { -+ struct imsm_orom nvme_orom_compat = { -+ .signature = IMSM_NVME_OROM_COMPAT_SIGNATURE, -+ .rlc = IMSM_OROM_RLC_RAID0 | IMSM_OROM_RLC_RAID1 | -+ IMSM_OROM_RLC_RAID10 | IMSM_OROM_RLC_RAID5, -+ .sss = IMSM_OROM_SSS_4kB | IMSM_OROM_SSS_8kB | -+ IMSM_OROM_SSS_16kB | IMSM_OROM_SSS_32kB | -+ IMSM_OROM_SSS_64kB | IMSM_OROM_SSS_128kB, -+ .dpa = IMSM_OROM_DISKS_PER_ARRAY_NVME, -+ .tds = IMSM_OROM_TOTAL_DISKS_NVME, -+ .vpa = IMSM_OROM_VOLUMES_PER_ARRAY, -+ .vphba = IMSM_OROM_TOTAL_DISKS_NVME / 2 * IMSM_OROM_VOLUMES_PER_ARRAY, -+ .attr = IMSM_OROM_ATTR_2TB | IMSM_OROM_ATTR_2TB_DISK, -+ }; -+ nvme_orom = add_orom(&nvme_orom_compat); -+ } -+ add_orom_device_id(nvme_orom, hba->dev_id); -+ return nvme_orom; -+} -+ - const struct imsm_orom *find_imsm_capability(struct sys_dev *hba) - { - const struct imsm_orom *cap = get_orom_by_device_id(hba->dev_id); -@@ -504,10 +543,13 @@ const struct imsm_orom *find_imsm_capability(struct sys_dev *hba) - if (cap) - return cap; - -+ if (hba->type == SYS_DEV_NVME) -+ return find_imsm_nvme(hba); - if ((cap = find_imsm_efi(hba)) != NULL) - return cap; - if ((cap = find_imsm_hba_orom(hba)) != NULL) - return cap; -+ - return NULL; - } - -diff --git a/platform-intel.h b/platform-intel.h -index e41f386..6b4ebd8 100644 ---- a/platform-intel.h -+++ b/platform-intel.h -@@ -23,6 +23,7 @@ - struct imsm_orom { - __u8 signature[4]; - #define IMSM_OROM_SIGNATURE "$VER" -+ #define IMSM_NVME_OROM_COMPAT_SIGNATURE "$NVM" - __u8 table_ver_major; /* Currently 2 (can change with future revs) */ - __u8 table_ver_minor; /* Currently 2 (can change with future revs) */ - __u16 major_ver; /* Example: 8 as in 8.6.0.1020 */ -@@ -60,12 +61,15 @@ struct imsm_orom { - #define IMSM_OROM_SSS_64MB (1 << 15) - __u16 dpa; /* Disks Per Array supported */ - #define IMSM_OROM_DISKS_PER_ARRAY 6 -+ #define IMSM_OROM_DISKS_PER_ARRAY_NVME 12 - __u16 tds; /* Total Disks Supported */ - #define IMSM_OROM_TOTAL_DISKS 6 -+ #define IMSM_OROM_TOTAL_DISKS_NVME 12 - __u8 vpa; /* # Volumes Per Array supported */ - #define IMSM_OROM_VOLUMES_PER_ARRAY 2 - __u8 vphba; /* # Volumes Per Host Bus Adapter supported */ - #define IMSM_OROM_VOLUMES_PER_HBA 4 -+ #define IMSM_OROM_VOLUMES_PER_HBA_NVME 4 - /* Attributes supported. This should map to the - * attributes in the MPB. Also, lower 16 bits - * should match/duplicate RLC bits above. -@@ -173,6 +177,7 @@ enum sys_dev_type { - SYS_DEV_UNKNOWN = 0, - SYS_DEV_SAS, - SYS_DEV_SATA, -+ SYS_DEV_NVME, - SYS_DEV_MAX - }; - -diff --git a/super-intel.c b/super-intel.c -index dabf011..d2ee1c6 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -509,7 +509,8 @@ struct imsm_update_add_remove_disk { - static const char *_sys_dev_type[] = { - [SYS_DEV_UNKNOWN] = "Unknown", - [SYS_DEV_SAS] = "SAS", -- [SYS_DEV_SATA] = "SATA" -+ [SYS_DEV_SATA] = "SATA", -+ [SYS_DEV_NVME] = "NVMe" - }; - - const char *get_sys_dev_type(enum sys_dev_type type) -@@ -559,7 +560,7 @@ static int attach_hba_to_super(struct intel_super *super, struct sys_dev *device - - hba = super->hba; - /* Intel metadata allows for all disks attached to the same type HBA. -- * Do not sypport odf HBA types mixing -+ * Do not support HBA types mixing - */ - if (device->type != hba->type) - return 2; -@@ -3841,9 +3842,9 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de - " but the container is assigned to Intel(R) " - "%s RAID controller (", - devname, -- hba_name->path, -+ get_sys_dev_type(hba_name->type), - hba_name->pci_id ? : "Err!", -- get_sys_dev_type(hba_name->type)); -+ get_sys_dev_type(super->hba->type)); - - while (hba) { - fprintf(stderr, "%s", hba->pci_id ? : "Err!"); -@@ -3860,6 +3861,7 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de - super->orom = find_imsm_capability(hba_name); - if (!super->orom) - return 3; -+ - return 0; - } - -@@ -5916,6 +5918,7 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout, - pr_vrb(": platform does not support a volume size over 2TB\n"); - return 0; - } -+ - return 1; - } - --- -2.4.3 - diff --git a/SOURCES/mdadm-3.3.2-imsm-detail-platform-improvements.patch b/SOURCES/mdadm-3.3.2-imsm-detail-platform-improvements.patch deleted file mode 100644 index bfbd610..0000000 --- a/SOURCES/mdadm-3.3.2-imsm-detail-platform-improvements.patch +++ /dev/null @@ -1,299 +0,0 @@ -From 0858eccf86e9b3611d711717ec65a042f5c7ff9f Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Wed, 19 Nov 2014 13:53:29 +0100 -Subject: [PATCH] imsm: detail-platform improvements - -Print platform details per OROM, not per controller, differentiate -RST(e) platforms from legacy IMSM, print NVMe device paths, adjust port -printing to newer sysfs path. - -Signed-off-by: Artur Paszkiewicz -Signed-off-by: Pawel Baldysiak -Signed-off-by: NeilBrown ---- - platform-intel.c | 26 ++++++++++------ - platform-intel.h | 23 ++++++++++++++ - super-intel.c | 93 ++++++++++++++++++++++++++++++++++++++------------------ - 3 files changed, 103 insertions(+), 39 deletions(-) - -diff --git a/platform-intel.c b/platform-intel.c -index ae72827..54ef37f 100644 ---- a/platform-intel.c -+++ b/platform-intel.c -@@ -134,6 +134,16 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver) - static struct sys_dev *intel_devices=NULL; - static time_t valid_time = 0; - -+struct sys_dev *device_by_id(__u16 device_id) -+{ -+ struct sys_dev *iter; -+ -+ for (iter = intel_devices; iter != NULL; iter = iter->next) -+ if (iter->dev_id == device_id) -+ return iter; -+ return NULL; -+} -+ - static int devpath_to_ll(const char *dev_path, const char *entry, unsigned long long *val) - { - char path[strlen(dev_path) + strlen(entry) + 2]; -@@ -219,18 +229,13 @@ struct pciExpDataStructFormat { - __u16 devListOffset; - } __attribute__ ((packed)); - --struct devid_list { -- __u16 devid; -- struct devid_list *next; --}; -- --struct orom_entry { -- struct imsm_orom orom; -- struct devid_list *devid_list; --}; -- - static struct orom_entry oroms[SYS_DEV_MAX]; - -+const struct orom_entry *get_oroms(void) -+{ -+ return (const struct orom_entry *)&oroms; -+} -+ - const struct imsm_orom *get_orom_by_device_id(__u16 dev_id) - { - int i; -@@ -529,6 +534,7 @@ const struct imsm_orom *find_imsm_nvme(struct sys_dev *hba) - .vpa = IMSM_OROM_VOLUMES_PER_ARRAY, - .vphba = IMSM_OROM_TOTAL_DISKS_NVME / 2 * IMSM_OROM_VOLUMES_PER_ARRAY, - .attr = IMSM_OROM_ATTR_2TB | IMSM_OROM_ATTR_2TB_DISK, -+ .driver_features = IMSM_OROM_CAPABILITIES_EnterpriseSystem - }; - nvme_orom = add_orom(&nvme_orom_compat); - } -diff --git a/platform-intel.h b/platform-intel.h -index 6b4ebd8..3e85d44 100644 ---- a/platform-intel.h -+++ b/platform-intel.h -@@ -173,6 +173,17 @@ static inline int fls(int x) - return r; - } - -+static inline int imsm_orom_is_enterprise(const struct imsm_orom *orom) -+{ -+ return !!(orom->driver_features & IMSM_OROM_CAPABILITIES_EnterpriseSystem); -+} -+ -+static inline int imsm_orom_is_nvme(const struct imsm_orom *orom) -+{ -+ return memcmp(orom->signature, IMSM_NVME_OROM_COMPAT_SIGNATURE, -+ sizeof(orom->signature)) == 0; -+} -+ - enum sys_dev_type { - SYS_DEV_UNKNOWN = 0, - SYS_DEV_SAS, -@@ -194,6 +205,16 @@ struct efi_guid { - __u8 b[16]; - }; - -+struct devid_list { -+ __u16 devid; -+ struct devid_list *next; -+}; -+ -+struct orom_entry { -+ struct imsm_orom orom; -+ struct devid_list *devid_list; -+}; -+ - static inline char *guid_str(char *buf, struct efi_guid guid) - { - sprintf(buf, "%02x%02x%02x%02x-%02x%02x-%02x%02x-" -@@ -215,4 +236,6 @@ int devt_attached_to_hba(dev_t dev, const char *hba_path); - char *devt_to_devpath(dev_t dev); - int path_attached_to_hba(const char *disk_path, const char *hba_path); - const char *get_sys_dev_type(enum sys_dev_type); -+const struct orom_entry * get_oroms(void); - const struct imsm_orom *get_orom_by_device_id(__u16 device_id); -+struct sys_dev *device_by_id(__u16 device_id); -diff --git a/super-intel.c b/super-intel.c -index d2ee1c6..4c53019 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -1709,7 +1709,8 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b - break; - } - *c = '\0'; -- if (sscanf(&path[hba_len], "host%d", &port) == 1) -+ if ((sscanf(&path[hba_len], "ata%d", &port) == 1) || -+ ((sscanf(&path[hba_len], "host%d", &port) == 1))) - port -= host_base; - else { - if (verbose > 0) { -@@ -1768,6 +1769,8 @@ static void print_found_intel_controllers(struct sys_dev *elem) - fprintf(stderr, "SATA "); - else if (elem->type == SYS_DEV_SAS) - fprintf(stderr, "SAS "); -+ else if (elem->type == SYS_DEV_NVME) -+ fprintf(stderr, "NVMe "); - fprintf(stderr, "RAID controller"); - if (elem->pci_id) - fprintf(stderr, " at %s", elem->pci_id); -@@ -1789,7 +1792,8 @@ static int ahci_get_port_count(const char *hba_path, int *port_count) - for (ent = readdir(dir); ent; ent = readdir(dir)) { - int host; - -- if (sscanf(ent->d_name, "host%d", &host) != 1) -+ if ((sscanf(ent->d_name, "ata%d", &host) != 1) && -+ ((sscanf(ent->d_name, "host%d", &host) != 1))) - continue; - if (*port_count == 0) - host_base = host; -@@ -1805,9 +1809,15 @@ static int ahci_get_port_count(const char *hba_path, int *port_count) - - static void print_imsm_capability(const struct imsm_orom *orom) - { -- printf(" Platform : Intel(R) Matrix Storage Manager\n"); -- printf(" Version : %d.%d.%d.%d\n", orom->major_ver, orom->minor_ver, -- orom->hotfix_ver, orom->build); -+ printf(" Platform : Intel(R) "); -+ if (orom->capabilities == 0 && orom->driver_features == 0) -+ printf("Matrix Storage Manager\n"); -+ else -+ printf("Rapid Storage Technology%s\n", -+ imsm_orom_is_enterprise(orom) ? " enterprise" : ""); -+ if (orom->major_ver || orom->minor_ver || orom->hotfix_ver || orom->build) -+ printf(" Version : %d.%d.%d.%d\n", orom->major_ver, -+ orom->minor_ver, orom->hotfix_ver, orom->build); - printf(" RAID Levels :%s%s%s%s%s\n", - imsm_orom_has_raid0(orom) ? " raid0" : "", - imsm_orom_has_raid1(orom) ? " raid1" : "", -@@ -1836,16 +1846,18 @@ static void print_imsm_capability(const struct imsm_orom *orom) - printf(" 2TB disks :%s supported\n", - (orom->attr & IMSM_OROM_ATTR_2TB_DISK)?"":" not"); - printf(" Max Disks : %d\n", orom->tds); -- printf(" Max Volumes : %d per array, %d per controller\n", -- orom->vpa, orom->vphba); -+ printf(" Max Volumes : %d per array, %d per %s\n", -+ orom->vpa, orom->vphba, -+ imsm_orom_is_nvme(orom) ? "platform" : "controller"); - return; - } - - static void print_imsm_capability_export(const struct imsm_orom *orom) - { - printf("MD_FIRMWARE_TYPE=imsm\n"); -- printf("IMSM_VERSION=%d.%d.%d.%d\n",orom->major_ver, orom->minor_ver, -- orom->hotfix_ver, orom->build); -+ if (orom->major_ver || orom->minor_ver || orom->hotfix_ver || orom->build) -+ printf("IMSM_VERSION=%d.%d.%d.%d\n", orom->major_ver, orom->minor_ver, -+ orom->hotfix_ver, orom->build); - printf("IMSM_SUPPORTED_RAID_LEVELS=%s%s%s%s%s\n", - imsm_orom_has_raid0(orom) ? "raid0 " : "", - imsm_orom_has_raid1(orom) ? "raid1 " : "", -@@ -1889,7 +1901,6 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle - * platform capabilities. If raid support is disabled in the BIOS the - * option-rom capability structure will not be available. - */ -- const struct imsm_orom *orom; - struct sys_dev *list, *hba; - int host_base = 0; - int port_count = 0; -@@ -1922,15 +1933,42 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle - print_found_intel_controllers(list); - - for (hba = list; hba; hba = hba->next) { -- if (controller_path && (compare_paths(hba->path,controller_path) != 0)) -+ if (controller_path && (compare_paths(hba->path, controller_path) != 0)) - continue; -- orom = find_imsm_capability(hba); -- if (!orom) -+ if (!find_imsm_capability(hba)) { - pr_err("imsm capabilities not found for controller: %s (type %s)\n", - hba->path, get_sys_dev_type(hba->type)); -- else { -- result = 0; -- print_imsm_capability(orom); -+ continue; -+ } -+ result = 0; -+ } -+ -+ if (controller_path && result == 1) { -+ pr_err("no active Intel(R) RAID controller found under %s\n", -+ controller_path); -+ return result; -+ } -+ -+ const struct orom_entry *oroms = get_oroms(); -+ int i; -+ -+ for (i = 0; i < SYS_DEV_MAX && oroms[i].devid_list; i++) { -+ print_imsm_capability(&oroms[i].orom); -+ -+ if (imsm_orom_is_nvme(&oroms[i].orom)) { -+ for (hba = list; hba; hba = hba->next) { -+ if (hba->type == SYS_DEV_NVME) -+ printf(" NVMe Device : %s\n", hba->path); -+ } -+ continue; -+ } -+ -+ struct devid_list *devid; -+ for (devid = oroms[i].devid_list; devid; devid = devid->next) { -+ hba = device_by_id(devid->devid); -+ if (!hba) -+ continue; -+ - printf(" I/O Controller : %s (%s)\n", - hba->path, get_sys_dev_type(hba->type)); - if (hba->type == SYS_DEV_SATA) { -@@ -1943,18 +1981,14 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle - } - } - } -+ printf("\n"); - } - -- if (controller_path && result == 1) -- pr_err("no active Intel(R) RAID " -- "controller found under %s\n",controller_path); -- - return result; - } - - static int export_detail_platform_imsm(int verbose, char *controller_path) - { -- const struct imsm_orom *orom; - struct sys_dev *list, *hba; - int result=1; - -@@ -1969,17 +2003,18 @@ static int export_detail_platform_imsm(int verbose, char *controller_path) - for (hba = list; hba; hba = hba->next) { - if (controller_path && (compare_paths(hba->path,controller_path) != 0)) - continue; -- orom = find_imsm_capability(hba); -- if (!orom) { -- if (verbose > 0) -- pr_err("IMSM_DETAIL_PLATFORM_ERROR=NO_IMSM_CAPABLE_DEVICE_UNDER_%s\n",hba->path); -- } -- else { -- print_imsm_capability_export(orom); -+ if (!find_imsm_capability(hba) && verbose > 0) -+ pr_err("IMSM_DETAIL_PLATFORM_ERROR=NO_IMSM_CAPABLE_DEVICE_UNDER_%s\n", hba->path); -+ else - result = 0; -- } - } - -+ const struct orom_entry *oroms = get_oroms(); -+ int i; -+ -+ for (i = 0; i < SYS_DEV_MAX && oroms[i].devid_list; i++) -+ print_imsm_capability_export(&oroms[i].orom); -+ - return result; - } - --- -2.4.3 - diff --git a/SOURCES/mdadm-3.3.2-imsm-don-t-call-abort_reshape-in-imsm_manage_reshape.patch b/SOURCES/mdadm-3.3.2-imsm-don-t-call-abort_reshape-in-imsm_manage_reshape.patch deleted file mode 100644 index 023c891..0000000 --- a/SOURCES/mdadm-3.3.2-imsm-don-t-call-abort_reshape-in-imsm_manage_reshape.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 2139b03c2080e6f4e442ff6b7a0f6ffd30decb8b Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Mon, 5 Oct 2015 15:18:11 +0200 -Subject: [PATCH] imsm: don't call abort_reshape() in imsm_manage_reshape() - -Calling abort_reshape() in imsm_manage_reshape() is unnecessary in case -of an error because it is handled by reshape_array(). Calling it when -reshape completes successfully is also unnecessary and leads to a race -condition: -- reshape ends -- mdadm calls abort_reshape() -> sets sync_action to idle -- MD_RECOVERY_INTR is set and md_reap_sync_thread() does not finish the - reshape - -Signed-off-by: Artur Paszkiewicz -Signed-off-by: Konrad Dabrowski -Signed-off-by: NeilBrown ---- - super-intel.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/super-intel.c b/super-intel.c -index 95a72b6..e609e0c 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -10601,7 +10601,6 @@ static int imsm_manage_reshape( - ret_val = 1; - abort: - free(buf); -- abort_reshape(sra); - - return ret_val; - } --- -2.5.0 - diff --git a/SOURCES/mdadm-3.3.2-imsm-don-t-update-migration-record-when-reshape-is-i.patch b/SOURCES/mdadm-3.3.2-imsm-don-t-update-migration-record-when-reshape-is-i.patch deleted file mode 100644 index 7611046..0000000 --- a/SOURCES/mdadm-3.3.2-imsm-don-t-update-migration-record-when-reshape-is-i.patch +++ /dev/null @@ -1,42 +0,0 @@ -From c85338c67570ec346bbd7fb0948bb0da4b43bcc3 Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Tue, 5 Jan 2016 17:16:16 +0100 -Subject: [PATCH] imsm: don't update migration record when reshape is - interrupted - -Abort imsm_manage_reshape() without updating the migration record if any -error occurs when checking progress. If reshape is interrupted and the -migration record is then updated, the checkpoint will be wrong and will -cause reshape to fail when the array is restarted. - -Signed-off-by: Artur Paszkiewicz -Signed-off-by: NeilBrown ---- - super-intel.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/super-intel.c b/super-intel.c -index 3b3d561..90b7b6d 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -10373,7 +10373,7 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) - dprintf("imsm: wait_for_reshape_imsm() " - "cannot read reshape_position (no reshape in progres)\n"); - close(fd); -- return 0; -+ return 1; - } - - if (completed > position_to_set) { -@@ -10662,7 +10662,7 @@ static int imsm_manage_reshape( - sra->reshape_progress = next_step; - - /* wait until reshape finish */ -- if (wait_for_reshape_imsm(sra, ndata) < 0) { -+ if (wait_for_reshape_imsm(sra, ndata)) { - dprintf("wait_for_reshape_imsm returned error!\n"); - goto abort; - } --- -2.5.0 - diff --git a/SOURCES/mdadm-3.3.2-imsm-support-for-OROMs-shared-by-multiple-HBAs.patch b/SOURCES/mdadm-3.3.2-imsm-support-for-OROMs-shared-by-multiple-HBAs.patch deleted file mode 100644 index 10d58ae..0000000 --- a/SOURCES/mdadm-3.3.2-imsm-support-for-OROMs-shared-by-multiple-HBAs.patch +++ /dev/null @@ -1,644 +0,0 @@ -From 6b781d331bf52b01b9bafa6409ffb400f8c62895 Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Wed, 19 Nov 2014 13:53:26 +0100 -Subject: [PATCH] imsm: support for OROMs shared by multiple HBAs - -The IMSM platform code was based on an assumption that the OROM or UEFI -capability structure (represented by struct imsm_orom) always belongs to -only one HBA. This assumption is no longer valid, because of newer -platforms with dual AHCI HBAs. Each HBA can have a separate OROM, but -some versions have a combined OROM for both HBAs. - -This patch implements this HBA-OROM relationship in struct orom_entry, -which matches an OROM with a list of HBA PCI ids. All the detected -orom_entries are stored and retrieved using a global array and the -functions add_orom(), add_orom_device_id() and get_orom_by_device_id(). -This replaces the arrays: imsm_orom, populated_orom, imsm_efi, -populated_efi. - -The scan() function is extended to find all HBAs for an OROM. The list -of their device ids is retrieved from the PCI Expansion ROM Data -Structure, hence the additional field devListOffset in struct -pciExpDataStructFormat. - -In UEFI mode we can't read the PCI Expansion ROM Data Structure and the -imsm_orom structures are stored in UEFI variables. They do not provide a -similar device id list, so we also check the HBA PCI class to make sure -that the HBA has RAID mode enabled. - -In super-intel.c there are changes which allow spanning of IMSM -containers over HBAs of the same type, but only if the HBAs share the -same OROM. This is done by comparing imsm_orom pointers, which (outside -of platform-intel.c) always point to the global array containing all the -detected oroms. Additional warnings are added to -validate_container_imsm() to warn about potentially dangerous operations -in all the possible cases, e.g. when an array is assembled using disks -attached to HBAs with separate OROMs. - -Signed-off-by: Artur Paszkiewicz -Signed-off-by: NeilBrown ---- - platform-intel.c | 248 ++++++++++++++++++++++++++++++++----------------------- - platform-intel.h | 5 +- - super-intel.c | 134 +++++++++++++++++++++--------- - 3 files changed, 243 insertions(+), 144 deletions(-) - -diff --git a/platform-intel.c b/platform-intel.c -index f347382..f779d02 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 = xmalloc(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 = realpath(path, NULL); - list->next = NULL; -@@ -127,16 +132,6 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver) - static struct sys_dev *intel_devices=NULL; - static time_t valid_time = 0; - --static enum sys_dev_type device_type_by_id(__u16 device_id) --{ -- struct sys_dev *iter; -- -- for(iter = intel_devices; iter != NULL; iter = iter->next) -- if (iter->dev_id == device_id) -- return iter->type; -- return SYS_DEV_UNKNOWN; --} -- - static int devpath_to_ll(const char *dev_path, const char *entry, unsigned long long *val) - { - char path[strlen(dev_path) + strlen(entry) + 2]; -@@ -209,16 +204,79 @@ struct pciExpDataStructFormat { - __u8 ver[4]; - __u16 vendorID; - __u16 deviceID; -+ __u16 devListOffset; - } __attribute__ ((packed)); - --static struct imsm_orom imsm_orom[SYS_DEV_MAX]; --static int populated_orom[SYS_DEV_MAX]; -+struct devid_list { -+ __u16 devid; -+ struct devid_list *next; -+}; -+ -+struct orom_entry { -+ struct imsm_orom orom; -+ struct devid_list *devid_list; -+}; -+ -+static struct orom_entry oroms[SYS_DEV_MAX]; -+ -+const struct imsm_orom *get_orom_by_device_id(__u16 dev_id) -+{ -+ int i; -+ struct devid_list *list; -+ -+ for (i = 0; i < SYS_DEV_MAX; i++) { -+ for (list = oroms[i].devid_list; list; list = list->next) { -+ if (list->devid == dev_id) -+ return &oroms[i].orom; -+ } -+ } -+ return NULL; -+} -+ -+static const struct imsm_orom *add_orom(const struct imsm_orom *orom) -+{ -+ int i; -+ -+ for (i = 0; i < SYS_DEV_MAX; i++) { -+ if (&oroms[i].orom == orom) -+ return orom; -+ if (oroms[i].orom.signature[0] == 0) { -+ oroms[i].orom = *orom; -+ return &oroms[i].orom; -+ } -+ } -+ return NULL; -+} -+ -+static void add_orom_device_id(const struct imsm_orom *orom, __u16 dev_id) -+{ -+ int i; -+ struct devid_list *list; -+ struct devid_list *prev = NULL; -+ -+ for (i = 0; i < SYS_DEV_MAX; i++) { -+ if (&oroms[i].orom == orom) { -+ for (list = oroms[i].devid_list; list; prev = list, list = list->next) { -+ if (list->devid == dev_id) -+ return; -+ } -+ list = xmalloc(sizeof(struct devid_list)); -+ list->devid = dev_id; -+ list->next = NULL; -+ -+ if (prev == NULL) -+ oroms[i].devid_list = list; -+ else -+ prev->next = list; -+ return; -+ } -+ } -+} - - static int scan(const void *start, const void *end, const void *data) - { - int offset; -- const struct imsm_orom *imsm_mem; -- int dev; -+ const struct imsm_orom *imsm_mem = NULL; - int len = (end - start); - struct pciExpDataStructFormat *ptr= (struct pciExpDataStructFormat *)data; - -@@ -231,81 +289,83 @@ static int scan(const void *start, const void *end, const void *data) - (ulong) __le16_to_cpu(ptr->vendorID), - (ulong) __le16_to_cpu(ptr->deviceID)); - -- if (__le16_to_cpu(ptr->vendorID) == 0x8086) { -- /* serach attached intel devices by device id from OROM */ -- dev = device_type_by_id(__le16_to_cpu(ptr->deviceID)); -- if (dev == SYS_DEV_UNKNOWN) -- return 0; -- } -- else -+ if (__le16_to_cpu(ptr->vendorID) != 0x8086) - return 0; - - for (offset = 0; offset < len; offset += 4) { -- imsm_mem = start + offset; -- if ((memcmp(imsm_mem->signature, "$VER", 4) == 0)) { -- imsm_orom[dev] = *imsm_mem; -- populated_orom[dev] = 1; -- return populated_orom[SYS_DEV_SATA] && populated_orom[SYS_DEV_SAS]; -+ const void *mem = start + offset; -+ -+ if ((memcmp(mem, IMSM_OROM_SIGNATURE, 4) == 0)) { -+ imsm_mem = mem; -+ break; - } - } -+ -+ if (!imsm_mem) -+ return 0; -+ -+ const struct imsm_orom *orom = add_orom(imsm_mem); -+ -+ if (ptr->devListOffset) { -+ const __u16 *dev_list = (void *)ptr + ptr->devListOffset; -+ int i; -+ -+ for (i = 0; dev_list[i] != 0; i++) -+ add_orom_device_id(orom, dev_list[i]); -+ } else { -+ add_orom_device_id(orom, __le16_to_cpu(ptr->deviceID)); -+ } -+ - return 0; - } - --const struct imsm_orom *imsm_platform_test(enum sys_dev_type hba_id, int *populated, -- struct imsm_orom *imsm_orom) -+const struct imsm_orom *imsm_platform_test(struct sys_dev *hba) - { -- memset(imsm_orom, 0, sizeof(*imsm_orom)); -- imsm_orom->rlc = IMSM_OROM_RLC_RAID0 | IMSM_OROM_RLC_RAID1 | -- IMSM_OROM_RLC_RAID10 | IMSM_OROM_RLC_RAID5; -- imsm_orom->sss = IMSM_OROM_SSS_4kB | IMSM_OROM_SSS_8kB | -- IMSM_OROM_SSS_16kB | IMSM_OROM_SSS_32kB | -- IMSM_OROM_SSS_64kB | IMSM_OROM_SSS_128kB | -- IMSM_OROM_SSS_256kB | IMSM_OROM_SSS_512kB | -- IMSM_OROM_SSS_1MB | IMSM_OROM_SSS_2MB; -- imsm_orom->dpa = IMSM_OROM_DISKS_PER_ARRAY; -- imsm_orom->tds = IMSM_OROM_TOTAL_DISKS; -- imsm_orom->vpa = IMSM_OROM_VOLUMES_PER_ARRAY; -- imsm_orom->vphba = IMSM_OROM_VOLUMES_PER_HBA; -- imsm_orom->attr = imsm_orom->rlc | IMSM_OROM_ATTR_ChecksumVerify; -- *populated = 1; -+ struct imsm_orom orom = { -+ .signature = IMSM_OROM_SIGNATURE, -+ .rlc = IMSM_OROM_RLC_RAID0 | IMSM_OROM_RLC_RAID1 | -+ IMSM_OROM_RLC_RAID10 | IMSM_OROM_RLC_RAID5, -+ .sss = IMSM_OROM_SSS_4kB | IMSM_OROM_SSS_8kB | -+ IMSM_OROM_SSS_16kB | IMSM_OROM_SSS_32kB | -+ IMSM_OROM_SSS_64kB | IMSM_OROM_SSS_128kB | -+ IMSM_OROM_SSS_256kB | IMSM_OROM_SSS_512kB | -+ IMSM_OROM_SSS_1MB | IMSM_OROM_SSS_2MB, -+ .dpa = IMSM_OROM_DISKS_PER_ARRAY, -+ .tds = IMSM_OROM_TOTAL_DISKS, -+ .vpa = IMSM_OROM_VOLUMES_PER_ARRAY, -+ .vphba = IMSM_OROM_VOLUMES_PER_HBA -+ }; -+ orom.attr = orom.rlc | IMSM_OROM_ATTR_ChecksumVerify; - - if (check_env("IMSM_TEST_OROM_NORAID5")) { -- imsm_orom->rlc = IMSM_OROM_RLC_RAID0 | IMSM_OROM_RLC_RAID1 | -+ orom.rlc = IMSM_OROM_RLC_RAID0 | IMSM_OROM_RLC_RAID1 | - IMSM_OROM_RLC_RAID10; - } -- if (check_env("IMSM_TEST_AHCI_EFI_NORAID5") && (hba_id == SYS_DEV_SAS)) { -- imsm_orom->rlc = IMSM_OROM_RLC_RAID0 | IMSM_OROM_RLC_RAID1 | -+ if (check_env("IMSM_TEST_AHCI_EFI_NORAID5") && (hba->type == SYS_DEV_SAS)) { -+ orom.rlc = IMSM_OROM_RLC_RAID0 | IMSM_OROM_RLC_RAID1 | - IMSM_OROM_RLC_RAID10; - } -- if (check_env("IMSM_TEST_SCU_EFI_NORAID5") && (hba_id == SYS_DEV_SATA)) { -- imsm_orom->rlc = IMSM_OROM_RLC_RAID0 | IMSM_OROM_RLC_RAID1 | -+ if (check_env("IMSM_TEST_SCU_EFI_NORAID5") && (hba->type == SYS_DEV_SATA)) { -+ orom.rlc = IMSM_OROM_RLC_RAID0 | IMSM_OROM_RLC_RAID1 | - IMSM_OROM_RLC_RAID10; - } - -- return imsm_orom; -+ const struct imsm_orom *ret = add_orom(&orom); -+ -+ add_orom_device_id(ret, hba->dev_id); -+ -+ return ret; - } - --static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id) -+static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba) - { - unsigned long align; - -- if (hba_id >= SYS_DEV_MAX) -- return NULL; -+ if (check_env("IMSM_TEST_OROM")) -+ return imsm_platform_test(hba); - -- /* it's static data so we only need to read it once */ -- if (populated_orom[hba_id]) { -- dprintf("OROM CAP: %p, pid: %d pop: %d\n", -- &imsm_orom[hba_id], (int) getpid(), populated_orom[hba_id]); -- return &imsm_orom[hba_id]; -- } -- if (check_env("IMSM_TEST_OROM")) { -- dprintf("OROM CAP: %p, pid: %d pop: %d\n", -- &imsm_orom[hba_id], (int) getpid(), populated_orom[hba_id]); -- return imsm_platform_test(hba_id, &populated_orom[hba_id], &imsm_orom[hba_id]); -- } - /* return empty OROM capabilities in EFI test mode */ -- if (check_env("IMSM_TEST_AHCI_EFI") || -- check_env("IMSM_TEST_SCU_EFI")) -+ if (check_env("IMSM_TEST_AHCI_EFI") || check_env("IMSM_TEST_SCU_EFI")) - return NULL; - - find_intel_devices(); -@@ -325,9 +385,7 @@ static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id) - scan_adapter_roms(scan); - probe_roms_exit(); - -- if (populated_orom[hba_id]) -- return &imsm_orom[hba_id]; -- return NULL; -+ return get_orom_by_device_id(hba->dev_id); - } - - #define GUID_STR_MAX 37 /* according to GUID format: -@@ -347,9 +405,7 @@ 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) - --int populated_efi[SYS_DEV_MAX] = { 0, 0 }; -- --static struct imsm_orom imsm_efi[SYS_DEV_MAX]; -+#define PCI_CLASS_RAID_CNTRL 0x010400 - - int read_efi_variable(void *buffer, ssize_t buf_size, char *variable_name, struct efi_guid guid) - { -@@ -395,54 +451,40 @@ int read_efi_variable(void *buffer, ssize_t buf_size, char *variable_name, struc - return 0; - } - --const struct imsm_orom *find_imsm_efi(enum sys_dev_type hba_id) -+const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) - { -- if (hba_id >= SYS_DEV_MAX) -- return NULL; -+ struct imsm_orom orom; -+ const struct imsm_orom *ret; - -- dprintf("EFI CAP: %p, pid: %d pop: %d\n", -- &imsm_efi[hba_id], (int) getpid(), populated_efi[hba_id]); -+ if (check_env("IMSM_TEST_AHCI_EFI") || check_env("IMSM_TEST_SCU_EFI")) -+ return imsm_platform_test(hba); - -- /* it's static data so we only need to read it once */ -- if (populated_efi[hba_id]) { -- dprintf("EFI CAP: %p, pid: %d pop: %d\n", -- &imsm_efi[hba_id], (int) getpid(), populated_efi[hba_id]); -- return &imsm_efi[hba_id]; -- } -- if (check_env("IMSM_TEST_AHCI_EFI") || -- check_env("IMSM_TEST_SCU_EFI")) { -- dprintf("OROM CAP: %p, pid: %d pop: %d\n", -- &imsm_efi[hba_id], (int) getpid(), populated_efi[hba_id]); -- return imsm_platform_test(hba_id, &populated_efi[hba_id], &imsm_efi[hba_id]); -- } - /* OROM test is set, return that there is no EFI capabilities */ - 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)) { -- populated_efi[hba_id] = 0; -+ if (hba->type == SYS_DEV_SATA && hba->class != PCI_CLASS_RAID_CNTRL) - return NULL; -- } - -- populated_efi[hba_id] = 1; -- return &imsm_efi[hba_id]; --} -+ if (read_efi_variable(&orom, sizeof(orom), hba->type == SYS_DEV_SAS ? SCU_PROP : AHCI_PROP, VENDOR_GUID)) -+ return NULL; - --/* -- * backward interface compatibility -- */ --const struct imsm_orom *find_imsm_orom(void) --{ -- return find_imsm_hba_orom(SYS_DEV_SATA); -+ ret = add_orom(&orom); -+ add_orom_device_id(ret, hba->dev_id); -+ -+ return ret; - } - --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; -+ const struct imsm_orom *cap = get_orom_by_device_id(hba->dev_id); -+ -+ if (cap) -+ return cap; - -- if ((cap = find_imsm_efi(hba_id)) != NULL) -+ if ((cap = find_imsm_efi(hba)) != NULL) - return cap; -- if ((cap = find_imsm_hba_orom(hba_id)) != NULL) -+ if ((cap = find_imsm_hba_orom(hba)) != NULL) - return cap; - return NULL; - } -diff --git a/platform-intel.h b/platform-intel.h -index 8226be3..e41f386 100644 ---- a/platform-intel.h -+++ b/platform-intel.h -@@ -22,6 +22,7 @@ - /* The IMSM Capability (IMSM AHCI and ISCU OROM/EFI variable) Version Table definition */ - struct imsm_orom { - __u8 signature[4]; -+ #define IMSM_OROM_SIGNATURE "$VER" - __u8 table_ver_major; /* Currently 2 (can change with future revs) */ - __u8 table_ver_minor; /* Currently 2 (can change with future revs) */ - __u16 major_ver; /* Example: 8 as in 8.6.0.1020 */ -@@ -180,6 +181,7 @@ struct sys_dev { - char *path; - char *pci_id; - __u16 dev_id; -+ __u32 class; - struct sys_dev *next; - }; - -@@ -201,10 +203,11 @@ 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); --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); - int devt_attached_to_hba(dev_t dev, const char *hba_path); - char *devt_to_devpath(dev_t dev); - int path_attached_to_hba(const char *disk_path, const char *hba_path); - const char *get_sys_dev_type(enum sys_dev_type); -+const struct imsm_orom *get_orom_by_device_id(__u16 device_id); -diff --git a/super-intel.c b/super-intel.c -index e28ac7d..dabf011 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -555,11 +555,26 @@ 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; -- } else -- /* IMSM metadata disallows to attach disks to multiple -- * controllers. -- */ -+ } -+ -+ 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) -+ return 2; -+ -+ /* Multiple same type HBAs can be used if they share the same OROM */ -+ const struct imsm_orom *device_orom = get_orom_by_device_id(device->dev_id); -+ -+ if (device_orom != super->orom) - 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) -@@ -1886,13 +1901,12 @@ 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 = 0; -+ result = 2; - } - return result; - } -@@ -1909,7 +1923,7 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle - for (hba = list; hba; hba = hba->next) { - if (controller_path && (compare_paths(hba->path,controller_path) != 0)) - continue; -- orom = find_imsm_capability(hba->type); -+ orom = find_imsm_capability(hba); - if (!orom) - pr_err("imsm capabilities not found for controller: %s (type %s)\n", - hba->path, get_sys_dev_type(hba->type)); -@@ -1954,7 +1968,7 @@ static int export_detail_platform_imsm(int verbose, char *controller_path) - for (hba = list; hba; hba = hba->next) { - if (controller_path && (compare_paths(hba->path,controller_path) != 0)) - continue; -- orom = find_imsm_capability(hba->type); -+ orom = find_imsm_capability(hba); - if (!orom) { - if (verbose > 0) - pr_err("IMSM_DETAIL_PLATFORM_ERROR=NO_IMSM_CAPABLE_DEVICE_UNDER_%s\n",hba->path); -@@ -3087,13 +3101,18 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst) - * use the same Intel hba - * If not on Intel hba at all, allow anything. - */ -- if (!check_env("IMSM_NO_PLATFORM")) { -- if (first->hba && sec->hba && -- strcmp(first->hba->path, sec->hba->path) != 0) { -+ if (!check_env("IMSM_NO_PLATFORM") && first->hba && sec->hba) { -+ if (first->hba->type != sec->hba->type) { -+ fprintf(stderr, -+ "HBAs of devices do not match %s != %s\n", -+ get_sys_dev_type(first->hba->type), -+ get_sys_dev_type(sec->hba->type)); -+ return 3; -+ } -+ if (first->orom != sec->orom) { - fprintf(stderr, -- "HBAs of devices does not match %s != %s\n", -- first->hba ? first->hba->path : NULL, -- sec->hba ? sec->hba->path : NULL); -+ "HBAs of devices do not match %s != %s\n", -+ first->hba->pci_id, sec->hba->pci_id); - return 3; - } - } -@@ -3832,14 +3851,13 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de - fprintf(stderr, ", "); - hba = hba->next; - } -- -- fprintf(stderr, ").\n"); -- cont_err("Mixing devices attached to multiple controllers " -- "is not allowed.\n"); -+ fprintf(stderr, ").\n" -+ " Mixing devices attached to different controllers " -+ "is not allowed.\n"); - } - return 2; - } -- super->orom = find_imsm_capability(hba_name->type); -+ super->orom = find_imsm_capability(hba_name); - if (!super->orom) - return 3; - return 0; -@@ -9061,32 +9079,68 @@ int open_backup_targets(struct mdinfo *info, int raid_disks, int *raid_fds, - ******************************************************************************/ - int validate_container_imsm(struct mdinfo *info) - { -- if (!check_env("IMSM_NO_PLATFORM")) { -- struct sys_dev *idev; -- struct mdinfo *dev; -- char *hba_path = NULL; -- char *dev_path = devt_to_devpath(makedev(info->disk.major, -- info->disk.minor)); -+ if (check_env("IMSM_NO_PLATFORM")) -+ return 0; - -- for (idev = find_intel_devices(); idev; idev = idev->next) { -- if (strstr(dev_path, idev->path)) { -- hba_path = idev->path; -- break; -- } -+ struct sys_dev *idev; -+ struct sys_dev *hba = NULL; -+ struct sys_dev *intel_devices = find_intel_devices(); -+ char *dev_path = devt_to_devpath(makedev(info->disk.major, -+ info->disk.minor)); -+ -+ for (idev = intel_devices; idev; idev = idev->next) { -+ if (dev_path && strstr(dev_path, idev->path)) { -+ hba = idev; -+ break; - } -+ } -+ if (dev_path) - free(dev_path); - -- if (hba_path) { -- for (dev = info->next; dev; dev = dev->next) { -- if (!devt_attached_to_hba(makedev(dev->disk.major, -- dev->disk.minor), hba_path)) { -- pr_err("WARNING - IMSM container assembled with disks under different HBAs!\n" -- " This operation is not supported and can lead to data loss.\n"); -- return 1; -- } -+ if (!hba) { -+ pr_err("WARNING - Cannot detect HBA for device %s!\n", -+ devid2kname(makedev(info->disk.major, info->disk.minor))); -+ return 1; -+ } -+ -+ const struct imsm_orom *orom = get_orom_by_device_id(hba->dev_id); -+ struct mdinfo *dev; -+ -+ for (dev = info->next; dev; dev = dev->next) { -+ dev_path = devt_to_devpath(makedev(dev->disk.major, dev->disk.minor)); -+ -+ struct sys_dev *hba2 = NULL; -+ for (idev = intel_devices; idev; idev = idev->next) { -+ if (dev_path && strstr(dev_path, idev->path)) { -+ hba2 = idev; -+ break; - } - } -+ if (dev_path) -+ free(dev_path); -+ -+ const struct imsm_orom *orom2 = hba2 == NULL ? NULL : -+ get_orom_by_device_id(hba2->dev_id); -+ -+ if (hba2 && hba->type != hba2->type) { -+ pr_err("WARNING - HBAs of devices do not match %s != %s\n", -+ get_sys_dev_type(hba->type), get_sys_dev_type(hba2->type)); -+ return 1; -+ } -+ -+ if (orom != orom2) { -+ pr_err("WARNING - IMSM container assembled with disks under different HBAs!\n" -+ " This operation is not supported and can lead to data loss.\n"); -+ return 1; -+ } -+ -+ if (!orom) { -+ pr_err("WARNING - IMSM container assembled with disks under HBAs without IMSM platform support!\n" -+ " This operation is not supported and can lead to data loss.\n"); -+ return 1; -+ } - } -+ - return 0; - } - #ifndef MDASSEMBLE --- -2.4.3 - diff --git a/SOURCES/mdadm-3.3.2-imsm-support-for-second-and-combined-AHCI-controller.patch b/SOURCES/mdadm-3.3.2-imsm-support-for-second-and-combined-AHCI-controller.patch deleted file mode 100644 index ffa21f8..0000000 --- a/SOURCES/mdadm-3.3.2-imsm-support-for-second-and-combined-AHCI-controller.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 81188ef870ead9121d66287eb2ced28a25a1e8d4 Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Wed, 19 Nov 2014 13:53:27 +0100 -Subject: [PATCH] imsm: support for second and combined AHCI controllers in - UEFI mode - -Grantly platform introduces a second AHCI controller (sSATA) and two new -UEFI variables for the RSTe firmware. This patch adds support for those -variables in order to correctly determine IMSM platform capabilities in -UEFI mode. - -Signed-off-by: Artur Paszkiewicz -Signed-off-by: NeilBrown ---- - platform-intel.c | 24 +++++++++++++++++++++++- - 1 file changed, 23 insertions(+), 1 deletion(-) - -diff --git a/platform-intel.c b/platform-intel.c -index f779d02..c5a0aa4 100644 ---- a/platform-intel.c -+++ b/platform-intel.c -@@ -401,6 +401,8 @@ static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba) - #define SYS_EFI_VAR_PATH "/sys/firmware/efi/vars" - #define SCU_PROP "RstScuV" - #define AHCI_PROP "RstSataV" -+#define AHCI_SSATA_PROP "RstsSatV" -+#define AHCI_CSATA_PROP "RstCSatV" - - #define VENDOR_GUID \ - EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, 0x1a, 0x04, 0xc6) -@@ -455,6 +457,7 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) - { - struct imsm_orom orom; - const struct imsm_orom *ret; -+ int err; - - if (check_env("IMSM_TEST_AHCI_EFI") || check_env("IMSM_TEST_SCU_EFI")) - return imsm_platform_test(hba); -@@ -466,7 +469,26 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) - if (hba->type == SYS_DEV_SATA && hba->class != PCI_CLASS_RAID_CNTRL) - return NULL; - -- if (read_efi_variable(&orom, sizeof(orom), hba->type == SYS_DEV_SAS ? SCU_PROP : AHCI_PROP, VENDOR_GUID)) -+ err = read_efi_variable(&orom, sizeof(orom), hba->type == SYS_DEV_SAS ? SCU_PROP : AHCI_PROP, VENDOR_GUID); -+ -+ /* try to read variable for second AHCI controller */ -+ if (err && hba->type == SYS_DEV_SATA) -+ err = read_efi_variable(&orom, sizeof(orom), AHCI_SSATA_PROP, VENDOR_GUID); -+ -+ /* try to read variable for combined AHCI controllers */ -+ if (err && hba->type == SYS_DEV_SATA) { -+ static const struct imsm_orom *csata; -+ -+ err = read_efi_variable(&orom, sizeof(orom), AHCI_CSATA_PROP, VENDOR_GUID); -+ if (!err) { -+ if (!csata) -+ csata = add_orom(&orom); -+ add_orom_device_id(csata, hba->dev_id); -+ return csata; -+ } -+ } -+ -+ if (err) - return NULL; - - ret = add_orom(&orom); --- -2.4.3 - diff --git a/SOURCES/mdadm-3.3.2-imsm-use-efivarfs-interface-for-reading-UEFI-variabl.patch b/SOURCES/mdadm-3.3.2-imsm-use-efivarfs-interface-for-reading-UEFI-variabl.patch deleted file mode 100644 index db5a896..0000000 --- a/SOURCES/mdadm-3.3.2-imsm-use-efivarfs-interface-for-reading-UEFI-variabl.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 88605db99c00f48bd56ad86718657d54e254be57 Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Thu, 20 Nov 2014 18:56:13 +0100 -Subject: [PATCH] imsm: use efivarfs interface for reading UEFI variables - -Read UEFI variables using the new efivarfs interface, fallback to -sysfs-efivars if that fails. - -Signed-off-by: Artur Paszkiewicz -Signed-off-by: NeilBrown ---- - platform-intel.c | 37 ++++++++++++++++++++++++++++++++++++- - 1 file changed, 36 insertions(+), 1 deletion(-) - -diff --git a/platform-intel.c b/platform-intel.c -index 54ef37f..37274da 100644 ---- a/platform-intel.c -+++ b/platform-intel.c -@@ -416,6 +416,7 @@ static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba) - (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) - - #define SYS_EFI_VAR_PATH "/sys/firmware/efi/vars" -+#define SYS_EFIVARS_PATH "/sys/firmware/efi/efivars" - #define SCU_PROP "RstScuV" - #define AHCI_PROP "RstSataV" - #define AHCI_SSATA_PROP "RstsSatV" -@@ -426,13 +427,47 @@ static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba) - - #define PCI_CLASS_RAID_CNTRL 0x010400 - --int read_efi_variable(void *buffer, ssize_t buf_size, char *variable_name, struct efi_guid guid) -+static int read_efi_var(void *buffer, ssize_t buf_size, char *variable_name, struct efi_guid guid) -+{ -+ char path[PATH_MAX]; -+ char buf[GUID_STR_MAX]; -+ int fd; -+ ssize_t n; -+ -+ snprintf(path, PATH_MAX, "%s/%s-%s", SYS_EFIVARS_PATH, variable_name, guid_str(buf, guid)); -+ -+ fd = open(path, O_RDONLY); -+ if (fd < 0) -+ return 1; -+ -+ /* read the variable attributes and ignore it */ -+ n = read(fd, buf, sizeof(__u32)); -+ if (n < 0) { -+ close(fd); -+ return 1; -+ } -+ -+ /* read the variable data */ -+ n = read(fd, buffer, buf_size); -+ close(fd); -+ if (n < buf_size) -+ return 1; -+ -+ return 0; -+} -+ -+static int read_efi_variable(void *buffer, ssize_t buf_size, char *variable_name, struct efi_guid guid) - { - char path[PATH_MAX]; - char buf[GUID_STR_MAX]; - int dfd; - ssize_t n, var_data_len; - -+ /* Try to read the variable using the new efivarfs interface first. -+ * If that fails, fall back to the old sysfs-efivars interface. */ -+ if (!read_efi_var(buffer, buf_size, variable_name, guid)) -+ return 0; -+ - snprintf(path, PATH_MAX, "%s/%s-%s/size", SYS_EFI_VAR_PATH, variable_name, guid_str(buf, guid)); - - dprintf("EFI VAR: path=%s\n", path); --- -2.4.3 - diff --git a/SOURCES/mdadm-3.3.2-imsm-use-timeout-when-waiting-for-reshape-progress.patch b/SOURCES/mdadm-3.3.2-imsm-use-timeout-when-waiting-for-reshape-progress.patch deleted file mode 100644 index 9e105ce..0000000 --- a/SOURCES/mdadm-3.3.2-imsm-use-timeout-when-waiting-for-reshape-progress.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 5ff3a780abeb5e4d97727dd213e5923f55cae28b Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Tue, 5 Jan 2016 17:16:15 +0100 -Subject: [PATCH] imsm: use timeout when waiting for reshape progress - -Waiting for reshape progress is done by using select() on sync_completed -to block until an exception condition is signalled on the -filedescriptor. This happens when the attribute's value is updated by -the kernel, but if the array is stopped when mdadm is blocked on -select() this will never happen, because this attribute is then removed -and apparently the kernel doesn't do sysfs_notify() when removing a -sysfs attribute. So set a 3 second timeout for the sysfs_wait() call. - -Signed-off-by: Artur Paszkiewicz -Signed-off-by: NeilBrown ---- - super-intel.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/super-intel.c b/super-intel.c -index b836816..3b3d561 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -10393,7 +10393,8 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) - - do { - char action[20]; -- sysfs_wait(fd, NULL); -+ int timeout = 3000; -+ sysfs_wait(fd, &timeout); - if (sysfs_get_str(sra, NULL, "sync_action", - action, 20) > 0 && - strncmp(action, "reshape", 7) != 0) { --- -2.5.0 - diff --git a/SOURCES/mdadm-3.3.2-skip-rules.patch b/SOURCES/mdadm-3.3.2-skip-rules.patch index 4f6a91c..ee43d23 100644 --- a/SOURCES/mdadm-3.3.2-skip-rules.patch +++ b/SOURCES/mdadm-3.3.2-skip-rules.patch @@ -1,11 +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 @@ +--- mdadm-3.4/Makefile~ 2016-02-01 22:59:47.327994011 +0800 ++++ mdadm-3.4/Makefile 2016-02-02 10:18:51.165377518 +0800 +@@ -292,7 +292,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 ; \ + $(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/SOURCES/mdadm-3.3.2-super-intel-ensure-suspended-region-is-removed-when-.patch b/SOURCES/mdadm-3.3.2-super-intel-ensure-suspended-region-is-removed-when-.patch deleted file mode 100644 index 3c52825..0000000 --- a/SOURCES/mdadm-3.3.2-super-intel-ensure-suspended-region-is-removed-when-.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 942e1cdb4a6a5be02672bc686169c679e775c2be Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 18 Feb 2016 15:53:32 +1100 -Subject: [PATCH] super-intel: ensure suspended region is removed when reshape - completes. - -A recent commit removed a call to abort_reshape() when IMSM reshape -completed. An unanticipated result of this is that the suspended -region is not cleared as it should be. -So after a reshape, a region of the array will cause all IO to block. - -Re-instate the required updates to suspend_{lo,hi} coped from -abort_reshape(). - -This is caught (sometimes) by the test suite. - -Also fix a couple of typos found while exploring the code. - -Reported-by: Ken Moffat -Cc: Artur Paszkiewicz -Fixes: 2139b03c2080 ("imsm: don't call abort_reshape() in imsm_manage_reshape()") -Signed-off-by: NeilBrown -Signed-off-by: Jes Sorensen ---- - super-intel.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/super-intel.c b/super-intel.c -index 90b7b6d..ff0506d 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -10465,7 +10465,7 @@ int check_degradation_change(struct mdinfo *info, - * Function: imsm_manage_reshape - * Description: Function finds array under reshape and it manages reshape - * process. It creates stripes backups (if required) and sets -- * checheckpoits. -+ * checkpoints. - * Parameters: - * afd : Backup handle (nattive) - not used - * sra : general array info -@@ -10595,7 +10595,7 @@ static int imsm_manage_reshape( - - start = current_position * 512; - -- /* allign reading start to old geometry */ -+ /* align reading start to old geometry */ - start_buf_shift = start % old_data_stripe_length; - start_src = start - start_buf_shift; - -@@ -10700,6 +10700,10 @@ static int imsm_manage_reshape( - ret_val = 1; - abort: - free(buf); -+ /* See Grow.c: abort_reshape() for further explanation */ -+ sysfs_set_num(sra, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL); -+ sysfs_set_num(sra, NULL, "suspend_hi", 0); -+ sysfs_set_num(sra, NULL, "suspend_lo", 0); - - return ret_val; - } --- -2.5.0 - diff --git a/SOURCES/mdadm-3.4-Change-behavior-in-find_free_devnm-when-wrapping-aro.patch b/SOURCES/mdadm-3.4-Change-behavior-in-find_free_devnm-when-wrapping-aro.patch new file mode 100644 index 0000000..2759046 --- /dev/null +++ b/SOURCES/mdadm-3.4-Change-behavior-in-find_free_devnm-when-wrapping-aro.patch @@ -0,0 +1,30 @@ +From 2e466cce45ac2397ea426a765c829c621901664b Mon Sep 17 00:00:00 2001 +From: Mike Lovell +Date: Wed, 18 May 2016 12:23:14 -0600 +Subject: [PATCH 2/2] Change behavior in find_free_devnm when wrapping around. + +Newer kernels don't allow for specifying an array larger than 511. This +makes it so find_free_devnm wraps to 511 instead of 2^20 - 1. + +Signed-off-by: Mike Lovell +Signed-off-by: Jes Sorensen +--- + mdopen.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mdopen.c b/mdopen.c +index e71d758..f818fdf 100644 +--- a/mdopen.c ++++ b/mdopen.c +@@ -439,7 +439,7 @@ char *find_free_devnm(int use_partitions) + static char devnm[32]; + int devnum; + for (devnum = 127; devnum != 128; +- devnum = devnum ? devnum-1 : (1<<20)-1) { ++ devnum = devnum ? devnum-1 : (1<<9)-1) { + + if (use_partitions) + sprintf(devnm, "md_d%d", devnum); +-- +2.7.4 + diff --git a/SOURCES/mdadm-3.4-Grow_continue_command-remove-dead-code.patch b/SOURCES/mdadm-3.4-Grow_continue_command-remove-dead-code.patch new file mode 100644 index 0000000..5210d47 --- /dev/null +++ b/SOURCES/mdadm-3.4-Grow_continue_command-remove-dead-code.patch @@ -0,0 +1,51 @@ +commit 12add44564f195878c3e346e4bbae845dec67db3 +Author: Jes Sorensen +Date: Fri Mar 4 16:30:22 2016 -0500 + + Grow: Grow_continue_command() remove dead code + + All cases where fd2 is used are completed with a close(fd2), so there + is no need to set fd2 = -1 or check for it before exiting. + + Reviewed-by: NeilBrown + Signed-off-by: Jes Sorensen + +diff --git a/Grow.c b/Grow.c +index c4f417e..c4af5c0 100755 +--- a/Grow.c ++++ b/Grow.c +@@ -4752,7 +4752,7 @@ int Grow_continue_command(char *devname, int fd, + struct mdinfo *cc = NULL; + struct mdstat_ent *mdstat = NULL; + int cfd = -1; +- int fd2 = -1; ++ int fd2; + + dprintf("Grow continue from command line called for %s\n", + devname); +@@ -4796,8 +4796,6 @@ int Grow_continue_command(char *devname, int fd, + continue; + err = st->ss->load_super(st, fd2, NULL); + close(fd2); +- /* invalidate fd2 to avoid possible double close() */ +- fd2 = -1; + if (err) + continue; + break; +@@ -4894,7 +4892,6 @@ int Grow_continue_command(char *devname, int fd, + sysfs_init(content, fd2, mdstat->devnm); + + close(fd2); +- fd2 = -1; + + /* start mdmon in case it is not running + */ +@@ -4924,8 +4921,6 @@ int Grow_continue_command(char *devname, int fd, + ret_val = Grow_continue(fd, st, content, backup_file, 1, 0); + + Grow_continue_command_exit: +- if (fd2 > -1) +- close(fd2); + if (cfd > -1) + close(cfd); + st->ss->free_super(st); diff --git a/SOURCES/mdadm-3.4-IMSM-retry-reading-sync_completed-during-reshape.patch b/SOURCES/mdadm-3.4-IMSM-retry-reading-sync_completed-during-reshape.patch new file mode 100644 index 0000000..a3dd86e --- /dev/null +++ b/SOURCES/mdadm-3.4-IMSM-retry-reading-sync_completed-during-reshape.patch @@ -0,0 +1,56 @@ +From df2647fa5bbe84960dae11531e34bafef549b8ff Mon Sep 17 00:00:00 2001 +From: Pawel Baldysiak +Date: Tue, 17 May 2016 13:24:41 +0200 +Subject: [PATCH] IMSM: retry reading sync_completed during reshape + +The sync_completed after restarting a reshape +(for example - after reboot) is set to "delayed" until +mdmon changes the state. Mdadm does not wait for that change with +old kernels. If this condition occurs - it exits and reshape +is not continuing. This patch adds retry of reading sync_complete +with a delay. It gives time for mdmon to change the "delayed" state. + +Signed-off-by: Pawel Baldysiak +Signed-off-by: Jes Sorensen +--- + super-intel.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/super-intel.c b/super-intel.c +index ba3ee48..7e2860c 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -10378,6 +10378,7 @@ exit_imsm_reshape_super: + int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) + { + int fd = sysfs_get_fd(sra, NULL, "sync_completed"); ++ int retry = 3; + unsigned long long completed; + /* to_complete : new sync_max position */ + unsigned long long to_complete = sra->reshape_progress; +@@ -10388,11 +10389,17 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) + return 1; + } + +- if (sysfs_fd_get_ll(fd, &completed) < 0) { +- dprintf("cannot read reshape_position (no reshape in progres)\n"); +- close(fd); +- return 1; +- } ++ do { ++ if (sysfs_fd_get_ll(fd, &completed) < 0) { ++ if (!retry) { ++ dprintf("cannot read reshape_position (no reshape in progres)\n"); ++ close(fd); ++ return 1; ++ } ++ usleep(30000); ++ } else ++ break; ++ } while (retry--); + + if (completed > position_to_set) { + dprintf("wrong next position to set %llu (%llu)\n", +-- +2.5.5 + diff --git a/SOURCES/mdadm-3.4-The-sys_name-array-in-the-mdinfo-structure-is-20-byt.patch b/SOURCES/mdadm-3.4-The-sys_name-array-in-the-mdinfo-structure-is-20-byt.patch new file mode 100644 index 0000000..91d89d6 --- /dev/null +++ b/SOURCES/mdadm-3.4-The-sys_name-array-in-the-mdinfo-structure-is-20-byt.patch @@ -0,0 +1,31 @@ +From 6e6e98746dba7e900f23e92bbb0da01fe7a169da Mon Sep 17 00:00:00 2001 +From: Nikhil Kshirsagar +Date: Fri, 10 Jun 2016 08:50:10 +0530 +Subject: [PATCH] The sys_name array in the mdinfo structure is 20 bytes of + storage. + +Increasing the size of this array to 32 bytes to handle cases with +longer device names. + +Signed-off-by: Nikhil Kshirsagar +Signed-off-by: Jes Sorensen +--- + mdadm.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mdadm.h b/mdadm.h +index 3d6c638..1fd38a3 100755 +--- a/mdadm.h ++++ b/mdadm.h +@@ -289,7 +289,7 @@ struct mdinfo { + int container_enough; /* flag external handlers can set to + * indicate that subarrays have not enough (-1), + * enough to start (0), or all expected disks (1) */ +- char sys_name[20]; ++ char sys_name[32]; + struct mdinfo *devs; + struct mdinfo *next; + +-- +2.5.5 + diff --git a/SOURCES/mdadm-3.4-Use-dev_t-for-devnm2devid-and-devid2devnm.patch b/SOURCES/mdadm-3.4-Use-dev_t-for-devnm2devid-and-devid2devnm.patch new file mode 100644 index 0000000..946f19a --- /dev/null +++ b/SOURCES/mdadm-3.4-Use-dev_t-for-devnm2devid-and-devid2devnm.patch @@ -0,0 +1,163 @@ +From 13db17bd1fcd68b5e5618fcd051ff4137f1ea413 Mon Sep 17 00:00:00 2001 +From: Mike Lovell +Date: Wed, 18 May 2016 12:23:13 -0600 +Subject: [PATCH 1/2] Use dev_t for devnm2devid and devid2devnm + +Commit 4dd2df0966ec added a trip through makedev(), major(), and minor() for +device major and minor numbers. This would cause mdadm to fail in operating +on a device with a minor number bigger than (2^19)-1 due to it changing +from dev_t to a signed int and back. + +Where this was found as a problem was when a array was created with a device +specified as a name like /dev/md/raidname and there were already 128 arrays +on the system. In this case, mdadm would chose 1048575 ((2^20)-1) for the +array and minor number. This would cause the major and minor number to become +negative when generated from devnm2devid() and passed to major() and minor() +in open_dev_excl(). open_dev_excl() would then call dev_open() which would +detect the negative minor number and call open() on the *char containing the +major:minor pair which isn't a valid file. + +Signed-off-by: Mike Lovell +Signed-off-by: Jes Sorensen +--- + Detail.c | 4 ++-- + Grow.c | 2 +- + lib.c | 2 +- + mapfile.c | 2 +- + mdadm.h | 4 ++-- + mdopen.c | 4 ++-- + util.c | 6 +++--- + 7 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/Detail.c b/Detail.c +index 20c4553..7a984c8 100644 +--- a/Detail.c ++++ b/Detail.c +@@ -130,7 +130,7 @@ int Detail(char *dev, struct context *c) + /* This is a subarray of some container. + * We want the name of the container, and the member + */ +- int devid = devnm2devid(st->container_devnm); ++ dev_t devid = devnm2devid(st->container_devnm); + int cfd, err; + + member = subarray; +@@ -577,7 +577,7 @@ This is pretty boring + char path[200]; + char vbuf[1024]; + int nlen = strlen(sra->sys_name); +- int devid; ++ dev_t devid; + if (de->d_name[0] == '.') + continue; + sprintf(path, "/sys/block/%s/md/metadata_version", +diff --git a/Grow.c b/Grow.c +index 98b0fab..f184d9c 100755 +--- a/Grow.c ++++ b/Grow.c +@@ -3533,7 +3533,7 @@ int reshape_container(char *container, char *devname, + int fd; + struct mdstat_ent *mdstat; + char *adev; +- int devid; ++ dev_t devid; + + sysfs_free(cc); + +diff --git a/lib.c b/lib.c +index 621edf3..3ee7659 100644 +--- a/lib.c ++++ b/lib.c +@@ -99,7 +99,7 @@ char *fd2kname(int fd) + return NULL; + } + +-char *devid2devnm(int devid) ++char *devid2devnm(dev_t devid) + { + char path[30]; + char link[200]; +diff --git a/mapfile.c b/mapfile.c +index 243ded1..c89d403 100644 +--- a/mapfile.c ++++ b/mapfile.c +@@ -374,7 +374,7 @@ void RebuildMap(void) + char dn[30]; + int dfd; + int ok; +- int devid; ++ dev_t devid; + struct supertype *st; + char *subarray = NULL; + char *path; +diff --git a/mdadm.h b/mdadm.h +index b870585..3d6c638 100755 +--- a/mdadm.h ++++ b/mdadm.h +@@ -1440,8 +1440,8 @@ extern char *find_free_devnm(int use_partitions); + + extern void put_md_name(char *name); + extern char *devid2kname(int devid); +-extern char *devid2devnm(int devid); +-extern int devnm2devid(char *devnm); ++extern char *devid2devnm(dev_t devid); ++extern dev_t devnm2devid(char *devnm); + extern char *get_md_name(char *devnm); + + extern char DefaultConfFile[]; +diff --git a/mdopen.c b/mdopen.c +index 28410f4..e71d758 100644 +--- a/mdopen.c ++++ b/mdopen.c +@@ -348,7 +348,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, + if (lstat(devname, &stb) == 0) { + /* Must be the correct device, else error */ + if ((stb.st_mode&S_IFMT) != S_IFBLK || +- stb.st_rdev != (dev_t)devnm2devid(devnm)) { ++ stb.st_rdev != devnm2devid(devnm)) { + pr_err("%s exists but looks wrong, please fix\n", + devname); + return -1; +@@ -452,7 +452,7 @@ char *find_free_devnm(int use_partitions) + if (!use_udev()) { + /* make sure it is new to /dev too, at least as a + * non-standard */ +- int devid = devnm2devid(devnm); ++ dev_t devid = devnm2devid(devnm); + if (devid) { + char *dn = map_dev(major(devid), + minor(devid), 0); +diff --git a/util.c b/util.c +index 2bcb81f..31c407a 100644 +--- a/util.c ++++ b/util.c +@@ -928,7 +928,7 @@ int get_data_disks(int level, int layout, int raid_disks) + return data_disks; + } + +-int devnm2devid(char *devnm) ++dev_t devnm2devid(char *devnm) + { + /* First look in /sys/block/$DEVNM/dev for %d:%d + * If that fails, try parsing out a number +@@ -1065,7 +1065,7 @@ int dev_open(char *dev, int flags) + + int open_dev_flags(char *devnm, int flags) + { +- int devid; ++ dev_t devid; + char buf[20]; + + devid = devnm2devid(devnm); +@@ -1083,7 +1083,7 @@ int open_dev_excl(char *devnm) + char buf[20]; + int i; + int flags = O_RDWR; +- int devid = devnm2devid(devnm); ++ dev_t devid = devnm2devid(devnm); + long delay = 1000; + + sprintf(buf, "%d:%d", major(devid), minor(devid)); +-- +2.7.4 + diff --git a/SOURCES/mdadm-3.4-check-reshape_active-more-times-before-Grow_continue.patch b/SOURCES/mdadm-3.4-check-reshape_active-more-times-before-Grow_continue.patch new file mode 100644 index 0000000..df95841 --- /dev/null +++ b/SOURCES/mdadm-3.4-check-reshape_active-more-times-before-Grow_continue.patch @@ -0,0 +1,106 @@ +commit 8800f85381d0cd9689dee62bbbdafdb359100389 +Author: Xiao Ni +Date: Thu Jun 16 09:41:02 2016 +0800 + + MDADM:Check mdinfo->reshape_active more times before calling Grow_continue + + When reshaping a 3 drives raid5 to 4 drives raid5, there is a chance that + it can't start the reshape. If the disks are not enough to have spaces for + relocating the data_offset, it needs to call start_reshape and then run + mdadm --grow --continue by systemd. But mdadm --grow --continue fails + because it checkes that info->reshape_active is 0. + + The info->reshape_active is got from the superblock of underlying devices. + Function start_reshape write reshape to /sys/../sync_action. Before writing + latest superblock to underlying devices, mdadm --grow --continue is called. + There is a chance info->reshape_active is 0. We should wait for superblock + updating more time before calling Grow_continue. + + Signed-off-by: Xiao Ni + Signed-off-by: Jes Sorensen + +diff --git a/Grow.c b/Grow.c +index f184d9c..628f0e7 100755 +--- a/Grow.c ++++ b/Grow.c +@@ -4788,6 +4788,7 @@ int Grow_continue_command(char *devname, int fd, + dprintf("Grow continue is run for "); + if (st->ss->external == 0) { + int d; ++ int cnt = 5; + dprintf_cont("native array (%s)\n", devname); + if (ioctl(fd, GET_ARRAY_INFO, &array.array) < 0) { + pr_err("%s is not an active md array - aborting\n", devname); +@@ -4799,36 +4800,42 @@ int Grow_continue_command(char *devname, int fd, + * FIXME we should really get what we need from + * sysfs + */ +- for (d = 0; d < MAX_DISKS; d++) { +- mdu_disk_info_t disk; +- char *dv; +- int err; +- disk.number = d; +- if (ioctl(fd, GET_DISK_INFO, &disk) < 0) +- continue; +- if (disk.major == 0 && disk.minor == 0) +- continue; +- if ((disk.state & (1 << MD_DISK_ACTIVE)) == 0) +- continue; +- dv = map_dev(disk.major, disk.minor, 1); +- if (!dv) +- continue; +- fd2 = dev_open(dv, O_RDONLY); +- if (fd2 < 0) +- continue; +- err = st->ss->load_super(st, fd2, NULL); +- close(fd2); +- if (err) +- continue; +- break; +- } +- if (d == MAX_DISKS) { +- pr_err("Unable to load metadata for %s\n", +- devname); +- ret_val = 1; +- goto Grow_continue_command_exit; +- } +- st->ss->getinfo_super(st, content, NULL); ++ do { ++ for (d = 0; d < MAX_DISKS; d++) { ++ mdu_disk_info_t disk; ++ char *dv; ++ int err; ++ disk.number = d; ++ if (ioctl(fd, GET_DISK_INFO, &disk) < 0) ++ continue; ++ if (disk.major == 0 && disk.minor == 0) ++ continue; ++ if ((disk.state & (1 << MD_DISK_ACTIVE)) == 0) ++ continue; ++ dv = map_dev(disk.major, disk.minor, 1); ++ if (!dv) ++ continue; ++ fd2 = dev_open(dv, O_RDONLY); ++ if (fd2 < 0) ++ continue; ++ err = st->ss->load_super(st, fd2, NULL); ++ close(fd2); ++ if (err) ++ continue; ++ break; ++ } ++ if (d == MAX_DISKS) { ++ pr_err("Unable to load metadata for %s\n", ++ devname); ++ ret_val = 1; ++ goto Grow_continue_command_exit; ++ } ++ st->ss->getinfo_super(st, content, NULL); ++ if (!content->reshape_active) ++ sleep(3); ++ else ++ break; ++ } while (cnt-- > 0); + } else { + char *container; + diff --git a/SOURCES/mdadm-3.4-disable-journal.patch b/SOURCES/mdadm-3.4-disable-journal.patch new file mode 100644 index 0000000..0599820 --- /dev/null +++ b/SOURCES/mdadm-3.4-disable-journal.patch @@ -0,0 +1,32 @@ +--- mdadm-3.4/ReadMe.c~ 2016-01-28 01:14:56.000000000 -0500 ++++ mdadm-3.4/ReadMe.c 2016-08-05 10:09:15.412366777 -0400 +@@ -142,7 +142,9 @@ + {"data-offset",1, 0, DataOffset}, + {"nodes",1, 0, Nodes}, /* also for --assemble */ + {"home-cluster",1, 0, ClusterName}, ++#if 0 /* Disable for RHEL */ + {"write-journal",1, 0, WriteJournal}, ++#endif + + /* For assemble */ + {"uuid", 1, 0, 'u'}, +@@ -157,7 +159,9 @@ + /* Management */ + {"add", 0, 0, Add}, + {"add-spare", 0, 0, AddSpare}, ++#if 0 /* Disable for RHEL */ + {"add-journal", 0, 0, AddJournal}, ++#endif + {"remove", 0, 0, Remove}, + {"fail", 0, 0, Fail}, + {"set-faulty",0, 0, Fail}, +@@ -377,7 +381,9 @@ + " --name= -N : Textual name for array - max 32 characters\n" + " --bitmap-chunk= : bitmap chunksize in Kilobytes.\n" + " --delay= -d : bitmap update delay in seconds.\n" ++#if 0 /* Disable for RHEL */ + " --write-journal= : Specify journal device for RAID-4/5/6 array\n" ++#endif + "\n" + ; + diff --git a/SOURCES/mdadm-3.4-imsm-add-handling-of-sync_action-is-equal-to-idle.patch b/SOURCES/mdadm-3.4-imsm-add-handling-of-sync_action-is-equal-to-idle.patch new file mode 100644 index 0000000..a6e801c --- /dev/null +++ b/SOURCES/mdadm-3.4-imsm-add-handling-of-sync_action-is-equal-to-idle.patch @@ -0,0 +1,42 @@ +From b2be2b628b6305712c8df0b3a20ddddc0ac410fb Mon Sep 17 00:00:00 2001 +From: Alexey Obitotskiy +Date: Thu, 16 Jun 2016 11:31:36 +0200 +Subject: [PATCH 1/2] imsm: add handling of sync_action is equal to 'idle' + +After resync is stopped sync_action value become 'idle'. +We treat this case as normal termination of waiting, not as error. + +Signed-off-by: Alexey Obitotskiy +Reviewed-by: Pawel Baldysiak +Signed-off-by: Jes Sorensen +--- + super-intel.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/super-intel.c b/super-intel.c +index 7e2860c..7950bef 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -10423,6 +10423,8 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) + if (sysfs_get_str(sra, NULL, "sync_action", + action, 20) > 0 && + strncmp(action, "reshape", 7) != 0) { ++ if (strncmp(action, "idle", 4) == 0) ++ break; + close(fd); + return -1; + } +@@ -10432,9 +10434,9 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) + return 1; + } + } while (completed < position_to_set); ++ + close(fd); + return 0; +- + } + + /******************************************************************************* +-- +2.5.5 + diff --git a/SOURCES/mdadm-3.4-imsm-properly-handle-values-of-sync_completed.patch b/SOURCES/mdadm-3.4-imsm-properly-handle-values-of-sync_completed.patch new file mode 100644 index 0000000..182a211 --- /dev/null +++ b/SOURCES/mdadm-3.4-imsm-properly-handle-values-of-sync_completed.patch @@ -0,0 +1,89 @@ +From 0febb20c458a488460eadade74a6c283aadaf96a Mon Sep 17 00:00:00 2001 +From: Alexey Obitotskiy +Date: Thu, 16 Jun 2016 11:31:37 +0200 +Subject: [PATCH 2/2] imsm: properly handle values of sync_completed + +The sync_completed can be set to such values: +- two numbers of processed sectors and total during synchronization, +separated with '/'; +- 'none' if synchronization process is stopped; +- 'delayed' if synchronization process is delayed. +Handle value of sync_completed not only as numbers but +also check for 'none' and 'delayed'. + +Signed-off-by: Alexey Obitotskiy +Reviewed-by: Pawel Baldysiak +Signed-off-by: Jes Sorensen +--- + super-intel.c | 36 ++++++++++++++++++++++++++++++++++-- + 1 file changed, 34 insertions(+), 2 deletions(-) + +diff --git a/super-intel.c b/super-intel.c +index 7950bef..92817e9 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -10363,6 +10363,33 @@ exit_imsm_reshape_super: + return ret_val; + } + ++#define COMPLETED_OK 0 ++#define COMPLETED_NONE 1 ++#define COMPLETED_DELAYED 2 ++ ++static int read_completed(int fd, unsigned long long *val) ++{ ++ int ret; ++ char buf[50]; ++ ++ ret = sysfs_fd_get_str(fd, buf, 50); ++ if (ret < 0) ++ return ret; ++ ++ ret = COMPLETED_OK; ++ if (strncmp(buf, "none", 4) == 0) { ++ ret = COMPLETED_NONE; ++ } else if (strncmp(buf, "delayed", 7) == 0) { ++ ret = COMPLETED_DELAYED; ++ } else { ++ char *ep; ++ *val = strtoull(buf, &ep, 0); ++ if (ep == buf || (*ep != 0 && *ep != '\n' && *ep != ' ')) ++ ret = -1; ++ } ++ return ret; ++} ++ + /******************************************************************************* + * Function: wait_for_reshape_imsm + * Description: Function writes new sync_max value and waits until +@@ -10417,8 +10444,10 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) + } + + do { ++ int rc; + char action[20]; + int timeout = 3000; ++ + sysfs_wait(fd, &timeout); + if (sysfs_get_str(sra, NULL, "sync_action", + action, 20) > 0 && +@@ -10428,11 +10457,14 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) + close(fd); + return -1; + } +- if (sysfs_fd_get_ll(fd, &completed) < 0) { ++ ++ rc = read_completed(fd, &completed); ++ if (rc < 0) { + dprintf("cannot read reshape_position (in loop)\n"); + close(fd); + return 1; +- } ++ } else if (rc == COMPLETED_NONE) ++ break; + } while (completed < position_to_set); + + close(fd); +-- +2.5.5 + diff --git a/SOURCES/mdadm-3.4-mdopen-Prevent-overrunning-the-devname-buffer-when-c.patch b/SOURCES/mdadm-3.4-mdopen-Prevent-overrunning-the-devname-buffer-when-c.patch new file mode 100644 index 0000000..72e6fbb --- /dev/null +++ b/SOURCES/mdadm-3.4-mdopen-Prevent-overrunning-the-devname-buffer-when-c.patch @@ -0,0 +1,33 @@ +From bd1fd72e13652416da4c646ea47549fcfdf49b26 Mon Sep 17 00:00:00 2001 +From: Robert LeBlanc +Date: Wed, 24 Aug 2016 10:10:44 -0600 +Subject: [PATCH] mdopen: Prevent overrunning the devname buffer when copying + devnm into it for long md names. + +Linux allows for 32 character device names. When using the maximum +size device name and also storing "/dev/", devname needs to be 37 +character long to store the complete device name. +i.e. "/dev/md_abcdefghijklmnopqrstuvwxyz12\0" + +Signed-off-by: Robert LeBlanc +Signed-off-by: Jes Sorensen +--- + mdopen.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mdopen.c b/mdopen.c +index f818fdf..5af344b 100644 +--- a/mdopen.c ++++ b/mdopen.c +@@ -144,7 +144,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, + struct createinfo *ci = conf_get_create_info(); + int parts; + char *cname; +- char devname[20]; ++ char devname[37]; + char devnm[32]; + char cbuf[400]; + if (chosen == NULL) +-- +2.7.4 + diff --git a/SOURCES/mdadm-3.4-super-intel-ensure-suspended-region-is-removed-when-.patch b/SOURCES/mdadm-3.4-super-intel-ensure-suspended-region-is-removed-when-.patch new file mode 100644 index 0000000..3c52825 --- /dev/null +++ b/SOURCES/mdadm-3.4-super-intel-ensure-suspended-region-is-removed-when-.patch @@ -0,0 +1,63 @@ +From 942e1cdb4a6a5be02672bc686169c679e775c2be Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Thu, 18 Feb 2016 15:53:32 +1100 +Subject: [PATCH] super-intel: ensure suspended region is removed when reshape + completes. + +A recent commit removed a call to abort_reshape() when IMSM reshape +completed. An unanticipated result of this is that the suspended +region is not cleared as it should be. +So after a reshape, a region of the array will cause all IO to block. + +Re-instate the required updates to suspend_{lo,hi} coped from +abort_reshape(). + +This is caught (sometimes) by the test suite. + +Also fix a couple of typos found while exploring the code. + +Reported-by: Ken Moffat +Cc: Artur Paszkiewicz +Fixes: 2139b03c2080 ("imsm: don't call abort_reshape() in imsm_manage_reshape()") +Signed-off-by: NeilBrown +Signed-off-by: Jes Sorensen +--- + super-intel.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/super-intel.c b/super-intel.c +index 90b7b6d..ff0506d 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -10465,7 +10465,7 @@ int check_degradation_change(struct mdinfo *info, + * Function: imsm_manage_reshape + * Description: Function finds array under reshape and it manages reshape + * process. It creates stripes backups (if required) and sets +- * checheckpoits. ++ * checkpoints. + * Parameters: + * afd : Backup handle (nattive) - not used + * sra : general array info +@@ -10595,7 +10595,7 @@ static int imsm_manage_reshape( + + start = current_position * 512; + +- /* allign reading start to old geometry */ ++ /* align reading start to old geometry */ + start_buf_shift = start % old_data_stripe_length; + start_src = start - start_buf_shift; + +@@ -10700,6 +10700,10 @@ static int imsm_manage_reshape( + ret_val = 1; + abort: + free(buf); ++ /* See Grow.c: abort_reshape() for further explanation */ ++ sysfs_set_num(sra, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL); ++ sysfs_set_num(sra, NULL, "suspend_hi", 0); ++ sysfs_set_num(sra, NULL, "suspend_lo", 0); + + return ret_val; + } +-- +2.5.0 + diff --git a/SOURCES/mdadm-3.4-super1-Clear-memory-allocated-for-superblock-bitmap-.patch b/SOURCES/mdadm-3.4-super1-Clear-memory-allocated-for-superblock-bitmap-.patch new file mode 100644 index 0000000..65ba514 --- /dev/null +++ b/SOURCES/mdadm-3.4-super1-Clear-memory-allocated-for-superblock-bitmap-.patch @@ -0,0 +1,36 @@ +From 1dcee1c9cbcf9592275914706b76b1931490092c Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 6 Apr 2016 16:13:59 -0400 +Subject: [PATCH] super1: Clear memory allocated for superblock + bitmap before + use + +load_super1() did not clear memory allocated for the superblock + +bitmap. This causes issues if the superblock does not contain a bitmap +as later checks of bitmap features would rely on the bits being +cleared. + +This bug has been around for a long time, but was only exposed in +mdadm-3.4 with the introduction of the clustering code. + +Reported-by: Jan Stodola +Signed-off-by: Jes Sorensen +--- + super1.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/super1.c b/super1.c +index d6f3c93..8d5543f 100644 +--- a/super1.c ++++ b/super1.c +@@ -2016,6 +2016,8 @@ static int load_super1(struct supertype *st, int fd, char *devname) + return 1; + } + ++ memset(super, 0, SUPER1_SIZE); ++ + if (aread(&afd, super, MAX_SB_SIZE) != MAX_SB_SIZE) { + if (devname) + pr_err("Cannot read superblock on %s\n", +-- +2.5.5 + diff --git a/SOURCES/mdadm-3.4-udev-race.patch b/SOURCES/mdadm-3.4-udev-race.patch new file mode 100644 index 0000000..10475a2 --- /dev/null +++ b/SOURCES/mdadm-3.4-udev-race.patch @@ -0,0 +1,10 @@ +--- mdadm-3.4/udev-md-raid-arrays.rules-orig 2016-09-13 16:17:06.275757220 -0400 ++++ mdadm-3.4/udev-md-raid-arrays.rules 2016-09-14 16:30:33.597189689 -0400 +@@ -5,6 +5,7 @@ + # handle md arrays + ACTION!="add|change", GOTO="md_end" + KERNEL!="md*", GOTO="md_end" ++ATTR{md/metadata_version}!="external:[A-Za-z]*", ATTR{size}=="0", ENV{SYSTEMD_READY}="0", GOTO="md_end" + + # partitions have no md/{array_state,metadata_version}, but should not + # for that reason be ignored. diff --git a/SOURCES/mdadm-3.4.1-fix-some-type-comparison.patch b/SOURCES/mdadm-3.4.1-fix-some-type-comparison.patch new file mode 100644 index 0000000..39a6d37 --- /dev/null +++ b/SOURCES/mdadm-3.4.1-fix-some-type-comparison.patch @@ -0,0 +1,41 @@ +commit 1d13b599607e48446273913ce594931ba53df9fd +Author: Xiao Ni +Date: Sat Feb 6 09:18:41 2016 +0800 + + Fix some type comparison problems + + As 26714713cd2bad9e0bf7f4669f6cc4659ceaab6c said, 32 bit signed + timestamps will overflow in the year 2038. It already changed the + utime and ctime in struct mdu_array_info_s from int to unsigned + int. So we need to change the values that compared with them to + unsigned int too. + + Signed-off-by : Xiao Ni + Signed-off-by: Jes Sorensen + +diff --git a/Monitor.c b/Monitor.c +index f19c2e5..6df80f9 100644 +--- a/Monitor.c ++++ b/Monitor.c +@@ -33,7 +33,7 @@ + struct state { + char *devname; + char devnm[32]; /* to sync with mdstat info */ +- long utime; ++ unsigned int utime; + int err; + char *spare_group; + int active, working, failed, spare, raid; +diff --git a/util.c b/util.c +index 970d484..6e7d3fb 100644 +--- a/util.c ++++ b/util.c +@@ -1267,7 +1267,7 @@ struct supertype *guess_super_type(int fd, enum guess_types guess_type) + */ + struct superswitch *ss; + struct supertype *st; +- time_t besttime = 0; ++ unsigned int besttime = 0; + int bestsuper = -1; + int i; + diff --git a/SOURCES/mdadm.rules b/SOURCES/mdadm.rules index cc1ed04..6031d05 100644 --- a/SOURCES/mdadm.rules +++ b/SOURCES/mdadm.rules @@ -25,7 +25,9 @@ ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end" # anything here, just regular disks, and this also won't get any imsm # array members either) SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \ - RUN+="/sbin/mdadm -I $env{DEVNAME}" + IMPORT{program}="/sbin/mdadm -I $env{DEVNAME} --export $devnode --offroot ${DEVLINKS}" +SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \ + ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer" # Next, check to make sure the BIOS raid stuff wasn't turned off via cmdline IMPORT{cmdline}="noiswmd" diff --git a/SPECS/mdadm.spec b/SPECS/mdadm.spec index abdc699..4f15c39 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.3.2 -Release: 7%{?dist}.1 +Version: 3.4 +Release: 14%{?dist} Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz Source1: mdmonitor.init Source2: raid-check @@ -11,24 +11,24 @@ Source5: mdadm-cron Source6: mdmonitor.service Source7: mdadm.conf Source8: mdadm_event.conf -Patch1: mdadm-3.3.2-IMSM-Clear-migration-record-on-disks-more-often.patch -Patch2: mdadm-3.3.2-fix-resize-of-array-component-size-to-32bits.patch -Patch3: mdadm-3.3.2-imsm-support-for-OROMs-shared-by-multiple-HBAs.patch -Patch4: mdadm-3.3.2-imsm-support-for-second-and-combined-AHCI-controller.patch -Patch5: mdadm-3.3.2-imsm-add-support-for-NVMe-devices.patch -Patch6: mdadm-3.3.2-imsm-detail-platform-improvements.patch -Patch7: mdadm-3.3.2-imsm-use-efivarfs-interface-for-reading-UEFI-variabl.patch -Patch8: mdadm-3.3.2-fix-problem-with-grow-continue.patch -Patch9: mdadm-3.3.2-imsm-don-t-call-abort_reshape-in-imsm_manage_reshape.patch -Patch10: mdadm-3.3.2-Grow-close-file-descriptor-earlier-to-avoid-still-in.patch -Patch11: mdadm-3.3.2-imsm-abort-reshape-if-sync_action-is-not-reshape.patch -Patch12: mdadm-3.3.2-imsm-use-timeout-when-waiting-for-reshape-progress.patch -Patch13: mdadm-3.3.2-imsm-don-t-update-migration-record-when-reshape-is-i.patch -Patch14: mdadm-3.3.2-super-intel-ensure-suspended-region-is-removed-when-.patch +Patch1: mdadm-3.4.1-fix-some-type-comparison.patch +Patch2: mdadm-3.4-super-intel-ensure-suspended-region-is-removed-when-.patch +Patch3: mdadm-3.4-super1-Clear-memory-allocated-for-superblock-bitmap-.patch # RHEL customization patches +Patch4: mdadm-3.4-IMSM-retry-reading-sync_completed-during-reshape.patch +Patch5: mdadm-3.4-imsm-add-handling-of-sync_action-is-equal-to-idle.patch +Patch6: mdadm-3.4-imsm-properly-handle-values-of-sync_completed.patch +Patch7: mdadm-3.4-The-sys_name-array-in-the-mdinfo-structure-is-20-byt.patch +Patch8: mdadm-3.4-Grow_continue_command-remove-dead-code.patch +Patch9: mdadm-3.4-check-reshape_active-more-times-before-Grow_continue.patch +Patch10: mdadm-3.4-Use-dev_t-for-devnm2devid-and-devid2devnm.patch +Patch11: mdadm-3.4-Change-behavior-in-find_free_devnm-when-wrapping-aro.patch +Patch12: mdadm-3.4-mdopen-Prevent-overrunning-the-devname-buffer-when-c.patch +Patch95: mdadm-3.4-udev-race.patch Patch96: mdadm-3.3.2-skip-rules.patch Patch97: mdadm-3.3-udev.patch Patch98: mdadm-2.5.2-static.patch +Patch99: mdadm-3.4-disable-journal.patch URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ License: GPLv2+ Group: System Environment/Base @@ -42,6 +42,8 @@ Requires(preun): systemd-units Requires(postun): systemd-units coreutils Requires: libreport-filesystem +%define _hardened_build 1 + %description The mdadm program is used to create, manage, and monitor Linux MD (software RAID) devices. As such, it provides similar functionality to the raidtools @@ -52,28 +54,28 @@ file can be used to help with some common tasks. %prep %setup -q -%patch1 -p1 -b .migration -%patch2 -p1 -b .resize -%patch3 -p1 -b .multihba -%patch4 -p1 -b .secondahci -%patch5 -p1 -b .nvme -%patch6 -p1 -b .detail -%patch7 -p1 -b .efivars -%patch8 -p1 -b .grow -%patch9 -p1 -b .noabort -%patch10 -p1 -b .close -%patch11 -p1 -b .abort -%patch12 -p1 -b .timeout -%patch13 -p1 -b .update -%patch14 -p1 -b .ensure +%patch1 -p1 -b .comparision +%patch2 -p1 -b .stop-reshape +%patch3 -p1 -b .clear +%patch4 -p1 -b .retry +%patch5 -p1 -b .syncaction +%patch6 -p1 -b .synccompleted +%patch7 -p1 -b .sysname +%patch8 -p1 -b .dead +%patch9 -p1 -b .before +%patch10 -p1 -b .devt +%patch11 -p1 -b .wrap +%patch12 -p1 -b .overrun # RHEL customization patches +%patch95 -p1 -b .race %patch96 -p1 -b .rules %patch97 -p1 -b .udev %patch98 -p1 -b .static +%patch99 -p1 -b .journal %build -make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon +make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon %install rm -rf %{buildroot} @@ -132,13 +134,68 @@ rm -rf %{buildroot} /etc/libreport/events.d/* %changelog -* Mon Jun 20 2016 Jes Sorensen - 3.3.2-7.el7_2.1 -- Fix problem not being possible to stop IMSM RAID during reshape -- Resolves bz1322282 - -* Thu Sep 17 2015 Jes Sorensen - 3.3.2-7 -- Fix race condition when assembling IMSM volumes with mdadm -As -- Resolves bz1263205 +* Tue Sep 27 2016 Jes Sorensen - 3.4-14 +- The fix for 1331709 caused a problem with container arrays (IMSM) as + these can show up with a valid size of 0. Work around this to only + exit for non container arrays. +- Resolves rhbz#1379194 + +* Wed Sep 14 2016 Jes Sorensen - 3.4-13 +- Make udev-md-array-arrays.rules more resilient to races if arrays are + assembled and stopped and reassembled quick after each other. +- Resolves rhbz#1331709 + +* Thu Aug 25 2016 Jes Sorensen - 3.4-12 +- Apply additional required patch to fix buffer overrun using long device + names +- Resolves rhbz#1369891 + +* Wed Aug 24 2016 Jes Sorensen - 3.4-11 +- Fix problem when creating more than 127 md arrays leading to overruns +- Resolves rhbz#1369891 + +* Thu Aug 11 2016 Jes Sorensen - 3.4-10 +- Fix fix to enable security through obscurity +- Resolves rhbz#1225025 + +* Tue Aug 9 2016 Xiao Ni - 3.4-9 +- Fix problem about reshape stuck at beginning +- Resolves rhbz#1172937 + +* Fri Aug 5 2016 Jes Sorensen - 3.4-8 +- Disable support for creating and reshaping into arrays with journals. +- Resolves rhbz#1360464 + +* Mon Jun 20 2016 Jes Sorensen - 3.4-7 +- Fix problem with mdadm large device names overflowing an internal buffer +- Resolves rhbz#1347749 + +* Mon Jun 20 2016 Jes Sorensen - 3.4-6 +- Fix problem with reshaping IMSM arrays, where a new reshape could be + launched before the first reshape had fully completed, leading to + unpected results. +- Resolves rhbz#1347762 + +* Thu Jun 9 2016 Jes Sorensen - 3.4-5 +- Enable security through obscurity +- Resolves rhbz#1225025 + +* Thu Jun 9 2016 Jes Sorensen - 3.4-4 +- Fix problem with raid0 arrays not being detected by Anaconda due to it + setting MALLOC_PERTURB_ +- Resolves rhbz#1324637 + +* Thu Apr 28 2016 Xiao Ni - 3.4-3 +- Fix Degraded Raid1 array becomes inactive after rebooting +- Resolves rhbz#1290494 + +* Tue Mar 1 2016 Jes Sorensen - 3.4-2 +- Fix problem where it was not possible to stop an IMSM array during reshape +- Resolves rhbz#1312837 + +* Tue Feb 9 2016 Xiao Ni - 3.4-1 +- Update to mdadm-3.4 +- Resolves rhbz#1273351 * Thu Sep 17 2015 Xiao Ni - 3.3.2-6 - Fix issue reshape is stuck