diff --git a/SOURCES/0050-imsm-Change-the-way-of-printing-nvme-drives-in-detai.patch b/SOURCES/0050-imsm-Change-the-way-of-printing-nvme-drives-in-detai.patch new file mode 100644 index 0000000..dc3aa48 --- /dev/null +++ b/SOURCES/0050-imsm-Change-the-way-of-printing-nvme-drives-in-detai.patch @@ -0,0 +1,208 @@ +From 6da53c0e2aab200605722795798b1e4f2352cd64 Mon Sep 17 00:00:00 2001 +From: Blazej Kucman +Date: Mon, 2 Dec 2019 10:52:05 +0100 +Subject: [RHEL7.9 PATCH 50/71] imsm: Change the way of printing nvme drives in + detail-platform. + +Change NVMe controller path to device node path +in mdadm --detail-platform and print serial number. +The method imsm_read_serial always trimes serial to +MAX_RAID_SERIAL_LEN, added parameter 'serial_buf_len' +will be used to check the serial fit +to passed buffor, if not, will be trimed. + +Signed-off-by: Blazej Kucman +Signed-off-by: Jes Sorensen +--- + super-intel.c | 97 ++++++++++++++++++++++++++++------------------------------- + 1 file changed, 46 insertions(+), 51 deletions(-) + +diff --git a/super-intel.c b/super-intel.c +index 86dcb69..5c1f759 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -2218,7 +2218,8 @@ static void brief_detail_super_imsm(struct supertype *st, char *subarray) + super->current_vol = temp_vol; + } + +-static int imsm_read_serial(int fd, char *devname, __u8 *serial); ++static int imsm_read_serial(int fd, char *devname, __u8 *serial, ++ size_t serial_buf_len); + static void fd2devname(int fd, char *name); + + static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_base, int verbose) +@@ -2364,8 +2365,9 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b + else { + fd2devname(fd, buf); + printf(" Port%d : %s", port, buf); +- if (imsm_read_serial(fd, NULL, (__u8 *) buf) == 0) +- printf(" (%.*s)\n", MAX_RAID_SERIAL_LEN, buf); ++ if (imsm_read_serial(fd, NULL, (__u8 *)buf, ++ sizeof(buf)) == 0) ++ printf(" (%s)\n", buf); + else + printf(" ()\n"); + close(fd); +@@ -2388,52 +2390,45 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b + return err; + } + +-static int print_vmd_attached_devs(struct sys_dev *hba) ++static int print_nvme_info(struct sys_dev *hba) + { ++ char buf[1024]; + struct dirent *ent; + DIR *dir; +- char path[292]; +- char link[256]; +- char *c, *rp; +- +- if (hba->type != SYS_DEV_VMD) +- return 1; ++ char *rp; ++ int fd; + +- /* scroll through /sys/dev/block looking for devices attached to +- * this hba +- */ +- dir = opendir("/sys/bus/pci/drivers/nvme"); ++ dir = opendir("/sys/block/"); + if (!dir) + return 1; + + for (ent = readdir(dir); ent; ent = readdir(dir)) { +- int n; +- +- /* is 'ent' a device? check that the 'subsystem' link exists and +- * that its target matches 'bus' +- */ +- sprintf(path, "/sys/bus/pci/drivers/nvme/%s/subsystem", +- ent->d_name); +- n = readlink(path, link, sizeof(link)); +- if (n < 0 || n >= (int)sizeof(link)) +- continue; +- link[n] = '\0'; +- c = strrchr(link, '/'); +- if (!c) +- continue; +- if (strncmp("pci", c+1, strlen("pci")) != 0) +- continue; +- +- sprintf(path, "/sys/bus/pci/drivers/nvme/%s", ent->d_name); +- +- rp = realpath(path, NULL); +- if (!rp) +- continue; ++ if (strstr(ent->d_name, "nvme")) { ++ sprintf(buf, "/sys/block/%s", ent->d_name); ++ rp = realpath(buf, NULL); ++ if (!rp) ++ continue; ++ if (path_attached_to_hba(rp, hba->path)) { ++ fd = open_dev(ent->d_name); ++ if (fd < 0) { ++ free(rp); ++ continue; ++ } + +- if (path_attached_to_hba(rp, hba->path)) { +- printf(" NVMe under VMD : %s\n", rp); ++ fd2devname(fd, buf); ++ if (hba->type == SYS_DEV_VMD) ++ printf(" NVMe under VMD : %s", buf); ++ else if (hba->type == SYS_DEV_NVME) ++ printf(" NVMe Device : %s", buf); ++ if (!imsm_read_serial(fd, NULL, (__u8 *)buf, ++ sizeof(buf))) ++ printf(" (%s)\n", buf); ++ else ++ printf("()\n"); ++ close(fd); ++ } ++ free(rp); + } +- free(rp); + } + + closedir(dir); +@@ -2648,7 +2643,7 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle + char buf[PATH_MAX]; + printf(" I/O Controller : %s (%s)\n", + vmd_domain_to_controller(hba, buf), get_sys_dev_type(hba->type)); +- if (print_vmd_attached_devs(hba)) { ++ if (print_nvme_info(hba)) { + if (verbose > 0) + pr_err("failed to get devices attached to VMD domain.\n"); + result |= 2; +@@ -2663,7 +2658,7 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle + if (entry->type == SYS_DEV_NVME) { + for (hba = list; hba; hba = hba->next) { + if (hba->type == SYS_DEV_NVME) +- printf(" NVMe Device : %s\n", hba->path); ++ print_nvme_info(hba); + } + printf("\n"); + continue; +@@ -4028,11 +4023,11 @@ static int nvme_get_serial(int fd, void *buf, size_t buf_len) + extern int scsi_get_serial(int fd, void *buf, size_t buf_len); + + static int imsm_read_serial(int fd, char *devname, +- __u8 serial[MAX_RAID_SERIAL_LEN]) ++ __u8 *serial, size_t serial_buf_len) + { + char buf[50]; + int rv; +- int len; ++ size_t len; + char *dest; + char *src; + unsigned int i; +@@ -4075,13 +4070,13 @@ static int imsm_read_serial(int fd, char *devname, + len = dest - buf; + dest = buf; + +- /* truncate leading characters */ +- if (len > MAX_RAID_SERIAL_LEN) { +- dest += len - MAX_RAID_SERIAL_LEN; +- len = MAX_RAID_SERIAL_LEN; ++ if (len > serial_buf_len) { ++ /* truncate leading characters */ ++ dest += len - serial_buf_len; ++ len = serial_buf_len; + } + +- memset(serial, 0, MAX_RAID_SERIAL_LEN); ++ memset(serial, 0, serial_buf_len); + memcpy(serial, dest, len); + + return 0; +@@ -4136,7 +4131,7 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd) + char name[40]; + __u8 serial[MAX_RAID_SERIAL_LEN]; + +- rv = imsm_read_serial(fd, devname, serial); ++ rv = imsm_read_serial(fd, devname, serial, MAX_RAID_SERIAL_LEN); + + if (rv != 0) + return 2; +@@ -5844,7 +5839,7 @@ int mark_spare(struct dl *disk) + return ret_val; + + ret_val = 0; +- if (!imsm_read_serial(disk->fd, NULL, serial)) { ++ if (!imsm_read_serial(disk->fd, NULL, serial, MAX_RAID_SERIAL_LEN)) { + /* Restore disk serial number, because takeover marks disk + * as failed and adds to serial ':0' before it becomes + * a spare disk. +@@ -5895,7 +5890,7 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, + dd->fd = fd; + dd->e = NULL; + dd->action = DISK_ADD; +- rv = imsm_read_serial(fd, devname, dd->serial); ++ rv = imsm_read_serial(fd, devname, dd->serial, MAX_RAID_SERIAL_LEN); + if (rv) { + pr_err("failed to retrieve scsi serial, aborting\n"); + if (dd->devname) +-- +2.7.5 + diff --git a/SOURCES/0053-Respect-CROSS_COMPILE-when-CC-is-the-default.patch b/SOURCES/0053-Respect-CROSS_COMPILE-when-CC-is-the-default.patch new file mode 100644 index 0000000..d5ed468 --- /dev/null +++ b/SOURCES/0053-Respect-CROSS_COMPILE-when-CC-is-the-default.patch @@ -0,0 +1,36 @@ +From aced6fc9542077a69b00d05bc9cd66c12fc34950 Mon Sep 17 00:00:00 2001 +From: dann frazier +Date: Mon, 9 Dec 2019 13:54:13 -0700 +Subject: [RHEL7.9 PATCH 53/71] Respect $(CROSS_COMPILE) when $(CC) is the + default + +Commit 1180ed5 told make to only respect $(CROSS_COMPILE) when $(CC) +was unset. But that will never be the case, as make provides +a default value for $(CC). Change this logic to respect $(CROSS_COMPILE) +when $(CC) is the default. Patch originally by Helmet Grohne. + +Fixes: 1180ed5 ("Makefile: make the CC definition conditional") +Signed-off-by: dann frazier +Signed-off-by: Jes Sorensen +--- + Makefile | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index dfe00b0..a33319a 100644 +--- a/Makefile ++++ b/Makefile +@@ -46,7 +46,9 @@ ifdef COVERITY + COVERITY_FLAGS=-include coverity-gcc-hack.h + endif + +-CC ?= $(CROSS_COMPILE)gcc ++ifeq ($(origin CC),default) ++CC := $(CROSS_COMPILE)gcc ++endif + CXFLAGS ?= -ggdb + CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter + ifdef WARN_UNUSED +-- +2.7.5 + diff --git a/SOURCES/0054-Change-warning-message.patch b/SOURCES/0054-Change-warning-message.patch new file mode 100644 index 0000000..cbe4ac2 --- /dev/null +++ b/SOURCES/0054-Change-warning-message.patch @@ -0,0 +1,39 @@ +From 1a87493014050e3bd94000cd36122c3cadf21270 Mon Sep 17 00:00:00 2001 +From: Kinga Tanska +Date: Tue, 10 Dec 2019 12:21:21 +0100 +Subject: [RHEL7.9 PATCH 54/71] Change warning message + +In commit 039b7225e6 ("md: allow creation of mdNNN arrays via +md_mod/parameters/new_array") support for name like mdNNN +was added. Special warning, when kernel is unable to handle +request, was added in commit 7105228e19 +("mdadm/mdopen: create new function create_named_array for +writing to new_array"), but it was not adequate enough, +because in this situation mdadm tries to do it in old way. +This commit changes warning to be more relevant when +creating RAID container with "/dev/mdNNN" name and mdadm +back to old approach. + +Signed-off-by: Kinga Tanska +Signed-off-by: Jes Sorensen +--- + mdopen.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/mdopen.c b/mdopen.c +index 98c54e4..245be53 100644 +--- a/mdopen.c ++++ b/mdopen.c +@@ -120,7 +120,8 @@ int create_named_array(char *devnm) + close(fd); + } + if (fd < 0 || n != (int)strlen(devnm)) { +- pr_err("Fail create %s when using %s\n", devnm, new_array_file); ++ pr_err("Fail to create %s when using %s, fallback to creation via node\n", ++ devnm, new_array_file); + return 0; + } + +-- +2.7.5 + diff --git a/SOURCES/0055-mdcheck-service-can-t-start-succesfully-because-of-s.patch b/SOURCES/0055-mdcheck-service-can-t-start-succesfully-because-of-s.patch new file mode 100644 index 0000000..d0a8ebb --- /dev/null +++ b/SOURCES/0055-mdcheck-service-can-t-start-succesfully-because-of-s.patch @@ -0,0 +1,45 @@ +From e1512e7b7d060f0346738b237ea34eac21b29a26 Mon Sep 17 00:00:00 2001 +From: Xiao Ni +Date: Wed, 18 Dec 2019 14:46:21 +0800 +Subject: [RHEL7.9 PATCH 55/71] mdcheck service can't start succesfully because + of syntax error + +It reports error when starting mdcheck_start and mdcheck_continue service. +Invalid environment assignment, ignoring: MDADM_CHECK_DURATION="6 hours" + +Signed-off-by: Xiao Ni +Signed-off-by: Jes Sorensen +--- + systemd/mdcheck_continue.service | 2 +- + systemd/mdcheck_start.service | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/systemd/mdcheck_continue.service b/systemd/mdcheck_continue.service +index deac695..aa02dde 100644 +--- a/systemd/mdcheck_continue.service ++++ b/systemd/mdcheck_continue.service +@@ -11,7 +11,7 @@ ConditionPathExistsGlob = /var/lib/mdcheck/MD_UUID_* + + [Service] + Type=oneshot +-Environment= MDADM_CHECK_DURATION="6 hours" ++Environment= "MDADM_CHECK_DURATION=6 hours" + EnvironmentFile=-/run/sysconfig/mdadm + ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh + ExecStart=/usr/share/mdadm/mdcheck --continue --duration ${MDADM_CHECK_DURATION} +diff --git a/systemd/mdcheck_start.service b/systemd/mdcheck_start.service +index f17f1aa..da62d5f 100644 +--- a/systemd/mdcheck_start.service ++++ b/systemd/mdcheck_start.service +@@ -11,7 +11,7 @@ Wants=mdcheck_continue.timer + + [Service] + Type=oneshot +-Environment= MDADM_CHECK_DURATION="6 hours" ++Environment= "MDADM_CHECK_DURATION=6 hours" + EnvironmentFile=-/run/sysconfig/mdadm + ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh + ExecStart=/usr/share/mdadm/mdcheck --duration ${MDADM_CHECK_DURATION} +-- +2.7.5 + diff --git a/SOURCES/0056-imsm-Update-grow-manual.patch b/SOURCES/0056-imsm-Update-grow-manual.patch new file mode 100644 index 0000000..3afb343 --- /dev/null +++ b/SOURCES/0056-imsm-Update-grow-manual.patch @@ -0,0 +1,43 @@ +From 4431efebabd0dd39f33dc1dd8ada312b8da1c9d8 Mon Sep 17 00:00:00 2001 +From: Blazej Kucman +Date: Thu, 16 Jan 2020 09:34:44 +0100 +Subject: [RHEL7.9 PATCH 56/71] imsm: Update grow manual. + +Update --grow option description in manual, according to +the supported grow operations by IMSM. + +Signed-off-by: Blazej Kucman +Signed-off-by: Jes Sorensen +--- + mdadm.8.in | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/mdadm.8.in b/mdadm.8.in +index 6b63bb4..ca02a33 100644 +--- a/mdadm.8.in ++++ b/mdadm.8.in +@@ -481,9 +481,7 @@ still be larger than any replacement. + This value can be set with + .B \-\-grow + for RAID level 1/4/5/6 though +-.B CONTAINER +-based arrays such as those with IMSM metadata may not be able to +-support this. ++DDF arrays may not be able to support this. + If the array was created with a size smaller than the currently + active drives, the extra space can be accessed using + .BR \-\-grow . +@@ -2759,9 +2757,7 @@ container format. The number of devices in a container can be + increased - which affects all arrays in the container - or an array + in a container can be converted between levels where those levels are + supported by the container, and the conversion is on of those listed +-above. Resizing arrays in an IMSM container with +-.B "--grow --size" +-is not yet supported. ++above. + + .PP + Notes: +-- +2.7.5 + diff --git a/SOURCES/0057-Add-support-for-Tebibytes.patch b/SOURCES/0057-Add-support-for-Tebibytes.patch new file mode 100644 index 0000000..e064704 --- /dev/null +++ b/SOURCES/0057-Add-support-for-Tebibytes.patch @@ -0,0 +1,192 @@ +From 42e641abeb312a91b841f1b1ea73661e4bd5a31c Mon Sep 17 00:00:00 2001 +From: Kinga Tanska +Date: Tue, 21 Jan 2020 10:38:52 +0100 +Subject: [RHEL7.9 PATCH 57/71] Add support for Tebibytes + +Adding support for Tebibytes enables display size of +volumes in Tebibytes and Terabytes when they are +bigger than 2048 GiB (or GB). + +Signed-off-by: Kinga Tanska +Signed-off-by: Jes Sorensen +--- + mdadm.8.in | 20 ++++++++++---------- + util.c | 47 +++++++++++++++++++++++++++++++++-------------- + 2 files changed, 43 insertions(+), 24 deletions(-) + +diff --git a/mdadm.8.in b/mdadm.8.in +index ca02a33..5d00faf 100644 +--- a/mdadm.8.in ++++ b/mdadm.8.in +@@ -467,8 +467,8 @@ If this is not specified + size, though if there is a variance among the drives of greater than 1%, a warning is + issued. + +-A suffix of 'K', 'M' or 'G' can be given to indicate Kilobytes, Megabytes or +-Gigabytes respectively. ++A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, ++Megabytes, Gigabytes or Terabytes respectively. + + Sometimes a replacement drive can be a little smaller than the + original drives though this should be minimised by IDEMA standards. +@@ -532,8 +532,8 @@ problems the array can be made bigger again with no loss with another + .B "\-\-grow \-\-array\-size=" + command. + +-A suffix of 'K', 'M' or 'G' can be given to indicate Kilobytes, Megabytes or +-Gigabytes respectively. ++A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, ++Megabytes, Gigabytes or Terabytes respectively. + A value of + .B max + restores the apparent size of the array to be whatever the real +@@ -551,8 +551,8 @@ This is only meaningful for RAID0, RAID4, RAID5, RAID6, and RAID10. + RAID4, RAID5, RAID6, and RAID10 require the chunk size to be a power + of 2. In any case it must be a multiple of 4KB. + +-A suffix of 'K', 'M' or 'G' can be given to indicate Kilobytes, Megabytes or +-Gigabytes respectively. ++A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, ++Megabytes, Gigabytes or Terabytes respectively. + + .TP + .BR \-\-rounding= +@@ -767,8 +767,8 @@ When using an + bitmap, the chunksize defaults to 64Meg, or larger if necessary to + fit the bitmap into the available space. + +-A suffix of 'K', 'M' or 'G' can be given to indicate Kilobytes, Megabytes or +-Gigabytes respectively. ++A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, ++Megabytes, Gigabytes or Terabytes respectively. + + .TP + .BR \-W ", " \-\-write\-mostly +@@ -857,8 +857,8 @@ an array which was originally created using a different version of + which computed a different offset. + + Setting the offset explicitly over-rides the default. The value given +-is in Kilobytes unless a suffix of 'K', 'M' or 'G' is used to explicitly +-indicate Kilobytes, Megabytes or Gigabytes respectively. ++is in Kilobytes unless a suffix of 'K', 'M', 'G' or 'T' is used to explicitly ++indicate Kilobytes, Megabytes, Gigabytes or Terabytes respectively. + + Since Linux 3.4, + .B \-\-data\-offset +diff --git a/util.c b/util.c +index 64dd409..07f9dc3 100644 +--- a/util.c ++++ b/util.c +@@ -389,7 +389,7 @@ int mdadm_version(char *version) + unsigned long long parse_size(char *size) + { + /* parse 'size' which should be a number optionally +- * followed by 'K', 'M', or 'G'. ++ * followed by 'K', 'M'. 'G' or 'T'. + * Without a suffix, K is assumed. + * Number returned is in sectors (half-K) + * INVALID_SECTORS returned on error. +@@ -411,6 +411,10 @@ unsigned long long parse_size(char *size) + c++; + s *= 1024 * 1024 * 2; + break; ++ case 'T': ++ c++; ++ s *= 1024 * 1024 * 1024 * 2LL; ++ break; + case 's': /* sectors */ + c++; + break; +@@ -893,13 +897,14 @@ char *human_size(long long bytes) + { + static char buf[47]; + +- /* We convert bytes to either centi-M{ega,ibi}bytes or +- * centi-G{igi,ibi}bytes, with appropriate rounding, +- * and then print 1/100th of those as a decimal. ++ /* We convert bytes to either centi-M{ega,ibi}bytes, ++ * centi-G{igi,ibi}bytes or centi-T{era,ebi}bytes ++ * with appropriate rounding, and then print ++ * 1/100th of those as a decimal. + * We allow upto 2048Megabytes before converting to +- * gigabytes, as that shows more precision and isn't ++ * gigabytes and 2048Gigabytes before converting to ++ * terabytes, as that shows more precision and isn't + * too large a number. +- * Terabytes are not yet handled. + */ + + if (bytes < 5000*1024) +@@ -909,11 +914,16 @@ char *human_size(long long bytes) + long cMB = (bytes / ( 1000000LL / 200LL ) +1) /2; + snprintf(buf, sizeof(buf), " (%ld.%02ld MiB %ld.%02ld MB)", + cMiB/100, cMiB % 100, cMB/100, cMB % 100); +- } else { ++ } else if (bytes < 2*1024LL*1024LL*1024LL*1024LL) { + long cGiB = (bytes * 200LL / (1LL<<30) +1) / 2; + long cGB = (bytes / (1000000000LL/200LL ) +1) /2; + snprintf(buf, sizeof(buf), " (%ld.%02ld GiB %ld.%02ld GB)", + cGiB/100, cGiB % 100, cGB/100, cGB % 100); ++ } else { ++ long cTiB = (bytes * 200LL / (1LL<<40) + 1) / 2; ++ long cTB = (bytes / (1000000000000LL / 200LL) + 1) / 2; ++ snprintf(buf, sizeof(buf), " (%ld.%02ld TiB %ld.%02ld TB)", ++ cTiB/100, cTiB % 100, cTB/100, cTB % 100); + } + return buf; + } +@@ -922,13 +932,14 @@ char *human_size_brief(long long bytes, int prefix) + { + static char buf[30]; + +- /* We convert bytes to either centi-M{ega,ibi}bytes or +- * centi-G{igi,ibi}bytes, with appropriate rounding, +- * and then print 1/100th of those as a decimal. ++ /* We convert bytes to either centi-M{ega,ibi}bytes, ++ * centi-G{igi,ibi}bytes or centi-T{era,ebi}bytes ++ * with appropriate rounding, and then print ++ * 1/100th of those as a decimal. + * We allow upto 2048Megabytes before converting to +- * gigabytes, as that shows more precision and isn't ++ * gigabytes and 2048Gigabytes before converting to ++ * terabytes, as that shows more precision and isn't + * too large a number. +- * Terabytes are not yet handled. + * + * If prefix == IEC, we mean prefixes like kibi,mebi,gibi etc. + * If prefix == JEDEC, we mean prefixes like kilo,mega,giga etc. +@@ -941,10 +952,14 @@ char *human_size_brief(long long bytes, int prefix) + long cMiB = (bytes * 200LL / (1LL<<20) +1) /2; + snprintf(buf, sizeof(buf), "%ld.%02ldMiB", + cMiB/100, cMiB % 100); +- } else { ++ } else if (bytes < 2*1024LL*1024LL*1024LL*1024LL) { + long cGiB = (bytes * 200LL / (1LL<<30) +1) /2; + snprintf(buf, sizeof(buf), "%ld.%02ldGiB", + cGiB/100, cGiB % 100); ++ } else { ++ long cTiB = (bytes * 200LL / (1LL<<40) + 1) / 2; ++ snprintf(buf, sizeof(buf), "%ld.%02ldTiB", ++ cTiB/100, cTiB % 100); + } + } + else if (prefix == JEDEC) { +@@ -952,10 +967,14 @@ char *human_size_brief(long long bytes, int prefix) + long cMB = (bytes / ( 1000000LL / 200LL ) +1) /2; + snprintf(buf, sizeof(buf), "%ld.%02ldMB", + cMB/100, cMB % 100); +- } else { ++ } else if (bytes < 2*1024LL*1024LL*1024LL*1024LL) { + long cGB = (bytes / (1000000000LL/200LL ) +1) /2; + snprintf(buf, sizeof(buf), "%ld.%02ldGB", + cGB/100, cGB % 100); ++ } else { ++ long cTB = (bytes / (1000000000000LL / 200LL) + 1) / 2; ++ snprintf(buf, sizeof(buf), "%ld.%02ldTB", ++ cTB/100, cTB % 100); + } + } + else +-- +2.7.5 + diff --git a/SOURCES/0058-imsm-fill-working_disks-according-to-metadata.patch b/SOURCES/0058-imsm-fill-working_disks-according-to-metadata.patch new file mode 100644 index 0000000..0410911 --- /dev/null +++ b/SOURCES/0058-imsm-fill-working_disks-according-to-metadata.patch @@ -0,0 +1,65 @@ +From 1e93d0d15913c3fa6d0de5af3fb5e4e3b3f068da Mon Sep 17 00:00:00 2001 +From: Blazej Kucman +Date: Fri, 17 Jan 2020 15:24:04 +0100 +Subject: [RHEL7.9 PATCH 58/71] imsm: fill working_disks according to metadata. + +Imsm tracks as "working_disk" each visible drive. +Assemble routine expects that the value will return count +of active member drives recorded in metadata. +As a side effect "--no-degraded" doesn't work correctly for imsm. +Align this field to others. +Added check, if the option --no-degraded is called with --scan. + +Signed-off-by: Blazej Kucman +Signed-off-by: Jes Sorensen +--- + mdadm.c | 9 ++++++--- + super-intel.c | 5 ++--- + 2 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/mdadm.c b/mdadm.c +index 256a97e..13dc24e 100644 +--- a/mdadm.c ++++ b/mdadm.c +@@ -1485,9 +1485,12 @@ int main(int argc, char *argv[]) + rv = Manage_stop(devlist->devname, mdfd, c.verbose, 0); + break; + case ASSEMBLE: +- if (devs_found == 1 && ident.uuid_set == 0 && +- ident.super_minor == UnSet && ident.name[0] == 0 && +- !c.scan ) { ++ if (!c.scan && c.runstop == -1) { ++ pr_err("--no-degraded not meaningful without a --scan assembly.\n"); ++ exit(1); ++ } else if (devs_found == 1 && ident.uuid_set == 0 && ++ ident.super_minor == UnSet && ident.name[0] == 0 && ++ !c.scan) { + /* Only a device has been given, so get details from config file */ + struct mddev_ident *array_ident = conf_get_ident(devlist->devname); + if (array_ident == NULL) { +diff --git a/super-intel.c b/super-intel.c +index 5c1f759..47809bc 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -7946,7 +7946,8 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra + skip = 1; + if (!skip && (ord & IMSM_ORD_REBUILD)) + recovery_start = 0; +- ++ if (!(ord & IMSM_ORD_REBUILD)) ++ this->array.working_disks++; + /* + * if we skip some disks the array will be assmebled degraded; + * reset resync start to avoid a dirty-degraded +@@ -7988,8 +7989,6 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra + else + this->array.spare_disks++; + } +- if (info_d->recovery_start == MaxSector) +- this->array.working_disks++; + + info_d->events = __le32_to_cpu(mpb->generation_num); + info_d->data_offset = pba_of_lba0(map); +-- +2.7.5 + diff --git a/SOURCES/0059-mdadm.8-add-note-information-for-raid0-growing-opera.patch b/SOURCES/0059-mdadm.8-add-note-information-for-raid0-growing-opera.patch new file mode 100644 index 0000000..7451671 --- /dev/null +++ b/SOURCES/0059-mdadm.8-add-note-information-for-raid0-growing-opera.patch @@ -0,0 +1,55 @@ +From 2551061c253b8fd45ee93d1aab3e91d2c7ac9c20 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Mon, 24 Feb 2020 12:34:09 +0100 +Subject: [RHEL7.9 PATCH 59/71] mdadm.8: add note information for raid0 growing + operation + +When growing a raid0 device, if the new component disk size is not +big enough, the grow operation may fail due to lack of backup space. + +The minimum backup space should be larger than: + LCM(old, new) * chunk-size * 2 + +where LCM() is the least common multiple of the old and new count of +component disks, and "* 2" comes from the fact that mdadm refuses to +use more than half of a spare device for backup space. + +There are users reporting such failure when they grew a raid0 array +with small component disk. Neil Brown points out this is not a bug +and how the failure comes. This patch adds note information into +mdadm(8) man page in the Notes part of GROW MODE section to explain +the minimum size requirement of new component disk size or external +backup size. + +Reviewed-by: Petr Vorel +Cc: NeilBrown +Cc: Jes Sorensen +Cc: Paul Menzel +Cc: Wols Lists +Cc: Nix +Signed-off-by: Coly Li +Signed-off-by: Jes Sorensen +--- + mdadm.8.in | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/mdadm.8.in b/mdadm.8.in +index 5d00faf..a3494a1 100644 +--- a/mdadm.8.in ++++ b/mdadm.8.in +@@ -2768,6 +2768,12 @@ option and it is transparent for assembly feature. + .IP \(bu 4 + Roaming between Windows(R) and Linux systems for IMSM metadata is not + supported during grow process. ++.IP \(bu 4 ++When growing a raid0 device, the new component disk size (or external ++backup size) should be larger than LCM(old, new) * chunk-size * 2, ++where LCM() is the least common multiple of the old and new count of ++component disks, and "* 2" comes from the fact that mdadm refuses to ++use more than half of a spare device for backup space. + + .SS SIZE CHANGES + Normally when an array is built the "size" is taken from the smallest +-- +2.7.5 + diff --git a/SOURCES/0060-Remove-the-legacy-whitespace.patch b/SOURCES/0060-Remove-the-legacy-whitespace.patch new file mode 100644 index 0000000..5f0dd27 --- /dev/null +++ b/SOURCES/0060-Remove-the-legacy-whitespace.patch @@ -0,0 +1,59 @@ +From fd38b8ea80ff8e0317e12d1d70431148ceedd5fd Mon Sep 17 00:00:00 2001 +From: Xiao Ni +Date: Tue, 11 Feb 2020 21:44:15 +0800 +Subject: [RHEL7.9 PATCH 60/71] Remove the legacy whitespace + +The whitespace between Environment= and the true value causes confusion. +To avoid confusing other people in future, remove the whitespace to keep +it a simple, unambiguous syntax + +Signed-off-by: Xiao Ni +Signed-off-by: Jes Sorensen +--- + systemd/mdcheck_continue.service | 2 +- + systemd/mdcheck_start.service | 2 +- + systemd/mdmonitor-oneshot.service | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/systemd/mdcheck_continue.service b/systemd/mdcheck_continue.service +index aa02dde..854317f 100644 +--- a/systemd/mdcheck_continue.service ++++ b/systemd/mdcheck_continue.service +@@ -11,7 +11,7 @@ ConditionPathExistsGlob = /var/lib/mdcheck/MD_UUID_* + + [Service] + Type=oneshot +-Environment= "MDADM_CHECK_DURATION=6 hours" ++Environment="MDADM_CHECK_DURATION=6 hours" + EnvironmentFile=-/run/sysconfig/mdadm + ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh + ExecStart=/usr/share/mdadm/mdcheck --continue --duration ${MDADM_CHECK_DURATION} +diff --git a/systemd/mdcheck_start.service b/systemd/mdcheck_start.service +index da62d5f..3bb3d13 100644 +--- a/systemd/mdcheck_start.service ++++ b/systemd/mdcheck_start.service +@@ -11,7 +11,7 @@ Wants=mdcheck_continue.timer + + [Service] + Type=oneshot +-Environment= "MDADM_CHECK_DURATION=6 hours" ++Environment="MDADM_CHECK_DURATION=6 hours" + EnvironmentFile=-/run/sysconfig/mdadm + ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh + ExecStart=/usr/share/mdadm/mdcheck --duration ${MDADM_CHECK_DURATION} +diff --git a/systemd/mdmonitor-oneshot.service b/systemd/mdmonitor-oneshot.service +index fd469b1..373955a 100644 +--- a/systemd/mdmonitor-oneshot.service ++++ b/systemd/mdmonitor-oneshot.service +@@ -9,7 +9,7 @@ + Description=Reminder for degraded MD arrays + + [Service] +-Environment= MDADM_MONITOR_ARGS=--scan ++Environment=MDADM_MONITOR_ARGS=--scan + EnvironmentFile=-/run/sysconfig/mdadm + ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh + ExecStart=BINDIR/mdadm --monitor --oneshot $MDADM_MONITOR_ARGS +-- +2.7.5 + diff --git a/SOURCES/0061-imsm-pass-subarray-id-to-kill_subarray-function.patch b/SOURCES/0061-imsm-pass-subarray-id-to-kill_subarray-function.patch new file mode 100644 index 0000000..7ea6dc8 --- /dev/null +++ b/SOURCES/0061-imsm-pass-subarray-id-to-kill_subarray-function.patch @@ -0,0 +1,91 @@ +From 3364781b929f571a3dc3a6afed09eb1b03ce607c Mon Sep 17 00:00:00 2001 +From: Blazej Kucman +Date: Wed, 19 Feb 2020 10:54:49 +0100 +Subject: [RHEL7.9 PATCH 61/71] imsm: pass subarray id to kill_subarray + function + +After patch b6180160f ("imsm: save current_vol number") +current_vol for imsm is not set and kill_subarray() +cannot determine which volume has to be deleted. +Volume has to be passed as "subarray_id". +The parameter affects only IMSM metadata. + +Signed-off-by: Blazej Kucman +Signed-off-by: Jes Sorensen +--- + Kill.c | 2 +- + mdadm.h | 3 ++- + super-ddf.c | 2 +- + super-intel.c | 9 ++++----- + 4 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/Kill.c b/Kill.c +index d4767e2..bfd0efd 100644 +--- a/Kill.c ++++ b/Kill.c +@@ -119,7 +119,7 @@ int Kill_subarray(char *dev, char *subarray, int verbose) + st->update_tail = &st->updates; + + /* ok we've found our victim, drop the axe */ +- rv = st->ss->kill_subarray(st); ++ rv = st->ss->kill_subarray(st, subarray); + if (rv) { + if (verbose >= 0) + pr_err("Failed to delete subarray-%s from %s\n", +diff --git a/mdadm.h b/mdadm.h +index 9e98778..d94569f 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -1038,7 +1038,8 @@ extern struct superswitch { + /* query the supertype for default geometry */ + void (*default_geometry)(struct supertype *st, int *level, int *layout, int *chunk); /* optional */ + /* Permit subarray's to be deleted from inactive containers */ +- int (*kill_subarray)(struct supertype *st); /* optional */ ++ int (*kill_subarray)(struct supertype *st, ++ char *subarray_id); /* optional */ + /* Permit subarray's to be modified */ + int (*update_subarray)(struct supertype *st, char *subarray, + char *update, struct mddev_ident *ident); /* optional */ +diff --git a/super-ddf.c b/super-ddf.c +index 7802063..7cd5702 100644 +--- a/super-ddf.c ++++ b/super-ddf.c +@@ -4446,7 +4446,7 @@ static int _kill_subarray_ddf(struct ddf_super *ddf, const char *guid) + return 0; + } + +-static int kill_subarray_ddf(struct supertype *st) ++static int kill_subarray_ddf(struct supertype *st, char *subarray_id) + { + struct ddf_super *ddf = st->sb; + /* +diff --git a/super-intel.c b/super-intel.c +index 47809bc..e4d2122 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -7600,18 +7600,17 @@ static void default_geometry_imsm(struct supertype *st, int *level, int *layout, + + static void handle_missing(struct intel_super *super, struct imsm_dev *dev); + +-static int kill_subarray_imsm(struct supertype *st) ++static int kill_subarray_imsm(struct supertype *st, char *subarray_id) + { +- /* remove the subarray currently referenced by ->current_vol */ ++ /* remove the subarray currently referenced by subarray_id */ + __u8 i; + struct intel_dev **dp; + struct intel_super *super = st->sb; +- __u8 current_vol = super->current_vol; ++ __u8 current_vol = strtoul(subarray_id, NULL, 10); + struct imsm_super *mpb = super->anchor; + +- if (super->current_vol < 0) ++ if (mpb->num_raid_devs == 0) + return 2; +- super->current_vol = -1; /* invalidate subarray cursor */ + + /* block deletions that would change the uuid of active subarrays + * +-- +2.7.5 + diff --git a/SOURCES/0062-imsm-Remove-dump-restore-implementation.patch b/SOURCES/0062-imsm-Remove-dump-restore-implementation.patch new file mode 100644 index 0000000..38991f2 --- /dev/null +++ b/SOURCES/0062-imsm-Remove-dump-restore-implementation.patch @@ -0,0 +1,91 @@ +From 45c43276d02a32876c7e1f9f0d04580595141b3d Mon Sep 17 00:00:00 2001 +From: Blazej Kucman +Date: Wed, 19 Feb 2020 11:13:17 +0100 +Subject: [RHEL7.9 PATCH 62/71] imsm: Remove --dump/--restore implementation + +Functionalities --dump and --restore are not supported. +Remove dead code from imsm. + +Signed-off-by: Blazej Kucman +Signed-off-by: Jes Sorensen +--- + super-intel.c | 56 -------------------------------------------------------- + 1 file changed, 56 deletions(-) + +diff --git a/super-intel.c b/super-intel.c +index e4d2122..c9a1af5 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -2128,61 +2128,6 @@ static void export_examine_super_imsm(struct supertype *st) + printf("MD_DEVICES=%u\n", mpb->num_disks); + } + +-static int copy_metadata_imsm(struct supertype *st, int from, int to) +-{ +- /* The second last sector of the device contains +- * the "struct imsm_super" metadata. +- * This contains mpb_size which is the size in bytes of the +- * extended metadata. This is located immediately before +- * the imsm_super. +- * We want to read all that, plus the last sector which +- * may contain a migration record, and write it all +- * to the target. +- */ +- void *buf; +- unsigned long long dsize, offset; +- int sectors; +- struct imsm_super *sb; +- struct intel_super *super = st->sb; +- unsigned int sector_size = super->sector_size; +- unsigned int written = 0; +- +- if (posix_memalign(&buf, MAX_SECTOR_SIZE, MAX_SECTOR_SIZE) != 0) +- return 1; +- +- if (!get_dev_size(from, NULL, &dsize)) +- goto err; +- +- if (lseek64(from, dsize-(2*sector_size), 0) < 0) +- goto err; +- if ((unsigned int)read(from, buf, sector_size) != sector_size) +- goto err; +- sb = buf; +- if (strncmp((char*)sb->sig, MPB_SIGNATURE, MPB_SIG_LEN) != 0) +- goto err; +- +- sectors = mpb_sectors(sb, sector_size) + 2; +- offset = dsize - sectors * sector_size; +- if (lseek64(from, offset, 0) < 0 || +- lseek64(to, offset, 0) < 0) +- goto err; +- while (written < sectors * sector_size) { +- int n = sectors*sector_size - written; +- if (n > 4096) +- n = 4096; +- if (read(from, buf, n) != n) +- goto err; +- if (write(to, buf, n) != n) +- goto err; +- written += n; +- } +- free(buf); +- return 0; +-err: +- free(buf); +- return 1; +-} +- + static void detail_super_imsm(struct supertype *st, char *homehost, + char *subarray) + { +@@ -12270,7 +12215,6 @@ struct superswitch super_imsm = { + .reshape_super = imsm_reshape_super, + .manage_reshape = imsm_manage_reshape, + .recover_backup = recover_backup_imsm, +- .copy_metadata = copy_metadata_imsm, + .examine_badblocks = examine_badblocks_imsm, + .match_home = match_home_imsm, + .uuid_from_super= uuid_from_super_imsm, +-- +2.7.5 + diff --git a/SOURCES/0063-imsm-Correct-minimal-device-size.patch b/SOURCES/0063-imsm-Correct-minimal-device-size.patch new file mode 100644 index 0000000..1ba36ea --- /dev/null +++ b/SOURCES/0063-imsm-Correct-minimal-device-size.patch @@ -0,0 +1,32 @@ +From 06a6101c0a4d2658798dc42f461ace8e6900f840 Mon Sep 17 00:00:00 2001 +From: Blazej Kucman +Date: Wed, 11 Mar 2020 15:40:13 +0100 +Subject: [RHEL7.9 PATCH 63/71] imsm: Correct minimal device size. + +Check if given size of member drive is not less than 1 MibiByte. + +Signed-off-by: Blazej Kucman +Signed-off-by: Jes Sorensen +--- + super-intel.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/super-intel.c b/super-intel.c +index c9a1af5..6680df2 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -7425,7 +7425,10 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout, + verbose); + } + +- if (size && (size < 1024)) { ++ /* ++ * Size is given in sectors. ++ */ ++ if (size && (size < 2048)) { + pr_err("Given size must be greater than 1M.\n"); + /* Depends on algorithm in Create.c : + * if container was given (dev == NULL) return -1, +-- +2.7.5 + diff --git a/SOURCES/0064-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch b/SOURCES/0064-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch new file mode 100644 index 0000000..25b1b3b --- /dev/null +++ b/SOURCES/0064-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch @@ -0,0 +1,30 @@ +From 9e4494051de3f53228fabae56c116879bff5a0c8 Mon Sep 17 00:00:00 2001 +From: Lidong Zhong +Date: Mon, 16 Mar 2020 10:16:49 +0800 +Subject: [RHEL7.9 PATCH 64/71] Detail: show correct bitmap info for cluster + raid device + +Signed-off-by: Lidong Zhong +Signed-off-by: Jes Sorensen +--- + Detail.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/Detail.c b/Detail.c +index 832485f..daec4f1 100644 +--- a/Detail.c ++++ b/Detail.c +@@ -468,7 +468,9 @@ int Detail(char *dev, struct context *c) + if (ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 && bmf.pathname[0]) { + printf(" Intent Bitmap : %s\n", bmf.pathname); + printf("\n"); +- } else if (array.state & (1< +Date: Tue, 17 Mar 2020 10:20:12 +0100 +Subject: [RHEL7.9 PATCH 65/71] imsm: support the Array Creation Time field in + metadata + +Also present its value in --examine and --examine --export. + +Signed-off-by: Artur Paszkiewicz +Signed-off-by: Jes Sorensen +--- + super-intel.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/super-intel.c b/super-intel.c +index 6680df2..8840fff 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -260,8 +260,9 @@ struct imsm_super { + * (starts at 1) + */ + __u16 filler1; /* 0x4E - 0x4F */ +-#define IMSM_FILLERS 34 +- __u32 filler[IMSM_FILLERS]; /* 0x50 - 0xD7 RAID_MPB_FILLERS */ ++ __u64 creation_time; /* 0x50 - 0x57 Array creation time */ ++#define IMSM_FILLERS 32 ++ __u32 filler[IMSM_FILLERS]; /* 0x58 - 0xD7 RAID_MPB_FILLERS */ + struct imsm_disk disk[1]; /* 0xD8 diskTbl[numDisks] */ + /* here comes imsm_dev[num_raid_devs] */ + /* here comes BBM logs */ +@@ -2014,6 +2015,7 @@ static void examine_super_imsm(struct supertype *st, char *homehost) + __u32 sum; + __u32 reserved = imsm_reserved_sectors(super, super->disks); + struct dl *dl; ++ time_t creation_time; + + strncpy(str, (char *)mpb->sig, MPB_SIG_LEN); + str[MPB_SIG_LEN-1] = '\0'; +@@ -2022,6 +2024,9 @@ static void examine_super_imsm(struct supertype *st, char *homehost) + printf(" Orig Family : %08x\n", __le32_to_cpu(mpb->orig_family_num)); + printf(" Family : %08x\n", __le32_to_cpu(mpb->family_num)); + printf(" Generation : %08x\n", __le32_to_cpu(mpb->generation_num)); ++ creation_time = __le64_to_cpu(mpb->creation_time); ++ printf(" Creation Time : %.24s\n", ++ creation_time ? ctime(&creation_time) : "Unknown"); + printf(" Attributes : "); + if (imsm_check_attributes(mpb->attributes)) + printf("All supported\n"); +@@ -2126,6 +2131,7 @@ static void export_examine_super_imsm(struct supertype *st) + printf("MD_LEVEL=container\n"); + printf("MD_UUID=%s\n", nbuf+5); + printf("MD_DEVICES=%u\n", mpb->num_disks); ++ printf("MD_CREATION_TIME=%llu\n", __le64_to_cpu(mpb->creation_time)); + } + + static void detail_super_imsm(struct supertype *st, char *homehost, +@@ -5762,6 +5768,7 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk, + sum += __gen_imsm_checksum(mpb); + mpb->family_num = __cpu_to_le32(sum); + mpb->orig_family_num = mpb->family_num; ++ mpb->creation_time = __cpu_to_le64((__u64)time(NULL)); + } + super->current_disk = dl; + return 0; +-- +2.7.5 + diff --git a/SOURCES/0066-imsm-show-Subarray-and-Volume-ID-in-examine-output.patch b/SOURCES/0066-imsm-show-Subarray-and-Volume-ID-in-examine-output.patch new file mode 100644 index 0000000..2d26175 --- /dev/null +++ b/SOURCES/0066-imsm-show-Subarray-and-Volume-ID-in-examine-output.patch @@ -0,0 +1,39 @@ +From ba1b3bc80ea555c288f1119e69d9273249967081 Mon Sep 17 00:00:00 2001 +From: Artur Paszkiewicz +Date: Tue, 17 Mar 2020 10:21:03 +0100 +Subject: [RHEL7.9 PATCH 66/71] imsm: show Subarray and Volume ID in --examine + output + +Show the index of the subarray as 'Subarray' and the value of the +my_vol_raid_dev_num field as 'Volume ID'. + +Signed-off-by: Artur Paszkiewicz +Signed-off-by: Jes Sorensen +--- + super-intel.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/super-intel.c b/super-intel.c +index 8840fff..562a58c 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -1579,6 +1579,7 @@ static void print_imsm_dev(struct intel_super *super, + + printf("\n"); + printf("[%.16s]:\n", dev->volume); ++ printf(" Subarray : %d\n", super->current_vol); + printf(" UUID : %s\n", uuid); + printf(" RAID Level : %d", get_imsm_raid_level(map)); + if (map2) +@@ -1683,6 +1684,8 @@ static void print_imsm_dev(struct intel_super *super, + printf("Multiple PPLs on journaling drive\n"); + else + printf("\n", dev->rwh_policy); ++ ++ printf(" Volume ID : %u\n", dev->my_vol_raid_dev_num); + } + + static void print_imsm_disk(struct imsm_disk *disk, +-- +2.7.5 + diff --git a/SOURCES/0067-udev-Ignore-change-event-for-imsm.patch b/SOURCES/0067-udev-Ignore-change-event-for-imsm.patch new file mode 100644 index 0000000..a7bdc74 --- /dev/null +++ b/SOURCES/0067-udev-Ignore-change-event-for-imsm.patch @@ -0,0 +1,35 @@ +From e1b92ee0de26576a33b20c9dd6ef6bd8cab8e283 Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +Date: Wed, 8 Apr 2020 16:44:52 +0200 +Subject: [RHEL7.9 PATCH 67/71] udev: Ignore change event for imsm + +When adding a device to a container mdadm has to close its file +descriptor before sysfs_add_disk(). This generates change event. +There is race possibility because metadata is already written and other +-I process can place drive differently. As a result device can be added +to two containers simultaneously. +From IMSM perspective there is no need to react for change event. IMSM +doesn't support stacked devices. + +Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Jes Sorensen +--- + udev-md-raid-assembly.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/udev-md-raid-assembly.rules b/udev-md-raid-assembly.rules +index 9f055ed..d668cdd 100644 +--- a/udev-md-raid-assembly.rules ++++ b/udev-md-raid-assembly.rules +@@ -23,7 +23,7 @@ IMPORT{cmdline}="nodmraid" + ENV{nodmraid}=="?*", GOTO="md_inc_end" + ENV{ID_FS_TYPE}=="ddf_raid_member", GOTO="md_inc" + ENV{noiswmd}=="?*", GOTO="md_inc_end" +-ENV{ID_FS_TYPE}=="isw_raid_member", GOTO="md_inc" ++ENV{ID_FS_TYPE}=="isw_raid_member", ACTION!="change", GOTO="md_inc" + GOTO="md_inc_end" + + LABEL="md_inc" +-- +2.7.5 + diff --git a/SOURCES/0068-Monitor-improve-check_one_sharer-for-checking-duplic.patch b/SOURCES/0068-Monitor-improve-check_one_sharer-for-checking-duplic.patch new file mode 100644 index 0000000..334f85a --- /dev/null +++ b/SOURCES/0068-Monitor-improve-check_one_sharer-for-checking-duplic.patch @@ -0,0 +1,109 @@ +From 185ec4397e61ad00dd68c841e15eaa8629eb9514 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Sat, 11 Apr 2020 00:24:46 +0800 +Subject: [RHEL7.9 PATCH 68/71] Monitor: improve check_one_sharer() for + checking duplicated process + +When running mdadm monitor with scan mode, only one autorebuild process +is allowed. check_one_sharer() checks duplicated process by following +steps, +1) Read autorebuild.pid file, + - if file does not exist, no duplicated process, go to 3). + - if file exists, continue to next step. +2) Read pid number from autorebuild.pid file, then check procfs pid + directory /proc/, + - if the directory does not exist, no duplicated process, go to 3) + - if the directory exists, print error message for duplicated process + and exit this mdadm. +3) Write current pid into autorebuild.pid file, continue to monitor in + scan mode. + +The problem for the above step 2) is, if after system reboots and +another different process happens to have exact same pid number which +autorebuild.pid file records, check_one_sharer() will treat it as a +duplicated mdadm process and returns error with message "Only one +autorebuild process allowed in scan mode, aborting". + +This patch tries to fix the above same-pid-but-different-process issue +by one more step to check the process command name, +1) Read autorebuild.pid file + - if file does not exist, no duplicated process, go to 4). + - if file exists, continue to next step. +2) Read pid number from autorebuild.pid file, then check procfs file + comm with the specific pid directory /proc//comm + - if the file does not exit, it means the directory /proc/ does + not exist, go to 4) + - if the file exits, continue next step +3) Read process command name from /proc//comm, compare the command + name with "mdadm" process name, + - if not equal, no duplicated process, goto 4) + - if strings are equal, print error message for duplicated process + and exit this mdadm. +4) Write current pid into autorebuild.pid file, continue to monitor in + scan mode. + +Now check_one_sharer() returns error for duplicated process only when +the recorded pid from autorebuild.pid exists, and the process has exact +same command name as "mdadm". + +Reported-by: Shinkichi Yamazaki +Signed-off-by: Coly Li +Signed-off-by: Jes Sorensen +--- + Monitor.c | 32 ++++++++++++++++++++------------ + 1 file changed, 20 insertions(+), 12 deletions(-) + +diff --git a/Monitor.c b/Monitor.c +index b527165..2d6b3b9 100644 +--- a/Monitor.c ++++ b/Monitor.c +@@ -301,26 +301,34 @@ static int make_daemon(char *pidfile) + + static int check_one_sharer(int scan) + { +- int pid, rv; ++ int pid; ++ FILE *comm_fp; + FILE *fp; +- char dir[20]; ++ char comm_path[100]; + char path[100]; +- struct stat buf; ++ char comm[20]; ++ + sprintf(path, "%s/autorebuild.pid", MDMON_DIR); + fp = fopen(path, "r"); + if (fp) { + if (fscanf(fp, "%d", &pid) != 1) + pid = -1; +- sprintf(dir, "/proc/%d", pid); +- rv = stat(dir, &buf); +- if (rv != -1) { +- if (scan) { +- pr_err("Only one autorebuild process allowed in scan mode, aborting\n"); +- fclose(fp); +- return 1; +- } else { +- pr_err("Warning: One autorebuild process already running.\n"); ++ snprintf(comm_path, sizeof(comm_path), ++ "/proc/%d/comm", pid); ++ comm_fp = fopen(comm_path, "r"); ++ if (comm_fp) { ++ if (fscanf(comm_fp, "%s", comm) && ++ strncmp(basename(comm), Name, strlen(Name)) == 0) { ++ if (scan) { ++ pr_err("Only one autorebuild process allowed in scan mode, aborting\n"); ++ fclose(comm_fp); ++ fclose(fp); ++ return 1; ++ } else { ++ pr_err("Warning: One autorebuild process already running.\n"); ++ } + } ++ fclose(comm_fp); + } + fclose(fp); + } +-- +2.7.5 + diff --git a/SOURCES/0069-Detail-adding-sync-status-for-cluster-device.patch b/SOURCES/0069-Detail-adding-sync-status-for-cluster-device.patch new file mode 100644 index 0000000..9dea2d2 --- /dev/null +++ b/SOURCES/0069-Detail-adding-sync-status-for-cluster-device.patch @@ -0,0 +1,85 @@ +From 1c294b5d960abeeb9e0f188af294d019bc82b20e Mon Sep 17 00:00:00 2001 +From: Lidong Zhong +Date: Tue, 14 Apr 2020 16:19:41 +0800 +Subject: [RHEL7.9 PATCH 69/71] Detail: adding sync status for cluster device + +On the node with /proc/mdstat is + +Personalities : [raid1] +md0 : active raid1 sdb[4] sdc[3] sdd[2] + 1046528 blocks super 1.2 [3/2] [UU_] + recover=REMOTE + bitmap: 1/1 pages [4KB], 65536KB chunk + +Let's change the 'State' of 'mdadm -Q -D' accordingly +State : clean, degraded +With this patch, it will be +State : clean, degraded, recovering (REMOTE) + +Signed-off-by: Lidong Zhong +Acked-by: Guoqing Jiang +Signed-off-by: Jes Sorensen +--- + Detail.c | 9 ++++++--- + mdadm.h | 3 ++- + mdstat.c | 2 ++ + 3 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/Detail.c b/Detail.c +index daec4f1..24eeba0 100644 +--- a/Detail.c ++++ b/Detail.c +@@ -498,17 +498,20 @@ int Detail(char *dev, struct context *c) + } else + arrayst = "active"; + +- printf(" State : %s%s%s%s%s%s \n", ++ printf(" State : %s%s%s%s%s%s%s \n", + arrayst, st, + (!e || (e->percent < 0 && + e->percent != RESYNC_PENDING && +- e->percent != RESYNC_DELAYED)) ? ++ e->percent != RESYNC_DELAYED && ++ e->percent != RESYNC_REMOTE)) ? + "" : sync_action[e->resync], + larray_size ? "": ", Not Started", + (e && e->percent == RESYNC_DELAYED) ? + " (DELAYED)": "", + (e && e->percent == RESYNC_PENDING) ? +- " (PENDING)": ""); ++ " (PENDING)": "", ++ (e && e->percent == RESYNC_REMOTE) ? ++ " (REMOTE)": ""); + } else if (inactive && !is_container) { + printf(" State : inactive\n"); + } +diff --git a/mdadm.h b/mdadm.h +index d94569f..399478b 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -1815,7 +1815,8 @@ enum r0layout { + #define RESYNC_NONE -1 + #define RESYNC_DELAYED -2 + #define RESYNC_PENDING -3 +-#define RESYNC_UNKNOWN -4 ++#define RESYNC_REMOTE -4 ++#define RESYNC_UNKNOWN -5 + + /* When using "GET_DISK_INFO" it isn't certain how high + * we need to check. So we impose an absolute limit of +diff --git a/mdstat.c b/mdstat.c +index 7e600d0..20577a3 100644 +--- a/mdstat.c ++++ b/mdstat.c +@@ -257,6 +257,8 @@ struct mdstat_ent *mdstat_read(int hold, int start) + ent->percent = RESYNC_DELAYED; + if (l > 8 && strcmp(w+l-8, "=PENDING") == 0) + ent->percent = RESYNC_PENDING; ++ if (l > 7 && strcmp(w+l-7, "=REMOTE") == 0) ++ ent->percent = RESYNC_REMOTE; + } else if (ent->percent == RESYNC_NONE && + w[0] >= '0' && + w[0] <= '9' && +-- +2.7.5 + diff --git a/SOURCES/0070-Manage-imsm-Write-metadata-before-add.patch b/SOURCES/0070-Manage-imsm-Write-metadata-before-add.patch new file mode 100644 index 0000000..1ee8a97 --- /dev/null +++ b/SOURCES/0070-Manage-imsm-Write-metadata-before-add.patch @@ -0,0 +1,164 @@ +From 12724c018c964596aa277489fd287d5c3506361a Mon Sep 17 00:00:00 2001 +From: Tkaczyk Mariusz +Date: Fri, 17 Apr 2020 13:55:55 +0200 +Subject: [RHEL7.9 PATCH 70/71] Manage, imsm: Write metadata before add + +New drive in container always appears as spare. Manager is able to +handle that, and queues appropriative update to monitor. +No update from mdadm side has to be processed, just insert the drive and +ping the mdmon. Metadata has to be written if no mdmon is running (case +for Raid0 or container without arrays). + +If bare drive is added very early on startup (by custom bare rule), +there is possiblity that mdmon was not restarted after switch root. Old +one is not able to handle new drive. New one fails because there is +drive without metadata in container and metadata cannot be loaded. + +To prevent this, write spare metadata before adding device +to container. Mdmon will overwrite it (same case as spare migration, +if drive appears it writes the most recent metadata). +Metadata has to be written only on new drive before sysfs_add_disk(), +don't race with mdmon if running. + +Signed-off-by: Tkaczyk Mariusz +Signed-off-by: Jes Sorensen +--- + Manage.c | 6 +----- + super-intel.c | 66 ++++++++++++++++++++++++++++++++++++++--------------------- + 2 files changed, 44 insertions(+), 28 deletions(-) + +diff --git a/Manage.c b/Manage.c +index b22c396..0a5f09b 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -994,17 +994,13 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv, + + Kill(dv->devname, NULL, 0, -1, 0); + dfd = dev_open(dv->devname, O_RDWR | O_EXCL|O_DIRECT); +- if (mdmon_running(tst->container_devnm)) +- tst->update_tail = &tst->updates; + if (tst->ss->add_to_super(tst, &disc, dfd, + dv->devname, INVALID_SECTORS)) { + close(dfd); + close(container_fd); + return -1; + } +- if (tst->update_tail) +- flush_metadata_updates(tst); +- else ++ if (!mdmon_running(tst->container_devnm)) + tst->ss->sync_metadata(tst); + + sra = sysfs_read(container_fd, NULL, 0); +diff --git a/super-intel.c b/super-intel.c +index 562a58c..3a73d2b 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -5809,6 +5809,9 @@ int mark_spare(struct dl *disk) + return ret_val; + } + ++ ++static int write_super_imsm_spare(struct intel_super *super, struct dl *d); ++ + static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, + int fd, char *devname, + unsigned long long data_offset) +@@ -5938,9 +5941,13 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, + dd->next = super->disk_mgmt_list; + super->disk_mgmt_list = dd; + } else { ++ /* this is called outside of mdmon ++ * write initial spare metadata ++ * mdmon will overwrite it. ++ */ + dd->next = super->disks; + super->disks = dd; +- super->updates_pending++; ++ write_super_imsm_spare(super, dd); + } + + return 0; +@@ -5979,15 +5986,15 @@ static union { + struct imsm_super anchor; + } spare_record __attribute__ ((aligned(MAX_SECTOR_SIZE))); + +-/* spare records have their own family number and do not have any defined raid +- * devices +- */ +-static int write_super_imsm_spares(struct intel_super *super, int doclose) ++ ++static int write_super_imsm_spare(struct intel_super *super, struct dl *d) + { + struct imsm_super *mpb = super->anchor; + struct imsm_super *spare = &spare_record.anchor; + __u32 sum; +- struct dl *d; ++ ++ if (d->index != -1) ++ return 1; + + spare->mpb_size = __cpu_to_le32(sizeof(struct imsm_super)); + spare->generation_num = __cpu_to_le32(1UL); +@@ -6000,28 +6007,41 @@ static int write_super_imsm_spares(struct intel_super *super, int doclose) + snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH, + MPB_SIGNATURE MPB_VERSION_RAID0); + +- for (d = super->disks; d; d = d->next) { +- if (d->index != -1) +- continue; ++ spare->disk[0] = d->disk; ++ if (__le32_to_cpu(d->disk.total_blocks_hi) > 0) ++ spare->attributes |= MPB_ATTRIB_2TB_DISK; + +- spare->disk[0] = d->disk; +- if (__le32_to_cpu(d->disk.total_blocks_hi) > 0) +- spare->attributes |= MPB_ATTRIB_2TB_DISK; ++ if (super->sector_size == 4096) ++ convert_to_4k_imsm_disk(&spare->disk[0]); + +- if (super->sector_size == 4096) +- convert_to_4k_imsm_disk(&spare->disk[0]); ++ sum = __gen_imsm_checksum(spare); ++ spare->family_num = __cpu_to_le32(sum); ++ spare->orig_family_num = 0; ++ sum = __gen_imsm_checksum(spare); ++ spare->check_sum = __cpu_to_le32(sum); + +- sum = __gen_imsm_checksum(spare); +- spare->family_num = __cpu_to_le32(sum); +- spare->orig_family_num = 0; +- sum = __gen_imsm_checksum(spare); +- spare->check_sum = __cpu_to_le32(sum); ++ if (store_imsm_mpb(d->fd, spare)) { ++ pr_err("failed for device %d:%d %s\n", ++ d->major, d->minor, strerror(errno)); ++ return 1; ++ } ++ ++ return 0; ++} ++/* spare records have their own family number and do not have any defined raid ++ * devices ++ */ ++static int write_super_imsm_spares(struct intel_super *super, int doclose) ++{ ++ struct dl *d; ++ ++ for (d = super->disks; d; d = d->next) { ++ if (d->index != -1) ++ continue; + +- if (store_imsm_mpb(d->fd, spare)) { +- pr_err("failed for device %d:%d %s\n", +- d->major, d->minor, strerror(errno)); ++ if (write_super_imsm_spare(super, d)) + return 1; +- } ++ + if (doclose) { + close(d->fd); + d->fd = -1; +-- +2.7.5 + diff --git a/SOURCES/0071-Assemble-print-error-message-if-mdadm-fails-assembli.patch b/SOURCES/0071-Assemble-print-error-message-if-mdadm-fails-assembli.patch new file mode 100644 index 0000000..9b4b6b0 --- /dev/null +++ b/SOURCES/0071-Assemble-print-error-message-if-mdadm-fails-assembli.patch @@ -0,0 +1,57 @@ +From 5cfb79dea26d9d7266f79c7c196a1a9f70c16a28 Mon Sep 17 00:00:00 2001 +From: Gioh Kim +Date: Tue, 16 Apr 2019 18:08:17 +0200 +Subject: [RHEL7.9 PATCH 71/71] Assemble: print error message if mdadm fails + assembling with --uuid option + +When mdadm tries to assemble one working device and one zeroed-out device, +it failed but print successful message because there is --uuid option. + +Following script always reproduce it. + +dd if=/dev/zero of=/dev/ram0 oflag=direct +dd if=/dev/zero of=/dev/ram1 oflag=direct +./mdadm -C /dev/md111 -e 1.2 --uuid="12345678:12345678:12345678:12345678" \ + -l1 -n2 /dev/ram0 /dev/ram1 +./mdadm -S /dev/md111 +dd if=/dev/zero of=/dev/ram1 oflag=direct +./mdadm -A /dev/md111 --uuid="12345678:12345678:12345678:12345678" \ + /dev/ram0 /dev/ram1 + +Following is message from mdadm. + +mdadm: No super block found on /dev/ram1 (Expected magic a92b4efc, got 00000000) +mdadm: no RAID superblock on /dev/ram1 +mdadm: /dev/md111 assembled from 1 drive - need all 2 to start it (use --run to insist). + +The mdadm say that it assembled but mdadm does not create /dev/md111. +The message is wrong. + +After applying this patch, mdadm reports error correctly as following. + +mdadm: No super block found on /dev/ram1 (Expected magic a92b4efc, got 00000000) +mdadm: no RAID superblock on /dev/ram1 +mdadm: /dev/ram1 has no superblock - assembly aborted + +Signed-off-by: Gioh Kim +Signed-off-by: Jes Sorensen +--- + Assemble.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Assemble.c b/Assemble.c +index 6b5a7c8..2ed5884 100644 +--- a/Assemble.c ++++ b/Assemble.c +@@ -269,7 +269,7 @@ static int select_devices(struct mddev_dev *devlist, + if (auto_assem || !inargv) + /* Ignore unrecognised devices during auto-assembly */ + goto loop; +- if (ident->uuid_set || ident->name[0] || ++ if (ident->name[0] || + ident->super_minor != UnSet) + /* Ignore unrecognised device if looking for + * specific array */ +-- +2.7.5 + diff --git a/SOURCES/mdcheck b/SOURCES/mdcheck new file mode 100644 index 0000000..42d4094 --- /dev/null +++ b/SOURCES/mdcheck @@ -0,0 +1,164 @@ +#!/bin/bash + +# Copyright (C) 2014-2017 Neil Brown +# +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Author: Neil Brown +# Email: + +# This script should be run periodically to automatically +# perform a 'check' on any md arrays. +# +# It supports a 'time budget' such that any incomplete 'check' +# will be checkpointed when that time has expired. +# A subsequent invocation can allow the 'check' to continue. +# +# Options are: +# --continue Don't start new checks, only continue old ones. +# --duration This is passed to "date --date=$duration" to find out +# when to finish +# +# To support '--continue', arrays are identified by UUID and the 'sync_completed' +# value is stored in /var/lib/mdcheck/$UUID + +# convert a /dev/md name into /sys/.../md equivalent +sysname() { + set `ls -lLd $1` + maj=${5%,} + min=$6 + readlink -f /sys/dev/block/$maj:$min +} + +args=$(getopt -o hcd: -l help,continue,duration: -n mdcheck -- "$@") +rv=$? +if [ $rv -ne 0 ]; then exit $rv; fi + +eval set -- $args + +cont= +endtime= +while [ " $1" != " --" ] +do + case $1 in + --help ) + echo >&2 'Usage: mdcheck [--continue] [--duration time-offset]' + echo >&2 ' time-offset must be understood by "date --date"' + exit 0 + ;; + --continue ) cont=yes ;; + --duration ) shift; dur=$1 + endtime=$(date --date "$dur" "+%s") + ;; + esac + shift +done +shift + +# We need a temp file occasionally... +tmp=/var/lib/mdcheck/.md-check-$$ +trap 'rm -f "$tmp"' 0 2 3 15 + + +# firstly, clean out really old state files +mkdir -p /var/lib/mdcheck +find /var/lib/mdcheck -name "MD_UUID*" -type f -mtime +180 -exec rm {} \; + +# Now look at each md device. +cnt=0 +for dev in /dev/md?* +do + [ -e "$dev" ] || continue + sys=`sysname $dev` + if [ ! -f "$sys/md/sync_action" ] + then # cannot check this array + continue + fi + if [ "`cat $sys/md/sync_action`" != 'idle' ] + then # This array is busy + continue + fi + + mdadm --detail --export "$dev" | grep '^MD_UUID=' > $tmp || continue + source $tmp + fl="/var/lib/mdcheck/MD_UUID_$MD_UUID" + if [ -z "$cont" ] + then + start=0 + logger -p daemon.info mdcheck start checking $dev + elif [ -z "$MD_UUID" -o ! -f "$fl" ] + then + # Nothing to continue here + continue + else + start=`cat "$fl"` + logger -p daemon.info mdcheck continue checking $dev from $start + fi + + cnt=$[cnt+1] + eval MD_${cnt}_fl=\$fl + eval MD_${cnt}_sys=\$sys + eval MD_${cnt}_dev=\$dev + echo $start > $fl + echo $start > $sys/md/sync_min + echo check > $sys/md/sync_action +done + +if [ -z "$endtime" ] +then + exit 0 +fi + +while [ `date +%s` -lt $endtime ] +do + any= + for i in `eval echo {1..$cnt}` + do + eval fl=\$MD_${i}_fl + eval sys=\$MD_${i}_sys + + if [ -z "$fl" ]; then continue; fi + + if [ "`cat $sys/md/sync_action`" != 'check' ] + then + eval MD_${i}_fl= + rm -f $fl + continue; + fi + read a rest < $sys/md/sync_completed + echo $a > $fl + any=yes + done + if [ -z "$any" ]; then exit 0; fi + sleep 120 +done + +# We've waited, and there are still checks running. +# Time to stop them. +for i in `eval echo {1..$cnt}` +do + eval fl=\$MD_${i}_fl + eval sys=\$MD_${i}_sys + eval dev=\$MD_${i}_dev + + if [ -z "$fl" ]; then continue; fi + + if [ "`cat $sys/md/sync_action`" != 'check' ] + then + eval MD_${i}_fl= + rm -f $fl + continue; + fi + echo idle > $sys/md/sync_action + cat $sys/md/sync_min > $fl + logger -p daemon.info pause checking $dev at `cat $fl` +done diff --git a/SOURCES/mdcheck-continue.patch b/SOURCES/mdcheck-continue.patch new file mode 100644 index 0000000..6af695b --- /dev/null +++ b/SOURCES/mdcheck-continue.patch @@ -0,0 +1,8 @@ +--- a/systemd/mdcheck_continue.service-orig 2020-04-03 15:29:16.132385003 +0800 ++++ b/systemd/mdcheck_continue.service 2020-04-03 15:29:24.587371784 +0800 +@@ -13,5 +13,4 @@ + Type=oneshot + Environment="MDADM_CHECK_DURATION=6 hours" + EnvironmentFile=-/run/sysconfig/mdadm +-ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh + ExecStart=/usr/share/mdadm/mdcheck --continue --duration ${MDADM_CHECK_DURATION} diff --git a/SOURCES/mdcheck-start.patch b/SOURCES/mdcheck-start.patch new file mode 100644 index 0000000..6d04d03 --- /dev/null +++ b/SOURCES/mdcheck-start.patch @@ -0,0 +1,8 @@ +--- a/systemd/mdcheck_start.service-orig 2020-04-03 15:30:01.212314524 +0800 ++++ b/systemd/mdcheck_start.service 2020-04-03 15:30:07.881304097 +0800 +@@ -13,5 +13,4 @@ + Type=oneshot + Environment="MDADM_CHECK_DURATION=6 hours" + EnvironmentFile=-/run/sysconfig/mdadm +-ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh + ExecStart=/usr/share/mdadm/mdcheck --duration ${MDADM_CHECK_DURATION} diff --git a/SPECS/mdadm.spec b/SPECS/mdadm.spec index 8d8cbb5..3ef9175 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: 4.1 -Release: 4%{?dist} +Release: 6%{?dist} Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz Source1: mdmonitor.init Source2: raid-check @@ -11,6 +11,7 @@ Source5: mdadm-cron Source6: mdmonitor.service Source7: mdadm.conf Source8: mdadm_event.conf +Source9: mdcheck Patch1: 0001-Assemble-keep-MD_DISK_FAILFAST-and-MD_DISK_WRITEMOST.patch Patch2: 0002-Document-PART-POLICY-lines.patch @@ -61,12 +62,34 @@ Patch46: 0046-SUSE-mdadm_env.sh-handle-MDADM_CHECK_DURATION.patch Patch47: 0047-super-intel-don-t-mark-structs-packed-unnecessarily.patch Patch48: 0048-Remove-unused-code.patch Patch49: 0049-imsm-return-correct-uuid-for-volume-in-detail.patch +Patch50: 0050-imsm-Change-the-way-of-printing-nvme-drives-in-detai.patch +Patch53: 0053-Respect-CROSS_COMPILE-when-CC-is-the-default.patch +Patch54: 0054-Change-warning-message.patch +Patch55: 0055-mdcheck-service-can-t-start-succesfully-because-of-s.patch +Patch56: 0056-imsm-Update-grow-manual.patch +Patch57: 0057-Add-support-for-Tebibytes.patch +Patch58: 0058-imsm-fill-working_disks-according-to-metadata.patch +Patch59: 0059-mdadm.8-add-note-information-for-raid0-growing-opera.patch +Patch60: 0060-Remove-the-legacy-whitespace.patch +Patch61: 0061-imsm-pass-subarray-id-to-kill_subarray-function.patch +Patch62: 0062-imsm-Remove-dump-restore-implementation.patch +Patch63: 0063-imsm-Correct-minimal-device-size.patch +Patch64: 0064-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch +Patch65: 0065-imsm-support-the-Array-Creation-Time-field-in-metada.patch +Patch66: 0066-imsm-show-Subarray-and-Volume-ID-in-examine-output.patch +Patch67: 0067-udev-Ignore-change-event-for-imsm.patch +Patch68: 0068-Monitor-improve-check_one_sharer-for-checking-duplic.patch +Patch69: 0069-Detail-adding-sync-status-for-cluster-device.patch +Patch70: 0070-Manage-imsm-Write-metadata-before-add.patch +Patch71: 0071-Assemble-print-error-message-if-mdadm-fails-assembli.patch # RHEL customization patches Patch195: mdadm-3.4-udev-race.patch Patch196: mdadm-3.3.2-skip-rules.patch Patch197: mdadm-3.3-udev.patch Patch198: mdadm-2.5.2-static.patch +Patch199: mdcheck-continue.patch +Patch200: mdcheck-start.patch URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ License: GPLv2+ Group: System Environment/Base @@ -141,12 +164,34 @@ file can be used to help with some common tasks. %patch47 -p1 -b .0047 %patch48 -p1 -b .0048 %patch49 -p1 -b .0049 +%patch50 -p1 -b .0050 +%patch53 -p1 -b .0053 +%patch54 -p1 -b .0054 +%patch55 -p1 -b .0055 +%patch56 -p1 -b .0056 +%patch57 -p1 -b .0057 +%patch58 -p1 -b .0058 +%patch59 -p1 -b .0059 +%patch60 -p1 -b .0060 +%patch61 -p1 -b .0061 +%patch62 -p1 -b .0062 +%patch63 -p1 -b .0063 +%patch64 -p1 -b .0064 +%patch65 -p1 -b .0065 +%patch66 -p1 -b .0066 +%patch67 -p1 -b .0067 +%patch68 -p1 -b .0068 +%patch69 -p1 -b .0069 +%patch70 -p1 -b .0070 +%patch71 -p1 -b .0071 # RHEL customization patches %patch195 -p1 -b .race %patch196 -p1 -b .rules %patch197 -p1 -b .udev %patch198 -p1 -b .static +%patch199 -p1 -b .mdcheck-continue +%patch200 -p1 -b .mdcheck-start %build make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon @@ -159,6 +204,8 @@ install -Dp -m 644 %{SOURCE3} %{buildroot}%{_udevrulesdir}/65-md-incremental.rul install -Dp -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/raid-check install -Dp -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/cron.d/raid-check mkdir -p -m 700 %{buildroot}/var/run/mdadm +mkdir -p -m 700 %{buildroot}/usr/share/mdadm +install -Dp -m 755 %{SOURCE9} %{buildroot}/usr/share/mdadm/mdcheck # systemd mkdir -p %{buildroot}%{_unitdir} @@ -206,8 +253,17 @@ rm -rf %{buildroot} %dir %{_localstatedir}/run/%{name}/ %config(noreplace) %{_tmpfilesdir}/%{name}.conf /etc/libreport/events.d/* +/usr/share/mdadm/mdcheck %changelog +* Sat May 09 2020 Xiao Ni - 4.1.6 +- Update mdadm to latest upstream +- Resolves rhbz#1801605 + +* Fri Apr 03 2020 Xiao Ni - 4.1.5 +- mdcheck continue/start service has grammer error +- Resolves rhbz#1774354 + * Wed Feb 12 2020 Xiao Ni - 4.1.4 - Innorrect UUID reported in volume detail - Resolves rhbz#1789816