diff --git a/.gitignore b/.gitignore index 20e7ab9..3b6b56f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,6 @@ -mdadm-3.0.3.tar.bz2 -mdadm-3.1.1-gcd9a8b5.tar.bz2 -mdadm-3.1.2.tar.bz2 -mdadm-3.1.3-git07202010.tar.bz2 -mdadm-3.1.3-git20100722.tar.bz2 -mdadm-3.1.3-git20100804.tar.bz2 -mdadm-3.1.5.tar.bz2 .build* clog *.src.rpm */ -/mdadm-3.2.1.tar.bz2 -/mdadm-3.2.2.tar.bz2 -/mdadm-3.2.3.tar.bz2 -/mdadm-3.2.4.tar.xz -/mdadm-3.2.5.tar.xz -/mdadm-3.2.6.tar.xz -/mdadm-3.3.tar.xz -/mdadm-3.3.1.tar.xz -/mdadm-3.3.2.tar.xz -/mdadm-3.3.4.tar.xz -/mdadm-3.4.tar.xz -/mdadm-4.0.tar.xz +/mdadm-4.*.tar.xz +/mdadm-4.3.tar.sign diff --git a/0001-Revert-mdadm-Follow-POSIX-Portable-Character-Set.patch b/0001-Revert-mdadm-Follow-POSIX-Portable-Character-Set.patch new file mode 100644 index 0000000..e5cd419 --- /dev/null +++ b/0001-Revert-mdadm-Follow-POSIX-Portable-Character-Set.patch @@ -0,0 +1,428 @@ +From 857ad175fe025f026a1173e38de0b482110fdce5 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Sun, 6 Apr 2025 14:13:45 -0700 +Subject: [PATCH] Revert "mdadm: Follow POSIX Portable Character Set" + +This reverts commit e2eb503bd797908f515b58428b274f1ba6a05349. +--- + Detail.c | 17 +++++++----- + config.c | 13 +++------ + lib.c | 58 +++++++++++----------------------------- + mdadm.8.in | 70 ++++++++++++++++++++++++++++--------------------- + mdadm.conf.5.in | 4 +++ + mdadm.h | 2 +- + super-intel.c | 47 +++++++++++++++++---------------- + 7 files changed, 100 insertions(+), 111 deletions(-) + +diff --git a/Detail.c b/Detail.c +index aaa3dd6e..6d675152 100644 +--- a/Detail.c ++++ b/Detail.c +@@ -254,9 +254,11 @@ int Detail(char *dev, struct context *c) + fname_from_uuid(st, info, nbuf, ':'); + printf("MD_UUID=%s\n", nbuf + 5); + mp = map_by_uuid(&map, info->uuid); +- +- if (mp && mp->path && strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0) +- printf("MD_DEVNAME=%s\n", mp->path + DEV_MD_DIR_LEN); ++ if (mp && mp->path && strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0) { ++ printf("MD_DEVNAME="); ++ print_escape(mp->path + DEV_MD_DIR_LEN); ++ putchar('\n'); ++ } + + if (st->ss->export_detail_super) + st->ss->export_detail_super(st); +@@ -269,9 +271,12 @@ int Detail(char *dev, struct context *c) + __fname_from_uuid(mp->uuid, 0, nbuf, ':'); + printf("MD_UUID=%s\n", nbuf+5); + } +- if (mp && mp->path && strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0) +- printf("MD_DEVNAME=%s\n", mp->path + DEV_MD_DIR_LEN); +- ++ if (mp && mp->path && ++ strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0) { ++ printf("MD_DEVNAME="); ++ print_escape(mp->path + DEV_MD_DIR_LEN); ++ putchar('\n'); ++ } + map_free(map); + } + if (!c->no_devices && sra) { +diff --git a/config.c b/config.c +index 44f7dd2f..0a80eedb 100644 +--- a/config.c ++++ b/config.c +@@ -199,9 +199,9 @@ inline void ident_init(struct mddev_ident *ident) + * /dev/md_d{number} (legacy) + * /dev/md_{name} + * /dev/md/{name} +- * {name} ++ * {name} - anything that doesn't start from '/' or '<'. + * +- * {name} must follow name's criteria and be POSIX compatible. ++ * {name} must follow name's criteria. + * If criteria passed, duplicate memory and set devname in @ident. + * + * Return: %MDADM_STATUS_SUCCESS or %MDADM_STATUS_ERROR. +@@ -241,8 +241,8 @@ mdadm_status_t _ident_set_devname(struct mddev_ident *ident, const char *devname + else + name = devname; + +- if (is_name_posix_compatible(name) == false) { +- ident_log(prop_name, name, "Not POSIX compatible", cmdline); ++ if (*name == '/' || *name == '<') { ++ ident_log(prop_name, devname, "Cannot be started from \'/\' or \'<\'", cmdline); + return MDADM_STATUS_ERROR; + } + +@@ -284,11 +284,6 @@ static mdadm_status_t _ident_set_name(struct mddev_ident *ident, const char *nam + return MDADM_STATUS_ERROR; + } + +- if (is_name_posix_compatible(name) == false) { +- ident_log(prop_name, name, "Not POSIX compatible", cmdline); +- return MDADM_STATUS_ERROR; +- } +- + snprintf(ident->name, MD_NAME_MAX + 1, "%s", name); + return MDADM_STATUS_SUCCESS; + } +diff --git a/lib.c b/lib.c +index 2b09293c..95e3511f 100644 +--- a/lib.c ++++ b/lib.c +@@ -454,50 +454,24 @@ void print_quoted(char *str) + putchar(q); + } + +-/** +- * is_alphanum() - Check if sign is letter or digit. +- * @c: char to analyze. +- * +- * Similar to isalnum() but additional locales are excluded. +- * +- * Return: %true on success, %false otherwise. +- */ +-bool is_alphanum(const char c) +-{ +- if (isupper(c) || islower(c) || isdigit(c) != 0) +- return true; +- return false; +-} +- +-/** +- * is_name_posix_compatible() - Check if name is POSIX compatible. +- * @name: name to check. +- * +- * POSIX portable file name character set contains ASCII letters, +- * digits, '_', '.', and '-'. Also forbid leading '-'. +- * The length of the name cannot exceed NAME_MAX - 1 (ensure NULL ending). +- * +- * Return: %true on success, %false otherwise. +- */ +-bool is_name_posix_compatible(const char * const name) ++void print_escape(char *str) + { +- assert(name); +- +- char allowed_symbols[] = "-_."; +- const char *n = name; +- +- if (!is_string_lq(name, NAME_MAX)) +- return false; +- +- if (*n == '-') +- return false; +- +- while (*n != '\0') { +- if (!is_alphanum(*n) && !strchr(allowed_symbols, *n)) +- return false; +- n++; ++ /* print str, but change space and tab to '_' ++ * as is suitable for device names ++ */ ++ for (; *str; str++) { ++ switch (*str) { ++ case ' ': ++ case '\t': ++ putchar('_'); ++ break; ++ case '/': ++ putchar('-'); ++ break; ++ default: ++ putchar(*str); ++ } + } +- return true; + } + + int check_env(char *name) +diff --git a/mdadm.8.in b/mdadm.8.in +index 96a4a08e..4af90c48 100644 +--- a/mdadm.8.in ++++ b/mdadm.8.in +@@ -364,7 +364,7 @@ Use the Intel(R) Matrix Storage Manager metadata format. This creates a + which is managed in a similar manner to DDF, and is supported by an + option-rom on some platforms: + .IP +-.B https://www.intel.com/content/www/us/en/support/products/122484 ++.B https://www.intel.com/content/www/us/en/support/products/122484/memory-and-storage/ssd-software/intel-virtual-raid-on-cpu-intel-vroc.html + .PP + .RE + +@@ -932,14 +932,17 @@ option will be ignored. + .BR \-N ", " \-\-name= + Set a + .B name +-for the array. It must be +-.BR "POSIX PORTABLE NAME" +-compatible and cannot be longer than 32 chars. This is effective when creating an array +-with a v1 metadata, or an external array. +- +-If name is needed but not specified, it is taken from the basename of the device +-that is being created. See +-.BR "DEVICE NAMES" ++for the array. This is currently only effective when creating an ++array with a version-1 superblock, or an array in a DDF container. ++The name is a simple textual string that can be used to identify array ++components when assembling. If name is needed but not specified, it ++is taken from the basename of the device that is being created. ++e.g. when creating ++.I /dev/md/home ++the ++.B name ++will default to ++.IR home . + + .TP + .BR \-R ", " \-\-run +@@ -1129,10 +1132,8 @@ is much safer. + + .TP + .BR \-N ", " \-\-name= +-Specify the name of the array to assemble. It must be +-.BR "POSIX PORTABLE NAME" +-compatible and cannot be longer than 32 chars. This must be the name +-that was specified when creating the array. It must either match ++Specify the name of the array to assemble. This must be the name ++that was specified when creating the array. It must either match + the name stored in the superblock exactly, or it must match + with the current + .I homehost +@@ -2178,17 +2179,14 @@ Usage: + .I md-device + .BI \-\-chunk= X + .BI \-\-level= Y ++.br + .BI \-\-raid\-devices= Z + .I devices + + .PP +-This usage will initialize a new md array, associate some devices with ++This usage will initialise a new md array, associate some devices with + it, and activate the array. + +-.I md-device +-is a new device. This could be standard name or chosen name. For details see: +-.BR "DEVICE NAMES" +- + The named device will normally not exist when + .I "mdadm \-\-create" + is run, but will be created by +@@ -2229,6 +2227,24 @@ array. This feature can be overridden with the + .B \-\-force + option. + ++When creating an array with version-1 metadata a name for the array is ++required. ++If this is not given with the ++.B \-\-name ++option, ++.I mdadm ++will choose a name based on the last component of the name of the ++device being created. So if ++.B /dev/md3 ++is being created, then the name ++.B 3 ++will be chosen. ++If ++.B /dev/md/home ++is being created, then the name ++.B home ++will be used. ++ + When creating a partition based array, using + .I mdadm + with version-1.x metadata, the partition type should be set to +@@ -2413,10 +2429,12 @@ and + + The + .B name +-option updates the subarray name in the metadata. It must be +-.BR "POSIX PORTABLE NAME" +-compatible and cannot be longer than 32 chars. If successes, new value will be respected after +-next assembly. ++option updates the subarray name in the metadata, it may not affect the ++device node name or the device node symlink until the subarray is ++re\-assembled. If updating ++.B name ++would change the UUID of an active subarray this operation is blocked, ++and the command will end in an error. + + The + .B ppl +@@ -3377,10 +3395,6 @@ When + .B \-\-incremental + mode is used, this file gets a list of arrays currently being created. + +-.SH POSIX PORTABLE NAME +-A valid name can only consist of characters "A-Za-z0-9.-_". +-The name cannot start with a leading "-" and cannot exceed 255 chars. +- + .SH DEVICE NAMES + + .I mdadm +@@ -3402,10 +3416,6 @@ can be given, or just the suffix of the second sort of name, such as + .I home + can be given. + +-In every style, raw name must be compatible with +-.BR "POSIX PORTABLE NAME" +-and has to be no longer than 32 chars. +- + When + .I mdadm + chooses device names during auto-assembly or incremental assembly, it +diff --git a/mdadm.conf.5.in b/mdadm.conf.5.in +index 787e51e9..032b8010 100644 +--- a/mdadm.conf.5.in ++++ b/mdadm.conf.5.in +@@ -710,6 +710,10 @@ ARRAY /dev/md/home UUID=9187a482:5dde19d9:eea3cc4a:d646ab8b + .br + auto=part + .br ++# The name of this array contains a space. ++.br ++ARRAY /dev/md9 name='Data Storage' ++.sp + POLICY domain=domain1 metadata=imsm path=pci-0000:00:1f.2-scsi-* + .br + action=spare +diff --git a/mdadm.h b/mdadm.h +index 1f28b3e7..3b3168d4 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -1623,7 +1623,6 @@ extern int check_raid(int fd, char *name); + extern int check_partitions(int fd, char *dname, + unsigned long long freesize, + unsigned long long size); +-extern bool is_name_posix_compatible(const char *path); + extern int fstat_is_blkdev(int fd, char *devname, dev_t *rdev); + extern int stat_is_blkdev(char *devname, dev_t *rdev); + +@@ -1664,6 +1663,7 @@ extern int conf_get_monitor_delay(void); + extern char *conf_line(FILE *file); + extern char *conf_word(FILE *file, int allow_key); + extern void print_quoted(char *str); ++extern void print_escape(char *str); + extern int use_udev(void); + extern void print_escape(char *str); + extern unsigned long GCD(unsigned long a, unsigned long b); +diff --git a/super-intel.c b/super-intel.c +index dbea235d..33f1469f 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -5533,37 +5533,40 @@ static void imsm_update_version_info(struct intel_super *super) + } + } + +-/** +- * imsm_check_name() - check imsm naming criteria. +- * @super: &intel_super pointer, not NULL. +- * @name: name to check. +- * @verbose: verbose level. +- * +- * Name must be no longer than &MAX_RAID_SERIAL_LEN and must be unique across volumes. +- * +- * Returns: &true if @name matches, &false otherwise. +- */ +-static bool imsm_is_name_allowed(struct intel_super *super, const char * const name, +- const int verbose) ++static int check_name(struct intel_super *super, char *name, int quiet) + { + struct imsm_super *mpb = super->anchor; ++ char *reason = NULL; ++ char *start = name; ++ size_t len = strlen(name); + int i; + +- if (is_string_lq(name, MAX_RAID_SERIAL_LEN + 1) == false) { +- pr_vrb("imsm: Name \"%s\" is too long\n", name); +- return false; ++ if (len > 0) { ++ while (isspace(start[len - 1])) ++ start[--len] = 0; ++ while (*start && isspace(*start)) ++ ++start, --len; ++ memmove(name, start, len + 1); + } + ++ if (len > MAX_RAID_SERIAL_LEN) ++ reason = "must be 16 characters or less"; ++ else if (len == 0) ++ reason = "must be a non-empty string"; ++ + for (i = 0; i < mpb->num_raid_devs; i++) { + struct imsm_dev *dev = get_imsm_dev(super, i); + + if (strncmp((char *) dev->volume, name, MAX_RAID_SERIAL_LEN) == 0) { +- pr_vrb("imsm: Name \"%s\" already exists\n", name); +- return false; ++ reason = "already exists"; ++ break; + } + } + +- return true; ++ if (reason && !quiet) ++ pr_err("imsm volume name %s\n", reason); ++ ++ return !reason; + } + + static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info, +@@ -5658,9 +5661,8 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info, + } + } + +- if (imsm_is_name_allowed(super, name, 1) == false) ++ if (!check_name(super, name, 0)) + return 0; +- + dv = xmalloc(sizeof(*dv)); + dev = xcalloc(1, sizeof(*dev) + sizeof(__u32) * (info->raid_disks - 1)); + /* +@@ -7988,7 +7990,7 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, + char *ep; + int vol; + +- if (imsm_is_name_allowed(super, name, 1) == false) ++ if (!check_name(super, name, 0)) + return 2; + + vol = strtoul(subarray, &ep, 10); +@@ -10298,8 +10300,7 @@ static void imsm_process_update(struct supertype *st, + if (a->info.container_member == target) + break; + dev = get_imsm_dev(super, u->dev_idx); +- +- if (a || !dev || imsm_is_name_allowed(super, name, 0) == false) { ++ if (a || !check_name(super, name, 1)) { + dprintf("failed to rename subarray-%d\n", target); + break; + } +-- +2.49.0 + diff --git a/0002-dont-stop-in-assemble.patch b/0002-dont-stop-in-assemble.patch new file mode 100644 index 0000000..6eaf564 --- /dev/null +++ b/0002-dont-stop-in-assemble.patch @@ -0,0 +1,11 @@ +--- a/Assemble.c~ 2025-08-13 22:05:00.416132027 -0400 ++++ b/Assemble.c 2025-08-13 22:13:16.650837070 -0400 +@@ -1597,8 +1597,6 @@ + goto try_again; + goto out; + } +- /* just incase it was started but has no content */ +- ioctl(mdfd, STOP_ARRAY, NULL); + } + + if (content != &info) { diff --git a/6F9E3E9D4EDEBB11.asc b/6F9E3E9D4EDEBB11.asc new file mode 100644 index 0000000..7f7afe8 --- /dev/null +++ b/6F9E3E9D4EDEBB11.asc @@ -0,0 +1,72 @@ +pub rsa2048 2023-11-03 [SC] + EED84966493AEEAF4B466F696F9E3E9D4EDEBB11 +uid Mariusz Tkaczyk (First Key) +sub rsa2048 2023-11-03 [E] + F07BC7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KN8of2B/QmfWegZLC +qO+YsDSG0GcAv8u+ZMls6EdIhO+STJAMZpbM7Gx0XuJ08IhN+OglVp6WJ3vfCX4B +O9P2KYQE/8TF386HaNMq1CranRihHGaz1YOOV0Skxe2stP5UsbgzBGVE72IWCSsG +AQQB2kcPAQEHQKRrcOlY4p7NVvwJD+vnKwUtvmSAKuK1UrsXcBrBKDaWiQGtBBgB +CAAgFiEE7thJZkk67q9LRm9pb54+nU7euxEFAmVE72ICGwIAgQkQb54+nU7euxF2 +IAQZFggAHRYhBKIyC4L51R47sOKzsgHIuyNX0V4kBQJlRO9iAAoJEAHIuyNX0V4k +f7kBAKzN7tapBxMbORYyONkYv7hSbu08b3DEDZxJgV27dUSkAP49HZEfFwFR7IGL +Rmvpq3F+RBALah9F0YuTTU4Ixz1qBUvPCACFwmg8zxoqd2nf2t05vjtdeFbahRqu +3Gu5b5QqzCRB4zGBNVSX110SvDOtCJ0xNUAHU0Gh0o2meCREc9xg/qCujs7CKD5u +OzukbPpIZ++cXg5gPJ7+H1L20VrbFjiz/wdzV0iNBPfQ7mP+CeqjmpNyZKUqGF1t +xTHbJ99Ls2/hS1o1P1aktfOj2WBTND3Xx2oysczhqyGpaciDR30A2SEhcutjcPUl +mUPaTp7+nP/5+v8u2drlkyhzxCyQbcIwNQEaIWxQq5pKrq8HpQ8u/SUW6ERKZISV +Y6o0MdrugFPqAmerHvL2hCrMelqHCCVInJIXBL0SSCgHZyh9NTuo2OUQ +=PmkW +-----END PGP PUBLIC KEY BLOCK----- diff --git a/add-Wimplicit-fallthrough-0-in-Makefile.patch b/add-Wimplicit-fallthrough-0-in-Makefile.patch deleted file mode 100644 index efa5efe..0000000 --- a/add-Wimplicit-fallthrough-0-in-Makefile.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 8268821b434d1308d083454fb681d80176cf352b Mon Sep 17 00:00:00 2001 -From: Xiao Ni -Date: Fri, 17 Mar 2017 19:55:42 +0800 -Subject: [RHEL6.9 PATCH 1/2] mdadm: Add Wimplicit-fallthrough=0 in Makefile - -There are many errors like 'error: this statement may fall through'. -But the logic is right. So add the flag Wimplicit-fallthrough=0 -to disable the error messages. The method I use is from -https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html -#index-Wimplicit-fallthrough-375 - -Signed-off-by: Xiao Ni -Signed-off-by: Jes Sorensen ---- - Makefile | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/Makefile b/Makefile -index a6f464c..d1a6ac4 100644 ---- a/Makefile -+++ b/Makefile -@@ -48,6 +48,11 @@ ifdef WARN_UNUSED - CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3 - endif - -+FALLTHROUGH := $(shell gcc -v --help 2>&1 | grep "implicit-fallthrough" | wc -l) -+ifneq "$(FALLTHROUGH)" "0" -+CWFLAGS += -Wimplicit-fallthrough=0 -+endif -+ - ifdef DEBIAN - CPPFLAGS += -DDEBIAN - endif --- -2.7.4 - diff --git a/forced-type-conversion-to-avoid-truncation.patch b/forced-type-conversion-to-avoid-truncation.patch deleted file mode 100644 index 2a978a6..0000000 --- a/forced-type-conversion-to-avoid-truncation.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 5b97512954e9710fd45ab5778bf679205c35892d Mon Sep 17 00:00:00 2001 -From: Xiao Ni -Date: Sat, 18 Mar 2017 10:33:45 +0800 -Subject: [RHEL6.9 PATCH 2/2] mdadm: Forced type conversion to avoid truncation - -Gcc reports it needs 19 bytes to right to disk->serial. Because the -type of argument i is int. But the meaning of i is failed disk -number. So it doesn't need to use 19 bytes. Just add a type -conversion to avoid this building error - -Signed-off-by: Xiao Ni -Signed-off-by: Jes Sorensen ---- - super-intel.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/super-intel.c b/super-intel.c -index 343f20d..e1618f1 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -5228,7 +5228,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info, - disk->status = CONFIGURED_DISK | FAILED_DISK; - disk->scsi_id = __cpu_to_le32(~(__u32)0); - snprintf((char *) disk->serial, MAX_RAID_SERIAL_LEN, -- "missing:%d", i); -+ "missing:%d", (__u8)i); - } - find_missing(super); - } else { --- -2.7.4 - diff --git a/mdadm-2.5.2-static.patch b/mdadm-2.5.2-static.patch index 1eb335a..188b478 100644 --- a/mdadm-2.5.2-static.patch +++ b/mdadm-2.5.2-static.patch @@ -1,7 +1,7 @@ ---- mdadm-3.2.1/Makefile.static 2011-03-27 22:31:20.000000000 -0400 -+++ mdadm-3.2.1/Makefile 2011-03-28 10:16:55.277900184 -0400 -@@ -238,16 +238,16 @@ install : mdadm mdmon install-man instal - $(INSTALL) -D $(STRIP) -m 755 mdmon $(DESTDIR)$(BINDIR)/mdmon +--- mdadm-3.2.1/Makefile.static 2021-01-11 15:46:47.292126848 +0800 ++++ mdadm-3.2.1/Makefile 2021-01-11 15:46:10.720192519 +0800 +@@ -248,16 +248,16 @@ + install : install-bin install-man install-udev install-static : mdadm.static install-man - $(INSTALL) -D $(STRIP) -m 755 mdadm.static $(DESTDIR)$(BINDIR)/mdadm diff --git a/mdadm-3.3-udev.patch b/mdadm-3.3-udev.patch index 1dfac7b..3e22ad1 100644 --- a/mdadm-3.3-udev.patch +++ b/mdadm-3.3-udev.patch @@ -1,5 +1,5 @@ ---- mdadm-3.3.1/udev-md-raid-assembly.rules~ 2014-06-10 13:29:41.192829830 +0200 -+++ mdadm-3.3.1/udev-md-raid-assembly.rules 2014-06-10 13:30:20.838613208 +0200 +--- mdadm/udev-md-raid-assembly.rules~ 2018-07-09 18:24:27.450774446 +0800 ++++ mdadm/udev-md-raid-assembly.rules 2018-07-09 18:25:12.630735637 +0800 @@ -5,6 +5,10 @@ ENV{ANACONDA}=="?*", GOTO="md_inc_end" # assemble md arrays @@ -10,4 +10,4 @@ + SUBSYSTEM!="block", GOTO="md_inc_end" - # handle potential components of arrays (the ones supported by md) + # skip non-initialized devices diff --git a/mdadm-4.1-no-Werror.patch b/mdadm-4.1-no-Werror.patch new file mode 100644 index 0000000..2cdac7c --- /dev/null +++ b/mdadm-4.1-no-Werror.patch @@ -0,0 +1,26 @@ +From: martin f. krafft +Subject: Remove -Werror from compiler flags + +-Werror seems like a bad idea on released/packaged code because a toolchain +update (introducing new warnings) could break the build. We'll let upstream +use it to beautify the code, but remove it for out builds. + +Signed-off-by: martin f. krafft + +--- + Makefile | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +Index: mdadm-4.1/Makefile +=================================================================== +--- mdadm-4.1.orig/Makefile ++++ mdadm-4.1/Makefile +@@ -48,7 +48,7 @@ endif + + CC ?= $(CROSS_COMPILE)gcc + CXFLAGS ?= -ggdb +-CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter ++CWFLAGS = -Wall -Wstrict-prototypes -Wextra -Wno-unused-parameter + ifdef WARN_UNUSED + CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3 + endif diff --git a/mdadm-cron b/mdadm-cron deleted file mode 100644 index 4e05d68..0000000 --- a/mdadm-cron +++ /dev/null @@ -1,3 +0,0 @@ -# Run system wide raid-check once a week on Sunday at 1am by default -0 1 * * Sun root /usr/sbin/raid-check - diff --git a/mdadm-udev.patch b/mdadm-udev.patch new file mode 100644 index 0000000..a9d4d93 --- /dev/null +++ b/mdadm-udev.patch @@ -0,0 +1,26 @@ +--- mdadm/udev-md-raid-assembly.rules.orig 2023-01-06 16:37:03.780756100 +0800 ++++ mdadm/udev-md-raid-assembly.rules 2023-01-06 17:04:09.536159980 +0800 +@@ -5,6 +5,9 @@ + ENV{ANACONDA}=="?*", GOTO="md_inc_end" + # assemble md arrays + ++# Also don't process disks that are slated to be a multipath device ++ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_inc_end" ++ + SUBSYSTEM!="block", GOTO="md_inc_end" + + # skip non-initialized devices +@@ -33,6 +36,13 @@ + + LABEL="md_inc" + ++# Make sure we don't handle dm devices when some limits are set. ++# And linux_raid_member only be set when change/remove event happen. ++# So we don't need to consider add event here. ++KERNEL=="dm-*", ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="md_inc_end" ++KERNEL=="dm-*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="md_inc_end" ++KERNEL=="dm-*", ENV{DM_SUSPENDED}=="1", GOTO="md_inc_end" ++ + # Bare disks are ready when add event happens, the raid can be assembled. + ACTION=="change", KERNEL!="dm-*|md*", GOTO="md_inc_end" + diff --git a/mdadm.conf b/mdadm.conf index 6200117..3207dda 100644 --- a/mdadm.conf +++ b/mdadm.conf @@ -1 +1 @@ -d /var/run/mdadm 0710 root root - +d /run/mdadm 0710 root root - diff --git a/mdadm.rules b/mdadm.rules deleted file mode 100644 index 8fcaf27..0000000 --- a/mdadm.rules +++ /dev/null @@ -1,67 +0,0 @@ -# This file causes block devices with Linux RAID (mdadm) signatures to -# automatically cause mdadm to be run. -# See udev(8) for syntax - -# Don't process any events if anaconda is running as anaconda brings up -# raid devices manually -ENV{ANACONDA}=="?*", GOTO="md_end" - -# Also don't process disks that are slated to be a multipath device -ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end" - -# We process add events on block devices (since they are ready as soon as -# they are added to the system), but we must process change events as well -# on any dm devices (like LUKS partitions or LVM logical volumes) and on -# md devices because both of these first get added, then get brought live -# and trigger a change event. The reason we don't process change events -# on bare hard disks is because if you stop all arrays on a disk, then -# run fdisk on the disk to change the partitions, when fdisk exits it -# triggers a change event, and we want to wait until all the fdisks on -# all member disks are done before we do anything. Unfortunately, we have -# no way of knowing that, so we just have to let those arrays be brought -# up manually after fdisk has been run on all of the disks. - -# First, process all add events (md and dm devices will not really do -# 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", \ - 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" -SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \ - ENV{ID_FS_TYPE}=="linux_raid_member", \ - RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}" -SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \ - ENV{ID_FS_TYPE}=="linux_raid_member", \ - RUN+="/sbin/mdadm -If $name" - -# Next, check to make sure the BIOS raid stuff wasn't turned off via cmdline -IMPORT{cmdline}="noiswmd" -IMPORT{cmdline}="nodmraid" -ENV{noiswmd}=="?*", GOTO="md_imsm_inc_end" -ENV{nodmraid}=="?*", GOTO="md_imsm_inc_end" -SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="isw_raid_member", \ - RUN+="/sbin/mdadm -I $env{DEVNAME}" -SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \ - ENV{ID_FS_TYPE}=="isw_raid_member", \ - RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}" -SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \ - ENV{ID_FS_TYPE}=="isw_raid_member", \ - RUN+="/sbin/mdadm -If $name" -LABEL="md_imsm_inc_end" - -# Next make sure that this isn't a dm device we should skip for some reason -ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_change_end" -ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_change_end" -ENV{DM_SUSPENDED}=="1", GOTO="dm_change_end" -KERNEL=="dm-*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \ - ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}" -LABEL="dm_change_end" - -# Finally catch any nested md raid arrays. If we brought up an md raid -# array that's part of another md raid array, it won't be ready to be used -# until the change event that occurs when it becomes live -KERNEL=="md*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \ - ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}" - -LABEL="md_end" diff --git a/mdadm.spec b/mdadm.spec index 263d0e1..c04bb8c 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,120 +1,290 @@ -Summary: The mdadm program controls Linux md devices (software RAID arrays) +%bcond abrt %{undefined rhel} + Name: mdadm -Version: 4.0 -Release: 3%{?dist} -Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz -Source1: mdmonitor.init -Source2: raid-check -Source3: mdadm.rules -Source4: mdadm-raid-check-sysconfig -Source5: mdadm-cron -Source6: mdmonitor.service -Source7: mdadm.conf -Source8: mdadm_event.conf +Version: 4.3 +Release: 9%{?dist} +Summary: The mdadm program controls Linux md devices (software RAID arrays) +URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ +License: GPL-2.0-or-later + +Source: https://www.kernel.org/pub/linux/utils/raid/mdadm/%{name}-%{version}.tar.xz +Source1: raid-check +Source2: mdadm-raid-check-sysconfig +Source3: mdmonitor.service +Source4: mdadm.conf +Source5: mdadm_event.conf +Source6: raid-check.timer +Source7: raid-check.service +Source8: mdcheck +Source10: https://www.kernel.org/pub/linux/utils/raid/mdadm/%{name}-%{version}.tar.sign +Source11: https://git.kernel.org/pub/scm/docs/kernel/pgpkeys.git/plain/keys/6F9E3E9D4EDEBB11.asc + +# https://bugzilla.redhat.com/show_bug.cgi?id=2325906 +# see: https://github.com/md-raid-utilities/mdadm/pull/165 +# https://github.com/md-raid-utilities/mdadm/pull/160 +# https://github.com/md-raid-utilities/mdadm/pull/159 +# this is a reversion of the initial 'posix check' patch +# that causes all the trouble +Patch: 0001-Revert-mdadm-Follow-POSIX-Portable-Character-Set.patch +Patch: 0002-dont-stop-in-assemble.patch # Fedora customization patches -Patch93: add-Wimplicit-fallthrough-0-in-Makefile.patch -Patch94: forced-type-conversion-to-avoid-truncation.patch -Patch95: replace-snprintf-with-strncpy-at-some-places-to-avoi.patch -Patch96: specify-enough-length-when-write-to-buffer.patch -Patch97: mdadm-3.3-udev.patch -Patch98: mdadm-2.5.2-static.patch -URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ -License: GPLv2+ -Group: System Environment/Base -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Obsoletes: mdctl,raidtools -Obsoletes: mdadm-sysvinit -Conflicts: dracut < 034-1 -Requires(post): systemd-units chkconfig coreutils -BuildRequires: systemd-units binutils-devel -Requires(preun): systemd-units -Requires(postun): systemd-units coreutils -Requires: libreport-filesystem +Patch: mdadm-udev.patch +Patch: mdadm-2.5.2-static.patch -%define _hardened_build 1 +BuildRequires: make +BuildRequires: systemd-rpm-macros +BuildRequires: binutils-devel +BuildRequires: gcc +BuildRequires: systemd-devel +BuildRequires: gnupg2 +BuildRequires: mandoc +%if %{with abrt} +Requires: libreport-filesystem +%endif +Requires(post): coreutils +Requires(postun): coreutils -%description + +%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 package. However, mdadm is a single program, and it can perform almost all functions without a configuration file, though a configuration file can be used to help with some common tasks. -%prep -%setup -q -# Fedora customization patches -%patch93 -p1 -b .fallthrough -%patch94 -p1 -b .forced -%patch95 -p1 -b .replace -%patch96 -p1 -b .buffer -%patch97 -p1 -b .udev -%patch98 -p1 -b .static +%prep +# because the tarball is what is signed, not the compressed tarball +# keyring should be one from https://git.kernel.org/pub/scm/docs/kernel/pgpkeys.git/plain/keys +# which will vary depending on who did the release +%{_bindir}/xz -dcT0 %{SOURCE0} | %{gpgverify} --keyring='%{SOURCE11}' --signature='%{SOURCE10}' --data=- +%autosetup -p1 + %build -make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon +# CXFLAGS is NOT a typo, it's baked into the makefile, not to be confused with CXXFLAGS +%make_build CXFLAGS="%{optflags} -std=gnu17 -Wno-error=unterminated-string-initialization" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon raid6check raid6check.man + %install -rm -rf %{buildroot} -make DESTDIR=%{buildroot} MANDIR=%{_mandir} BINDIR=%{_sbindir} SYSTEMD_DIR=%{_unitdir} install install-systemd -install -Dp -m 755 %{SOURCE2} %{buildroot}%{_sbindir}/raid-check -install -Dp -m 644 %{SOURCE3} %{buildroot}%{_udevrulesdir}/65-md-incremental.rules -install -Dp -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/raid-check -install -Dp -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/cron.d/raid-check -mkdir -p -m 710 %{buildroot}/var/run/mdadm +%make_install MANDIR=%{_mandir} BINDIR=%{_sbindir} SYSTEMD_DIR=%{_unitdir} UDEVDIR=%{_prefix}/lib/udev/ install install-systemd +install -Dp -m 755 %{SOURCE1} %{buildroot}%{_sbindir}/raid-check +install -Dp -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/raid-check +mkdir -p -m 710 %{buildroot}/run/%{name} +mkdir -p -m 755 %{buildroot}%{_datadir}/%{name} +install -Dp -m 755 %{SOURCE8} %{buildroot}%{_datadir}/%{name}/mdcheck # systemd -mkdir -p %{buildroot}%{_unitdir} -install -m644 %{SOURCE6} %{buildroot}%{_unitdir} +install -Dm644 %{SOURCE3} %{buildroot}%{_unitdir} +install -Dm644 %{SOURCE6} %{buildroot}%{_unitdir} +install -Dm644 %{SOURCE7} %{buildroot}%{_unitdir} # tmpfile -mkdir -p %{buildroot}%{_tmpfilesdir} -install -m 0644 %{SOURCE7} %{buildroot}%{_tmpfilesdir}/%{name}.conf +install -Dm 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf mkdir -p %{buildroot}%{_localstatedir}/run/ -install -d -m 0710 %{buildroot}%{_localstatedir}/run/%{name}/ +install -d -m 0710 %{buildroot}/run/%{name}/ # abrt -mkdir -p %{buildroot}/etc/libreport/events.d -install -m644 %{SOURCE8} %{buildroot}/etc/libreport/events.d +%if %{with abrt} +install -Dm644 %{SOURCE5} %{buildroot}%{_sysconfdir}/libreport/events.d/%{name}_event.conf +%endif -%clean -rm -rf %{buildroot} +# raid6check +install -Dm755 raid6check %{buildroot}/%{_sbindir}/raid6check +install -Dm644 raid6check.man %{buildroot}/%{_mandir}/man8/raid6check.man %post -%systemd_post mdmonitor.service -/usr/bin/systemctl disable mdmonitor-takeover.service >/dev/null 2>&1 || : +%systemd_post mdmonitor.service raid-check.timer +# leftover from this service removal years ago (f18 era). +# we probably don't really need this anymore. +# https://bugzilla.redhat.com/show_bug.cgi?id=901651 +%{_bindir}/systemctl disable mdmonitor-takeover.service >/dev/null 2>&1 || : + %preun -%systemd_preun mdmonitor.service +%systemd_preun mdmonitor.service raid-check.timer + %postun %systemd_postun_with_restart mdmonitor.service -%triggerun -- %{name} < 3.2.2-3 -%{_bindir}/systemd-sysv-convert --save mdmonitor >/dev/null 2>&1 || : -/bin/systemctl --no-reload enable mdmonitor.service >/dev/null 2>&1 || : -/sbin/chkconfig --del mdmonitor >/dev/null 2>&1 || : -/bin/systemctl try-restart mdmonitor.service >/dev/null 2>&1 || : %files -%defattr(-,root,root,-) -%doc TODO ChangeLog mdadm.conf-example COPYING misc/* -%{_udevrulesdir}/* -%{_sbindir}/* -%{_unitdir}/* +%license COPYING +%doc mdadm.conf-example misc/* +%{_udevrulesdir}/*-md-* +%{_sbindir}/%{name} +%{_sbindir}/mdmon +%{_sbindir}/raid-check +%{_sbindir}/raid6check +%{_unitdir}/md* +%{_unitdir}/raid-check.* %{_mandir}/man*/md* -/usr/lib/systemd/system-shutdown/* -%config(noreplace) %{_sysconfdir}/cron.d/* -%config(noreplace) %{_sysconfdir}/sysconfig/* -%dir %{_localstatedir}/run/%{name}/ +%{_mandir}/man8/raid6check* +%{_prefix}/lib/systemd/system-shutdown/mdadm.shutdown +%config(noreplace) %{_sysconfdir}/sysconfig/raid-check +%{_rundir}/%{name}/ %config(noreplace) %{_tmpfilesdir}/%{name}.conf -/etc/libreport/events.d/* +%if %{with abrt} +%{_sysconfdir}/libreport/events.d/mdadm_event.conf +%endif +%{_datadir}/%{name}/ + %changelog -* Mon Apr 24 2017 Xiao Ni - 4.0-3 -- Fix building errors agains newer gcc(>=7.0) -- Resolves bz1423932 +* Thu Aug 14 2025 Xiao Ni - 4.3-9 +- Don't submit stop ioctl in assemble +- Resolves bz#2388480 + +* Thu Jul 24 2025 Fedora Release Engineering - 4.3-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Sun Apr 06 2025 Adam Williamson - 4.3-7 +- revert 'posix' name check to fix rhbz#2325906 + +* Thu Jan 23 2025 Jonathan Wright - 4.3-6 +- fix FTBFS on gcc15 rhbz#2340833 +- fix permissions on /usr/share/mdadm to be world-readable rhbz#2322402 + +* Fri Jan 17 2025 Fedora Release Engineering - 4.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Thu Jul 18 2024 Fedora Release Engineering - 4.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Wed May 08 2024 Jonathan Wright - 4.3-3 +- use URLs for signature and pub key +- build and install raid6check and man page rhbz#2264741 + +* Wed May 08 2024 Jonathan Wright - 4.3-2 +- add source signature verification +- change source URL to https + +* Wed May 08 2024 Jonathan Wright - 4.3-1 +- update to 4.3 rhbz#2267100 +- modernize spec + +* Wed May 08 2024 Jonathan Wright - 4.2-9 +- Fixes rhbz#2279743 +- Use more macros in %files definitions + +* Thu Jan 25 2024 Fedora Release Engineering - 4.2-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 4.2-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Thu Jul 20 2023 Fedora Release Engineering - 4.2-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Apr 12 2023 Xiao Ni - 4.2-5 +- Update to latest upstream for rawhide(f39) and fix mdcheck service bug +- Resolves bz#2175540 + +* Mon Jan 30 2023 Xiao Ni - 4.2-4 +- Update to latest upstream for f38 +- Resolves bz#2163711 + +* Thu Jan 19 2023 Fedora Release Engineering - 4.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jul 21 2022 Fedora Release Engineering - 4.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Mar 21 2022 Xiao Ni - 4.2-1 +- Update to mdadm-4.2 +- Resolves bz#2066150 + +* Thu Jan 20 2022 Fedora Release Engineering - 4.2-rc2.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Mon Aug 09 2021 Xiao Ni - 4.2-rc2 +- Update to mdadm-4.2-rc2 +- Resolves bz#1988236 + +* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 4.1-8 +- Rebuilt for updated systemd-rpm-macros + See https://pagure.io/fesco/issue/2583. + +* Tue Jan 26 2021 Fedora Release Engineering - 4.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 4.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed May 27 2020 Xiao Ni - 4.1-5 +- Don't enable raid-check.service to avoid raid check after every boot +- Resolves bz1838409 + +* Sun Mar 08 2020 Peter Robinson - 4.1-4 +- Fix install location of udev rules (rhbz 1809117) + +* Fri Feb 07 2020 Alejandro Domínguez Muñoz - 4.1-3 +- Replace raid-check cron job with systemd timer + +* Wed Jan 29 2020 Fedora Release Engineering - 4.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Mon Jan 13 2020 Peter Robinson 4.1-1 +- Update to 4.1 GA +- Spec cleanups and updates +- Update mdadm.pid location (rhbz 1701114, rhbz 1557623, rhbz 1557623) + +* Sun Dec 15 2019 Julian Sikorski - 4.1-rc2.0.5.2 +- Fix invalid substitution type error +- Resolves bz1740662, bz1749859 + +* Thu Jul 25 2019 Fedora Release Engineering - 4.1-rc2.0.5.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue Jun 04 2019 Xiao Ni - 4.1-rc2.0.5 +- Update tmpfiles directory to non-legacy location +- Resolves bz1704517 + +* Wed Apr 17 2019 Xiao Ni - 4.1-rc2.0.4 +- Change tmpfiles directory to /run/mdadm +- Resovles bz1701821 + +* Sat Mar 16 2019 Björn Esser - 4.1-rc2.0.3 +- Add patch to build without -Werror, fixes FTBFS (#1675363) + +* Fri Feb 01 2019 Fedora Release Engineering - 4.1-rc2.0.2.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Sep 13 2018 Adam Williamson - 4.1-rc2.0.2 +- Fix multipath check in udev rule, broke array init in F29 +- Resolves bz1628192 + +* Sun Aug 26 2018 Peter Robinson 4.1-rc2.0.1 +- Update to 4.1 rc2 + +* Fri Jul 20 2018 Xiao Ni - 4.1-rc1_1.2 +- Add gcc into BuildRequires +- Resolves bz1604811 + +* Fri Jul 13 2018 Fedora Release Engineering - 4.1-rc1_1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Jul 09 2018 Xiao Ni 4.1-rc1-1 +- Update to latest upstream version 4.1-rc1 +- Resolves bz1556591 + +* Wed Jul 4 2018 Peter Robinson 4.0-7 +- Cleanup spec, use %%licenece, drop old sys-v migration bits + +* Thu Feb 08 2018 Fedora Release Engineering - 4.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 03 2017 Fedora Release Engineering - 4.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 4.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Wed Apr 26 2017 Xiao Ni - 4.0-3 +- Fix building errors against newer gcc (>=7.0) +- Resolves bz1444756 * Fri Feb 10 2017 Fedora Release Engineering - 4.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild diff --git a/mdcheck b/mdcheck new file mode 100644 index 0000000..700c3e2 --- /dev/null +++ b/mdcheck @@ -0,0 +1,166 @@ +#!/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 + eval dev=\$MD_${i}_dev + + if [ -z "$fl" ]; then continue; fi + + if [ "`cat $sys/md/sync_action`" != 'check' ] + then + logger -p daemon.info mdcheck finished checking $dev + 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/mdmonitor.init b/mdmonitor.init deleted file mode 100755 index 03f3e95..0000000 --- a/mdmonitor.init +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash -# -# mdmonitor This starts, stops, and reloads the mdadm-based -# software RAID monitoring and management facility -# -# chkconfig: 2345 15 85 -# description: software RAID monitoring and management -# config: /etc/mdadm.conf -# -# Copyright 2002 Red Hat, Inc. -# -### BEGIN INIT INFO -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start and stop the MD software RAID monitor -# Description: The mdmonitor service checks the status of all software -# RAID arrays on the system. In the event that any of the arrays -# transition into a degraded state, it notifies the system -# administrator. Other options are available, see the mdadm.conf -# and mdadm man pages for possible ways to configure this service. -### END INIT INFO - -PIDPATH=/var/run/mdadm -PIDFILE=/var/run/mdadm/mdadm.pid -PATH=/sbin:/usr/sbin:$PATH -RETVAL=0 -OPTIONS="--monitor --scan -f --pid-file=$PIDFILE" - -prog=mdmonitor - -# Source function library. -. /etc/rc.d/init.d/functions - - -usage () -{ - echo "Usage: service $prog {start|stop|status|restart|try-restart|force-reload}" - RETVAL=1 -} - - -start () -{ -# (Re)start mdmon to take over monitoring of mdmon started from the initrd - for i in /dev/md/*.pid; do - if [ -r $i ]; then - origprog="$prog"; prog="mdmon" - action $"Starting $prog: " /sbin/mdmon --takeover --all - prog="$origprog" - break - fi - done -# Make sure configuration file exists and has information we can use -# MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor - [ -f /etc/mdadm.conf ] || return 6 - grep '^\(MAILADDR\|PROGRAM\) .' /etc/mdadm.conf >/dev/null 2>&1 || return 6 - # Create our directory if it isn't there yet - if [ ! -d $PIDPATH ]; then - mkdir -m 0700 $PIDPATH >&/dev/null - RC=$? - [ -x /sbin/restorecon ] && /sbin/restorecon $PIDPATH - if [ $RC -ne 0 ]; then - echo -n "Failed to create /var/run/mdadm" - failure - echo - return 1 - fi - fi - if [ -f "$PIDFILE" ]; then - checkpid `cat $PIDFILE` && return 0 - fi - echo -n $"Starting $prog: " - cd / - daemon --user=root mdadm ${OPTIONS} - ret=$? - [ $ret -eq "0" ] && touch /var/lock/subsys/$prog - echo - return $ret -} - -stop () -{ - [ -f /var/lock/subsys/$prog ] || return 0 - echo -n "Killing $prog: " - killproc mdadm - echo - rm -f $PIDFILE - rm -f /var/lock/subsys/$prog -} - -restart () -{ - stop - start -} - -condrestart () -{ - [ -e /var/lock/subsys/$prog ] && restart || return 0 -} - - -case "$1" in - start|stop|restart|condrestart|try-restart|force-reload) - [ `id -u` != "0" ] && exit 4 ;; -esac - -case "$1" in - start) start; RETVAL=$? ;; - stop) stop; RETVAL=$? ;; - status) status -p $PIDFILE $prog ; RETVAL=$? ;; - restart) restart; RETVAL=$? ;; - reload) RETVAL=3 ;; - condrestart|try-restart|force-reload) condrestart; RETVAL=$? ;; - *) usage ; RETVAL=2 ;; -esac - -exit $RETVAL diff --git a/mdmonitor.service b/mdmonitor.service index 123ae8a..a2f53d9 100644 --- a/mdmonitor.service +++ b/mdmonitor.service @@ -4,9 +4,9 @@ ConditionPathExists=/etc/mdadm.conf [Service] Type=forking -PIDFile=/var/run/mdadm/mdadm.pid +PIDFile=/run/mdadm/mdadm.pid EnvironmentFile=-/etc/sysconfig/mdmonitor -ExecStart=/sbin/mdadm --monitor --scan -f --pid-file=/var/run/mdadm/mdadm.pid +ExecStart=/sbin/mdadm --monitor --scan --syslog -f --pid-file=/run/mdadm/mdadm.pid [Install] WantedBy=multi-user.target diff --git a/raid-check.service b/raid-check.service new file mode 100644 index 0000000..f8ed5ac --- /dev/null +++ b/raid-check.service @@ -0,0 +1,6 @@ +[Unit] +Description=RAID setup health check + +[Service] +Type=oneshot +ExecStart=/usr/sbin/raid-check diff --git a/raid-check.timer b/raid-check.timer new file mode 100644 index 0000000..c33bc24 --- /dev/null +++ b/raid-check.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Weekly RAID setup health check + +[Timer] +OnCalendar=Sun *-*-* 01:00:00 +Persistent=true +AccuracySec=24h + +[Install] +WantedBy=timers.target diff --git a/replace-snprintf-with-strncpy-at-some-places-to-avoi.patch b/replace-snprintf-with-strncpy-at-some-places-to-avoi.patch deleted file mode 100644 index ee5f11a..0000000 --- a/replace-snprintf-with-strncpy-at-some-places-to-avoi.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 618f4e6d63c8c09d8d4002770e44617f3477f137 Mon Sep 17 00:00:00 2001 -From: Xiao Ni -Date: Sat, 18 Mar 2017 10:33:44 +0800 -Subject: [RHEL6.9 PATCH 1/2] Replace snprintf with strncpy at some places to - avoid truncation - -In gcc7 there are some building errors like: -directive output may be truncated writing up to 31 bytes into a region of size 24 -snprintf(str, MPB_SIG_LEN, %s, mpb->sig); - -It just need to copy one string to target. So use strncpy to replace it. - -For this line code: snprintf(str, MPB_SIG_LEN, %s, mpb->sig); -Because mpb->sig has the content of version after magic, so -it's better to use strncpy to replace snprintf too. - -Signed-off-by: Xiao Ni -Signed-off-by: Jes Sorensen ---- - super-intel.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/super-intel.c b/super-intel.c -index d5e9517..343f20d 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -1811,7 +1811,8 @@ static void examine_super_imsm(struct supertype *st, char *homehost) - __u32 reserved = imsm_reserved_sectors(super, super->disks); - struct dl *dl; - -- snprintf(str, MPB_SIG_LEN, "%s", mpb->sig); -+ strncpy(str, (char *)mpb->sig, MPB_SIG_LEN); -+ str[MPB_SIG_LEN-1] = '\0'; - printf(" Magic : %s\n", str); - snprintf(str, strlen(MPB_VERSION_RAID0), "%s", get_imsm_version(mpb)); - printf(" Version : %s\n", get_imsm_version(mpb)); -@@ -7142,14 +7143,16 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, - - u->type = update_rename_array; - u->dev_idx = vol; -- snprintf((char *) u->name, MAX_RAID_SERIAL_LEN, "%s", name); -+ strncpy((char *) u->name, name, MAX_RAID_SERIAL_LEN); -+ u->name[MAX_RAID_SERIAL_LEN-1] = '\0'; - append_metadata_update(st, u, sizeof(*u)); - } else { - struct imsm_dev *dev; - int i; - - dev = get_imsm_dev(super, vol); -- snprintf((char *) dev->volume, MAX_RAID_SERIAL_LEN, "%s", name); -+ strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN); -+ dev->volume[MAX_RAID_SERIAL_LEN-1] = '\0'; - for (i = 0; i < mpb->num_raid_devs; i++) { - dev = get_imsm_dev(super, i); - handle_missing(super, dev); --- -2.7.4 - diff --git a/sources b/sources index 4e161c9..1c4b506 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -SHA512 (mdadm-4.0.tar.xz) = 12fb26e6b9c1912698defa406e5e47a7ca8d68d4a9aa7acdc9b463ee2d4a37fc6ecef6beb5395ff619018c3f6bdb6d8c573060d027707540f645ad2265170e8b +SHA512 (mdadm-4.3.tar.xz) = e44977f2f80d2471cb313803a60c92dafe8282ac06bbbfd41ae90ca493c64a3da94db924538788d045fd7f0667333912dabedb0b070f9abf5c0540b32e0fa08f +SHA512 (mdadm-4.3.tar.sign) = c0ae042399974c360ffbf4f15928e59591eb88f97faac1d7892066fefb8f8c525fe0948a4fd6ddd3781d0b27d8891e1bd2e0cd9e6a2dbf17b9f8d8c4879dc6b1 diff --git a/specify-enough-length-when-write-to-buffer.patch b/specify-enough-length-when-write-to-buffer.patch deleted file mode 100644 index cc26ec0..0000000 --- a/specify-enough-length-when-write-to-buffer.patch +++ /dev/null @@ -1,74 +0,0 @@ -From ff9239ee3177630d62c7a58408992af7a779763c Mon Sep 17 00:00:00 2001 -From: Xiao Ni -Date: Fri, 17 Mar 2017 19:55:43 +0800 -Subject: [RHEL6.9 PATCH 2/2] mdadm: Specify enough length when write to buffer -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In Detail.c the buffer path in function Detail is defined as path[200], -in fact the max lenth of content which needs to write to the buffer is -287. Because the length of dname of struct dirent is 255. -During building it reports error: -error: ‘%s’ directive writing up to 255 bytes into a region of size 189 -[-Werror=format-overflow=] - -In function examine_super0 there is a buffer nb with length 5. -But it need to show a int type argument. The lenght of max -number of int is 10. So the buffer length should be 11. - -In human_size function the length of buf is 30. During building -there is a error: -output between 20 and 47 bytes into a destination of size 30. -Change the length to 47. - -Signed-off-by: Xiao Ni -Signed-off-by: Jes Sorensen ---- - Detail.c | 2 +- - super0.c | 2 +- - util.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/Detail.c b/Detail.c -index 509b0d4..cb33794 100644 ---- a/Detail.c -+++ b/Detail.c -@@ -575,7 +575,7 @@ This is pretty boring - printf(" Member Arrays :"); - - while (dir && (de = readdir(dir)) != NULL) { -- char path[200]; -+ char path[287]; - char vbuf[1024]; - int nlen = strlen(sra->sys_name); - dev_t devid; -diff --git a/super0.c b/super0.c -index 938cfd9..f5b4507 100644 ---- a/super0.c -+++ b/super0.c -@@ -231,7 +231,7 @@ static void examine_super0(struct supertype *st, char *homehost) - d++) { - mdp_disk_t *dp; - char *dv; -- char nb[5]; -+ char nb[11]; - int wonly, failfast; - if (d>=0) dp = &sb->disks[d]; - else dp = &sb->this_disk; -diff --git a/util.c b/util.c -index f100972..32bd909 100644 ---- a/util.c -+++ b/util.c -@@ -811,7 +811,7 @@ unsigned long calc_csum(void *super, int bytes) - #ifndef MDASSEMBLE - char *human_size(long long bytes) - { -- static char buf[30]; -+ static char buf[47]; - - /* We convert bytes to either centi-M{ega,ibi}bytes or - * centi-G{igi,ibi}bytes, with appropriate rounding, --- -2.7.4 -