From d64f65bdfb8114135e0e2625d14caa3fc770e4a2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Wed, 8 Jun 2022 08:15:18 +0000 Subject: [PATCH] Auto sync2gitlab import of mdadm-4.2-3.el8.src.rpm --- 0001-Unify-error-message.patch | 47 + 0002-mdadm-Fix-double-free.patch | 33 + ...-r0-grow-size-error-message-and-upda.patch | 83 + 0004-udev-adapt-rules-to-systemd-v247.patch | 67 + ...ce-error-prone-signal-with-sigaction.patch | 252 +++ ...-Respect-config-file-location-in-man.patch | 1533 +++++++++++++++++ 0007-mdadm-Update-ReadMe.patch | 48 + ...fig-man-regarding-default-files-and-.patch | 203 +++ 0009-mdadm-Update-config-manual.patch | 45 + 0010-Create-Build-use-default_layout.patch | 153 ++ 0011-mdadm-add-map_num_s.patch | 382 ++++ ...move-KillMode-none-from-service-file.patch | 69 + ...dadm-fix-coredump-of-mdadm-monitor-r.patch | 0 mdadm.spec | 34 +- 14 files changed, 2946 insertions(+), 3 deletions(-) create mode 100644 0001-Unify-error-message.patch create mode 100644 0002-mdadm-Fix-double-free.patch create mode 100644 0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch create mode 100644 0004-udev-adapt-rules-to-systemd-v247.patch create mode 100644 0005-Replace-error-prone-signal-with-sigaction.patch create mode 100644 0006-mdadm-Respect-config-file-location-in-man.patch create mode 100644 0007-mdadm-Update-ReadMe.patch create mode 100644 0008-mdadm-Update-config-man-regarding-default-files-and-.patch create mode 100644 0009-mdadm-Update-config-manual.patch create mode 100644 0010-Create-Build-use-default_layout.patch create mode 100644 0011-mdadm-add-map_num_s.patch create mode 100644 0012-mdadm-systemd-remove-KillMode-none-from-service-file.patch rename 0001-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch => Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch (100%) diff --git a/0001-Unify-error-message.patch b/0001-Unify-error-message.patch new file mode 100644 index 0000000..b4ceb95 --- /dev/null +++ b/0001-Unify-error-message.patch @@ -0,0 +1,47 @@ +From f1cc8ab9ab6a92c3cd94ab7590b46285e214681e Mon Sep 17 00:00:00 2001 +From: Lukasz Florczak +Date: Tue, 15 Mar 2022 09:30:30 +0100 +Subject: [PATCH 01/12] Unify error message. + +Provide the same error message for the same error that can occur in Grow.c and super-intel.c. + +Signed-off-by: Lukasz Florczak +Signed-off-by: Jes Sorensen +--- + Grow.c | 4 ++-- + super-intel.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Grow.c b/Grow.c +index 9c6fc95e..9a947204 100644 +--- a/Grow.c ++++ b/Grow.c +@@ -1001,8 +1001,8 @@ int remove_disks_for_takeover(struct supertype *st, + rv = 1; + sysfs_free(arrays); + if (rv) { +- pr_err("Error. Cannot perform operation on /dev/%s\n", st->devnm); +- pr_err("For this operation it MUST be single array in container\n"); ++ pr_err("Error. Cannot perform operation on %s- for this operation " ++ "it MUST be single array in container\n", st->devnm); + return rv; + } + } +diff --git a/super-intel.c b/super-intel.c +index d5fad102..5ffa7636 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -11683,8 +11683,8 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st, + struct imsm_super *mpb = super->anchor; + + if (mpb->num_raid_devs > 1) { +- pr_err("Error. Cannot perform operation on %s- for this operation it MUST be single array in container\n", +- geo->dev_name); ++ pr_err("Error. Cannot perform operation on %s- for this operation " ++ "it MUST be single array in container\n", geo->dev_name); + change = -1; + } + } +-- +2.31.1 + diff --git a/0002-mdadm-Fix-double-free.patch b/0002-mdadm-Fix-double-free.patch new file mode 100644 index 0000000..d3e1db1 --- /dev/null +++ b/0002-mdadm-Fix-double-free.patch @@ -0,0 +1,33 @@ +From 5ce5a15f0bf007e850e15259bba4f53736605fb2 Mon Sep 17 00:00:00 2001 +From: Lukasz Florczak +Date: Fri, 25 Mar 2022 12:48:59 +0100 +Subject: [PATCH 02/12] mdadm: Fix double free + +If there was a size mismatch after creation it would get fixed on grow +in imsm_fix_size_mismatch(), but due to double free "double free or corruption (fasttop)" +error occurs and grow cannot proceed. + +Signed-off-by: Lukasz Florczak +Signed-off-by: Jes Sorensen +--- + super-intel.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/super-intel.c b/super-intel.c +index 5ffa7636..6ff336ee 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -11783,9 +11783,8 @@ static int imsm_fix_size_mismatch(struct supertype *st, int subarray_index) + st->update_tail = &st->updates; + } else { + imsm_sync_metadata(st); ++ free(update); + } +- +- free(update); + } + ret_val = 0; + exit: +-- +2.31.1 + diff --git a/0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch b/0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch new file mode 100644 index 0000000..a36866b --- /dev/null +++ b/0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch @@ -0,0 +1,83 @@ +From fea026b4849182fc8413014c81456e7215af28d9 Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Wed, 23 Mar 2022 15:05:19 +0100 +Subject: [PATCH 03/12] Grow_reshape: Add r0 grow size error message and update + man + +Grow size on r0 is not supported for imsm and native metadata. +Add proper error message. +Update man for proper use of --size. +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + Grow.c | 6 ++++++ + mdadm.8.in | 19 ++++++++++++------- + 2 files changed, 18 insertions(+), 7 deletions(-) + +diff --git a/Grow.c b/Grow.c +index 9a947204..aa72490b 100644 +--- a/Grow.c ++++ b/Grow.c +@@ -1998,6 +1998,12 @@ int Grow_reshape(char *devname, int fd, + goto release; + } + ++ if (array.level == 0) { ++ pr_err("Component size change is not supported for RAID0\n"); ++ rv = 1; ++ goto release; ++ } ++ + if (reshape_super(st, s->size, UnSet, UnSet, 0, 0, UnSet, NULL, + devname, APPLY_METADATA_CHANGES, + c->verbose > 0)) { +diff --git a/mdadm.8.in b/mdadm.8.in +index be902dba..e2a42425 100644 +--- a/mdadm.8.in ++++ b/mdadm.8.in +@@ -459,7 +459,8 @@ number of spare devices. + + .TP + .BR \-z ", " \-\-size= +-Amount (in Kilobytes) of space to use from each drive in RAID levels 1/4/5/6. ++Amount (in Kilobytes) of space to use from each drive in RAID levels 1/4/5/6/10 ++and for RAID 0 on external metadata. + This must be a multiple of the chunk size, and must leave about 128Kb + of space at the end of the drive for the RAID superblock. + If this is not specified +@@ -478,10 +479,19 @@ To guard against this it can be useful to set the initial size + slightly smaller than the smaller device with the aim that it will + still be larger than any replacement. + ++This option can be used with ++.B \-\-create ++for determining initial size of an array. For external metadata, ++it can be used on a volume, but not on a container itself. ++Setting initial size of ++.B RAID 0 ++array is only valid for external metadata. ++ + This value can be set with + .B \-\-grow +-for RAID level 1/4/5/6 though ++for RAID level 1/4/5/6/10 though + DDF arrays may not be able to support this. ++RAID 0 array size cannot be changed. + If the array was created with a size smaller than the currently + active drives, the extra space can be accessed using + .BR \-\-grow . +@@ -501,11 +511,6 @@ problems the array can be made bigger again with no loss with another + .B "\-\-grow \-\-size=" + command. + +-This value cannot be used when creating a +-.B CONTAINER +-such as with DDF and IMSM metadata, though it perfectly valid when +-creating an array inside a container. +- + .TP + .BR \-Z ", " \-\-array\-size= + This is only meaningful with +-- +2.31.1 + diff --git a/0004-udev-adapt-rules-to-systemd-v247.patch b/0004-udev-adapt-rules-to-systemd-v247.patch new file mode 100644 index 0000000..c1bcb29 --- /dev/null +++ b/0004-udev-adapt-rules-to-systemd-v247.patch @@ -0,0 +1,67 @@ +From cf9a109209aad285372b67306d54118af6fc522b Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +Date: Fri, 14 Jan 2022 16:44:33 +0100 +Subject: [PATCH 04/12] udev: adapt rules to systemd v247 + +New events have been added in kernel 4.14 ("bind" and "unbind"). +Systemd maintainer suggests to modify "add|change" branches. +This patches implements their suggestions. There is no issue yet because +new event types are not used in md. + +Please see systemd announcement for details[1]. + +[1] https://lists.freedesktop.org/archives/systemd-devel/2020-November/045646.html + +Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Jes Sorensen +--- + udev-md-raid-arrays.rules | 2 +- + udev-md-raid-assembly.rules | 5 +++-- + udev-md-raid-safe-timeouts.rules | 2 +- + 3 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/udev-md-raid-arrays.rules b/udev-md-raid-arrays.rules +index 13c9076e..2967ace1 100644 +--- a/udev-md-raid-arrays.rules ++++ b/udev-md-raid-arrays.rules +@@ -3,7 +3,7 @@ + SUBSYSTEM!="block", GOTO="md_end" + + # handle md arrays +-ACTION!="add|change", GOTO="md_end" ++ACTION=="remove", GOTO="md_end" + KERNEL!="md*", GOTO="md_end" + + # partitions have no md/{array_state,metadata_version}, but should not +diff --git a/udev-md-raid-assembly.rules b/udev-md-raid-assembly.rules +index d668cddd..39b4344b 100644 +--- a/udev-md-raid-assembly.rules ++++ b/udev-md-raid-assembly.rules +@@ -30,8 +30,9 @@ LABEL="md_inc" + + # remember you can limit what gets auto/incrementally assembled by + # mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY' +-ACTION=="add|change", IMPORT{program}="BINDIR/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}" +-ACTION=="add|change", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer" ++ACTION!="remove", IMPORT{program}="BINDIR/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}" ++ACTION!="remove", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer" ++ + ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="BINDIR/mdadm -If $name --path $env{ID_PATH}" + ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="BINDIR/mdadm -If $name" + +diff --git a/udev-md-raid-safe-timeouts.rules b/udev-md-raid-safe-timeouts.rules +index 12bdcaa8..2e185cee 100644 +--- a/udev-md-raid-safe-timeouts.rules ++++ b/udev-md-raid-safe-timeouts.rules +@@ -50,7 +50,7 @@ ENV{DEVTYPE}!="partition", GOTO="md_timeouts_end" + + IMPORT{program}="/sbin/mdadm --examine --export $devnode" + +-ACTION=="add|change", \ ++ACTION!="remove", \ + ENV{ID_FS_TYPE}=="linux_raid_member", \ + ENV{MD_LEVEL}=="raid[1-9]*", \ + TEST=="/sys/block/$parent/device/timeout", \ +-- +2.31.1 + diff --git a/0005-Replace-error-prone-signal-with-sigaction.patch b/0005-Replace-error-prone-signal-with-sigaction.patch new file mode 100644 index 0000000..34552bb --- /dev/null +++ b/0005-Replace-error-prone-signal-with-sigaction.patch @@ -0,0 +1,252 @@ +From 83a379cfbd283b387919fe05d44eb4c49e155ad6 Mon Sep 17 00:00:00 2001 +From: Lukasz Florczak +Date: Mon, 21 Feb 2022 13:05:20 +0100 +Subject: [PATCH 05/12] Replace error prone signal() with sigaction() + +Up to this date signal() was used which implementation could vary [1]. +Sigaction() call is preferred. This commit introduces replacement +from signal() to sigaction() by the use of signal_s() wrapper. +Also remove redundant signal.h header includes. + +[1] https://man7.org/linux/man-pages/man2/signal.2.html + +Signed-off-by: Lukasz Florczak +Signed-off-by: Jes Sorensen +--- + Grow.c | 4 ++-- + Monitor.c | 5 +++-- + managemon.c | 1 - + mdadm.h | 22 ++++++++++++++++++++++ + mdmon.c | 1 - + monitor.c | 1 - + probe_roms.c | 6 +++--- + raid6check.c | 25 +++++++++++++++---------- + util.c | 1 - + 9 files changed, 45 insertions(+), 21 deletions(-) + +diff --git a/Grow.c b/Grow.c +index aa72490b..18c5719b 100644 +--- a/Grow.c ++++ b/Grow.c +@@ -26,7 +26,6 @@ + #include + #include + #include +-#include + #include + + #if ! defined(__BIG_ENDIAN) && ! defined(__LITTLE_ENDIAN) +@@ -3566,7 +3565,8 @@ started: + fd = -1; + mlockall(MCL_FUTURE); + +- signal(SIGTERM, catch_term); ++ if (signal_s(SIGTERM, catch_term) == SIG_ERR) ++ goto release; + + if (st->ss->external) { + /* metadata handler takes it from here */ +diff --git a/Monitor.c b/Monitor.c +index 30c031a2..c0ab5412 100644 +--- a/Monitor.c ++++ b/Monitor.c +@@ -26,7 +26,6 @@ + #include "md_p.h" + #include "md_u.h" + #include +-#include + #include + #include + #ifndef NO_LIBUDEV +@@ -435,8 +434,10 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info) + if (mp) { + FILE *mdstat; + char hname[256]; ++ + gethostname(hname, sizeof(hname)); +- signal(SIGPIPE, SIG_IGN); ++ signal_s(SIGPIPE, SIG_IGN); ++ + if (info->mailfrom) + fprintf(mp, "From: %s\n", info->mailfrom); + else +diff --git a/managemon.c b/managemon.c +index bb7334cf..0e9bdf00 100644 +--- a/managemon.c ++++ b/managemon.c +@@ -106,7 +106,6 @@ + #include "mdmon.h" + #include + #include +-#include + + static void close_aa(struct active_array *aa) + { +diff --git a/mdadm.h b/mdadm.h +index c7268a71..26e7e5cd 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -46,6 +46,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence)); + #include + #include + #include ++#include + /* Newer glibc requires sys/sysmacros.h directly for makedev() */ + #include + #ifdef __dietlibc__ +@@ -1729,6 +1730,27 @@ static inline char *to_subarray(struct mdstat_ent *ent, char *container) + return &ent->metadata_version[10+strlen(container)+1]; + } + ++/** ++ * signal_s() - Wrapper for sigaction() with signal()-like interface. ++ * @sig: The signal to set the signal handler to. ++ * @handler: The signal handler. ++ * ++ * Return: previous handler or SIG_ERR on failure. ++ */ ++static inline sighandler_t signal_s(int sig, sighandler_t handler) ++{ ++ struct sigaction new_act; ++ struct sigaction old_act; ++ ++ new_act.sa_handler = handler; ++ new_act.sa_flags = 0; ++ ++ if (sigaction(sig, &new_act, &old_act) == 0) ++ return old_act.sa_handler; ++ ++ return SIG_ERR; ++} ++ + #ifdef DEBUG + #define dprintf(fmt, arg...) \ + fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##arg) +diff --git a/mdmon.c b/mdmon.c +index c71e62c6..5570574b 100644 +--- a/mdmon.c ++++ b/mdmon.c +@@ -56,7 +56,6 @@ + #include + #include + #include +-#include + #include + #ifdef USE_PTHREADS + #include +diff --git a/monitor.c b/monitor.c +index e0d3be67..b877e595 100644 +--- a/monitor.c ++++ b/monitor.c +@@ -22,7 +22,6 @@ + #include "mdmon.h" + #include + #include +-#include + + static char *array_states[] = { + "clear", "inactive", "suspended", "readonly", "read-auto", +diff --git a/probe_roms.c b/probe_roms.c +index 7ea04c7a..94c80c2c 100644 +--- a/probe_roms.c ++++ b/probe_roms.c +@@ -22,7 +22,6 @@ + #include "probe_roms.h" + #include "mdadm.h" + #include +-#include + #include + #include + #include +@@ -69,7 +68,8 @@ static int probe_address16(const __u16 *ptr, __u16 *val) + + void probe_roms_exit(void) + { +- signal(SIGBUS, SIG_DFL); ++ signal_s(SIGBUS, SIG_DFL); ++ + if (rom_fd >= 0) { + close(rom_fd); + rom_fd = -1; +@@ -98,7 +98,7 @@ int probe_roms_init(unsigned long align) + if (roms_init()) + return -1; + +- if (signal(SIGBUS, sigbus) == SIG_ERR) ++ if (signal_s(SIGBUS, sigbus) == SIG_ERR) + rc = -1; + if (rc == 0) { + fd = open("/dev/mem", O_RDONLY); +diff --git a/raid6check.c b/raid6check.c +index a8e6005b..99477761 100644 +--- a/raid6check.c ++++ b/raid6check.c +@@ -24,7 +24,6 @@ + + #include "mdadm.h" + #include +-#include + #include + + #define CHECK_PAGE_BITS (12) +@@ -130,30 +129,36 @@ void raid6_stats(int *disk, int *results, int raid_disks, int chunk_size) + } + + int lock_stripe(struct mdinfo *info, unsigned long long start, +- int chunk_size, int data_disks, sighandler_t *sig) { ++ int chunk_size, int data_disks, sighandler_t *sig) ++{ + int rv; ++ ++ sig[0] = signal_s(SIGTERM, SIG_IGN); ++ sig[1] = signal_s(SIGINT, SIG_IGN); ++ sig[2] = signal_s(SIGQUIT, SIG_IGN); ++ ++ if (sig[0] == SIG_ERR || sig[1] == SIG_ERR || sig[2] == SIG_ERR) ++ return 1; ++ + if(mlockall(MCL_CURRENT | MCL_FUTURE) != 0) { + return 2; + } + +- sig[0] = signal(SIGTERM, SIG_IGN); +- sig[1] = signal(SIGINT, SIG_IGN); +- sig[2] = signal(SIGQUIT, SIG_IGN); +- + rv = sysfs_set_num(info, NULL, "suspend_lo", start * chunk_size * data_disks); + rv |= sysfs_set_num(info, NULL, "suspend_hi", (start + 1) * chunk_size * data_disks); + return rv * 256; + } + +-int unlock_all_stripes(struct mdinfo *info, sighandler_t *sig) { ++int unlock_all_stripes(struct mdinfo *info, sighandler_t *sig) ++{ + int rv; + rv = sysfs_set_num(info, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL); + rv |= sysfs_set_num(info, NULL, "suspend_hi", 0); + rv |= sysfs_set_num(info, NULL, "suspend_lo", 0); + +- signal(SIGQUIT, sig[2]); +- signal(SIGINT, sig[1]); +- signal(SIGTERM, sig[0]); ++ signal_s(SIGQUIT, sig[2]); ++ signal_s(SIGINT, sig[1]); ++ signal_s(SIGTERM, sig[0]); + + if(munlockall() != 0) + return 3; +diff --git a/util.c b/util.c +index 3d05d074..cc94f96e 100644 +--- a/util.c ++++ b/util.c +@@ -35,7 +35,6 @@ + #include + #include + #include +-#include + #include + + +-- +2.31.1 + diff --git a/0006-mdadm-Respect-config-file-location-in-man.patch b/0006-mdadm-Respect-config-file-location-in-man.patch new file mode 100644 index 0000000..c5885b6 --- /dev/null +++ b/0006-mdadm-Respect-config-file-location-in-man.patch @@ -0,0 +1,1533 @@ +From e9dd5644843e2013a7dd1a8a5da2b9fa35837416 Mon Sep 17 00:00:00 2001 +From: Lukasz Florczak +Date: Fri, 18 Mar 2022 09:26:04 +0100 +Subject: [PATCH 06/12] mdadm: Respect config file location in man + +Default config file location could differ depending on OS (e.g. Debian family). +This patch takes default config file into consideration when creating mdadm.man +file as well as mdadm.conf.man. + +Rename mdadm.conf.5 to mdadm.conf.5.in. Now mdadm.conf.5 is generated automatically. + +Signed-off-by: Lukasz Florczak +Acked-by: Coly Li +Signed-off-by: Jes Sorensen +--- + .gitignore | 1 + + Makefile | 7 +- + mdadm.8.in | 16 +- + mdadm.conf.5 | 706 ------------------------------------------------ + mdadm.conf.5.in | 706 ++++++++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 721 insertions(+), 715 deletions(-) + delete mode 100644 mdadm.conf.5 + create mode 100644 mdadm.conf.5.in + +diff --git a/.gitignore b/.gitignore +index 217fe76d..8d791c6f 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -3,6 +3,7 @@ + /*-stamp + /mdadm + /mdadm.8 ++/mdadm.conf.5 + /mdadm.udeb + /mdassemble + /mdmon +diff --git a/Makefile b/Makefile +index 2a51d813..bf126033 100644 +--- a/Makefile ++++ b/Makefile +@@ -227,7 +227,12 @@ raid6check : raid6check.o mdadm.h $(CHECK_OBJS) + + mdadm.8 : mdadm.8.in + sed -e 's/{DEFAULT_METADATA}/$(DEFAULT_METADATA)/g' \ +- -e 's,{MAP_PATH},$(MAP_PATH),g' mdadm.8.in > mdadm.8 ++ -e 's,{MAP_PATH},$(MAP_PATH),g' -e 's,{CONFFILE},$(CONFFILE),g' \ ++ -e 's,{CONFFILE2},$(CONFFILE2),g' mdadm.8.in > mdadm.8 ++ ++mdadm.conf.5 : mdadm.conf.5.in ++ sed -e 's,{CONFFILE},$(CONFFILE),g' \ ++ -e 's,{CONFFILE2},$(CONFFILE2),g' mdadm.conf.5.in > mdadm.conf.5 + + mdadm.man : mdadm.8 + man -l mdadm.8 > mdadm.man +diff --git a/mdadm.8.in b/mdadm.8.in +index e2a42425..8b21ffd4 100644 +--- a/mdadm.8.in ++++ b/mdadm.8.in +@@ -267,13 +267,13 @@ the exact meaning of this option in different contexts. + .TP + .BR \-c ", " \-\-config= + Specify the config file or directory. Default is to use +-.B /etc/mdadm.conf ++.B {CONFFILE} + and +-.BR /etc/mdadm.conf.d , ++.BR {CONFFILE}.d , + or if those are missing then +-.B /etc/mdadm/mdadm.conf ++.B {CONFFILE2} + and +-.BR /etc/mdadm/mdadm.conf.d . ++.BR {CONFFILE2}.d . + If the config file given is + .B "partitions" + then nothing will be read, but +@@ -2014,9 +2014,9 @@ The config file is only used if explicitly named with + or requested with (a possibly implicit) + .BR \-\-scan . + In the later case, +-.B /etc/mdadm.conf ++.B {CONFFILE} + or +-.B /etc/mdadm/mdadm.conf ++.B {CONFFILE2} + is used. + + If +@@ -3344,7 +3344,7 @@ uses this to find arrays when + is given in Misc mode, and to monitor array reconstruction + on Monitor mode. + +-.SS /etc/mdadm.conf ++.SS {CONFFILE} (or {CONFFILE2}) + + The config file lists which devices may be scanned to see if + they contain MD super block, and gives identifying information +@@ -3352,7 +3352,7 @@ they contain MD super block, and gives identifying information + .BR mdadm.conf (5) + for more details. + +-.SS /etc/mdadm.conf.d ++.SS {CONFFILE}.d (or {CONFFILE2}.d) + + A directory containing configuration files which are read in lexical + order. +diff --git a/mdadm.conf.5 b/mdadm.conf.5 +deleted file mode 100644 +index 74a21c5f..00000000 +--- a/mdadm.conf.5 ++++ /dev/null +@@ -1,706 +0,0 @@ +-.\" Copyright Neil Brown and others. +-.\" 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. +-.\" See file COPYING in distribution for details. +-.TH MDADM.CONF 5 +-.SH NAME +-mdadm.conf \- configuration for management of Software RAID with mdadm +-.SH SYNOPSIS +-/etc/mdadm.conf +-.SH DESCRIPTION +-.PP +-.I mdadm +-is a tool for creating, managing, and monitoring RAID devices using the +-.B md +-driver in Linux. +-.PP +-Some common tasks, such as assembling all arrays, can be simplified +-by describing the devices and arrays in this configuration file. +- +-.SS SYNTAX +-The file should be seen as a collection of words separated by white +-space (space, tab, or newline). +-Any word that beings with a hash sign (#) starts a comment and that +-word together with the remainder of the line is ignored. +- +-Spaces can be included in a word using quotation characters. Either +-single quotes +-.RB ( ' ) +-or double quotes (\fB"\fP) +-may be used. All the characters from one quotation character to +-next identical character are protected and will not be used to +-separate words to start new quoted strings. To include a single quote +-it must be between double quotes. To include a double quote it must +-be between single quotes. +- +-Any line that starts with white space (space or tab) is treated as +-though it were a continuation of the previous line. +- +-Empty lines are ignored, but otherwise each (non continuation) line +-must start with a keyword as listed below. The keywords are case +-insensitive and can be abbreviated to 3 characters. +- +-The keywords are: +-.TP +-.B DEVICE +-A +-.B device +-line lists the devices (whole devices or partitions) that might contain +-a component of an MD array. When looking for the components of an +-array, +-.I mdadm +-will scan these devices (or any devices listed on the command line). +- +-The +-.B device +-line may contain a number of different devices (separated by spaces) +-and each device name can contain wild cards as defined by +-.BR glob (7). +- +-Also, there may be several device lines present in the file. +- +-Alternatively, a +-.B device +-line can contain either or both of the words +-.B containers +-and +-.BR partitions . +-The word +-.B containers +-will cause +-.I mdadm +-to look for assembled CONTAINER arrays and included them as a source +-for assembling further arrays. +- +-The word +-.I partitions +-will cause +-.I mdadm +-to read +-.I /proc/partitions +-and include all devices and partitions found therein. +-.I mdadm +-does not use the names from +-.I /proc/partitions +-but only the major and minor device numbers. It scans +-.I /dev +-to find the name that matches the numbers. +- +-If no DEVICE line is present, then "DEVICE partitions containers" is assumed. +- +-For example: +-.IP +-DEVICE /dev/hda* /dev/hdc* +-.br +-DEV /dev/sd* +-.br +-DEVICE /dev/disk/by-path/pci* +-.br +-DEVICE partitions +- +-.TP +-.B ARRAY +-The ARRAY lines identify actual arrays. The second word on the line +-may be the name of the device where the array is normally +-assembled, such as +-.B /dev/md1 +-or +-.BR /dev/md/backup . +-If the name does not start with a slash +-.RB (' / '), +-it is treated as being in +-.BR /dev/md/ . +-Alternately the word +-.B +-(complete with angle brackets) can be given in which case any array +-which matches the rest of the line will never be automatically assembled. +-If no device name is given, +-.I mdadm +-will use various heuristics to determine an appropriate name. +- +-Subsequent words identify the array, or identify the array as a member +-of a group. If multiple identities are given, +-then a component device must match ALL identities to be considered a +-match. Each identity word has a tag, and equals sign, and some value. +-The tags are: +-.RS 4 +-.TP +-.B uuid= +-The value should be a 128 bit uuid in hexadecimal, with punctuation +-interspersed if desired. This must match the uuid stored in the +-superblock. +-.TP +-.B name= +-The value should be a simple textual name as was given to +-.I mdadm +-when the array was created. This must match the name stored in the +-superblock on a device for that device to be included in the array. +-Not all superblock formats support names. +-.TP +-.B super\-minor= +-The value is an integer which indicates the minor number that was +-stored in the superblock when the array was created. When an array is +-created as /dev/mdX, then the minor number X is stored. +-.TP +-.B devices= +-The value is a comma separated list of device names or device name +-patterns. +-Only devices with names which match one entry in the list will be used +-to assemble the array. Note that the devices +-listed there must also be listed on a DEVICE line. +-.TP +-.B level= +-The value is a RAID level. This is not normally used to +-identify an array, but is supported so that the output of +- +-.B "mdadm \-\-examine \-\-scan" +- +-can be use directly in the configuration file. +-.TP +-.B num\-devices= +-The value is the number of devices in a complete active array. As with +-.B level= +-this is mainly for compatibility with the output of +- +-.BR "mdadm \-\-examine \-\-scan" . +- +-.TP +-.B spares= +-The value is a number of spare devices to expect the array to have. +-The sole use of this keyword and value is as follows: +-.B mdadm \-\-monitor +-will report an array if it is found to have fewer than this number of +-spares when +-.B \-\-monitor +-starts or when +-.B \-\-oneshot +-is used. +- +-.TP +-.B spare\-group= +-The value is a textual name for a group of arrays. All arrays with +-the same +-.B spare\-group +-name are considered to be part of the same group. The significance of +-a group of arrays is that +-.I mdadm +-will, when monitoring the arrays, move a spare drive from one array in +-a group to another array in that group if the first array had a failed +-or missing drive but no spare. +- +-.TP +-.B auto= +-This option is rarely needed with mdadm-3.0, particularly if use with +-the Linux kernel v2.6.28 or later. +-It tells +-.I mdadm +-whether to use partitionable array or non-partitionable arrays and, +-in the absence of +-.IR udev , +-how many partition devices to create. From 2.6.28 all md array +-devices are partitionable, hence this option is not needed. +- +-The value of this option can be "yes" or "md" to indicate that a +-traditional, non-partitionable md array should be created, or "mdp", +-"part" or "partition" to indicate that a partitionable md array (only +-available in linux 2.6 and later) should be used. This later set can +-also have a number appended to indicate how many partitions to create +-device files for, e.g. +-.BR auto=mdp5 . +-The default is 4. +- +-.TP +-.B bitmap= +-The option specifies a file in which a write-intent bitmap should be +-found. When assembling the array, +-.I mdadm +-will provide this file to the +-.B md +-driver as the bitmap file. This has the same function as the +-.B \-\-bitmap\-file +-option to +-.BR \-\-assemble . +- +-.TP +-.B metadata= +-Specify the metadata format that the array has. This is mainly +-recognised for comparability with the output of +-.BR "mdadm \-Es" . +- +-.TP +-.B container= +-Specify that this array is a member array of some container. The +-value given can be either a path name in /dev, or a UUID of the +-container array. +- +-.TP +-.B member= +-Specify that this array is a member array of some container. Each +-type of container has some way to enumerate member arrays, often a +-simple sequence number. The value identifies which member of a +-container the array is. It will usually accompany a "container=" word. +-.RE +- +-.TP +-.B MAILADDR +-The +-.B mailaddr +-line gives an E-mail address that alerts should be +-sent to when +-.I mdadm +-is running in +-.B \-\-monitor +-mode (and was given the +-.B \-\-scan +-option). There should only be one +-.B MAILADDR +-line and it should have only one address. Any subsequent addresses +-are silently ignored. +- +-.TP +-.B MAILFROM +-The +-.B mailfrom +-line (which can only be abbreviated to at least 5 characters) gives an +-address to appear in the "From" address for alert mails. This can be +-useful if you want to explicitly set a domain, as the default from +-address is "root" with no domain. All words on this line are +-catenated with spaces to form the address. +- +-Note that this value cannot be set via the +-.I mdadm +-commandline. It is only settable via the config file. +- +-.TP +-.B PROGRAM +-The +-.B program +-line gives the name of a program to be run when +-.B "mdadm \-\-monitor" +-detects potentially interesting events on any of the arrays that it +-is monitoring. This program gets run with two or three arguments, they +-being the Event, the md device, and possibly the related component +-device. +- +-There should only be one +-.B program +-line and it should be give only one program. +- +- +-.TP +-.B CREATE +-The +-.B create +-line gives default values to be used when creating arrays, new members +-of arrays, and device entries for arrays. +-These include: +- +-.RS 4 +-.TP +-.B owner= +-.TP +-.B group= +-These can give user/group ids or names to use instead of system +-defaults (root/wheel or root/disk). +-.TP +-.B mode= +-An octal file mode such as 0660 can be given to override the default +-of 0600. +-.TP +-.B auto= +-This corresponds to the +-.B \-\-auto +-flag to mdadm. Give +-.BR yes , +-.BR md , +-.BR mdp , +-.B part +-\(em possibly followed by a number of partitions \(em to indicate how +-missing device entries should be created. +- +-.TP +-.B metadata= +-The name of the metadata format to use if none is explicitly given. +-This can be useful to impose a system-wide default of version-1 superblocks. +- +-.TP +-.B symlinks=no +-Normally when creating devices in +-.B /dev/md/ +-.I mdadm +-will create a matching symlink from +-.B /dev/ +-with a name starting +-.B md +-or +-.BR md_ . +-Give +-.B symlinks=no +-to suppress this symlink creation. +- +-.TP +-.B names=yes +-Since Linux 2.6.29 it has been possible to create +-.B md +-devices with a name like +-.B md_home +-rather than just a number, like +-.BR md3 . +-.I mdadm +-will use the numeric alternative by default as other tools that interact +-with md arrays may expect only numbers. +-If +-.B names=yes +-is given in +-.I mdadm.conf +-then +-.I mdadm +-will use a name when appropriate. +-If +-.B names=no +-is given, then non-numeric +-.I md +-device names will not be used even if the default changes in a future +-release of +-.IR mdadm . +- +-.TP +-.B bbl=no +-By default, +-.I mdadm +-will reserve space for a bad block list (bbl) on all devices +-included in or added to any array that supports them. Setting +-.B bbl=no +-will prevent this, so newly added devices will not have a bad +-block log. +-.RE +- +-.TP +-.B HOMEHOST +-The +-.B homehost +-line gives a default value for the +-.B \-\-homehost= +-option to mdadm. There should normally be only one other word on the line. +-It should either be a host name, or one of the special words +-.BR , +-.B +-and +-.BR . +-If +-.B +-is given, then the +-.BR gethostname ( 2 ) +-systemcall is used to get the host name. This is the default. +- +-If +-.B +-is given, then a flag is set so that when arrays are being +-auto-assembled the checking of the recorded +-.I homehost +-is disabled. +-If +-.B +-is given it is also possible to give an explicit name which will be +-used when creating arrays. This is the only case when there can be +-more that one other word on the +-.B HOMEHOST +-line. If there are other words, or other +-.B HOMEHOST +-lines, they are silently ignored. +- +-If +-.B +-is given, then the default of using +-.BR gethostname ( 2 ) +-is over-ridden and no homehost name is assumed. +- +-When arrays are created, this host name will be stored in the +-metadata. When arrays are assembled using auto-assembly, arrays which +-do not record the correct homehost name in their metadata will be +-assembled using a "foreign" name. A "foreign" name alway ends with a +-digit string preceded by an underscore to differentiate it +-from any possible local name. e.g. +-.B /dev/md/1_1 +-or +-.BR /dev/md/home_0 . +-.TP +-.B AUTO +-A list of names of metadata format can be given, each preceded by a +-plus or minus sign. Also the word +-.I homehost +-is allowed as is +-.I all +-preceded by plus or minus sign. +-.I all +-is usually last. +- +-When +-.I mdadm +-is auto-assembling an array, either via +-.I \-\-assemble +-or +-.I \-\-incremental +-and it finds metadata of a given type, it checks that metadata type +-against those listed in this line. The first match wins, where +-.I all +-matches anything. +-If a match is found that was preceded by a plus sign, the auto +-assembly is allowed. If the match was preceded by a minus sign, the +-auto assembly is disallowed. If no match is found, the auto assembly +-is allowed. +- +-If the metadata indicates that the array was created for +-.I this +-host, and the word +-.I homehost +-appears before any other match, then the array is treated as a valid +-candidate for auto-assembly. +- +-This can be used to disable all auto-assembly (so that only arrays +-explicitly listed in mdadm.conf or on the command line are assembled), +-or to disable assembly of certain metadata types which might be +-handled by other software. It can also be used to disable assembly of +-all foreign arrays - normally such arrays are assembled but given a +-non-deterministic name in +-.BR /dev/md/ . +- +-The known metadata types are +-.BR 0.90 , +-.BR 1.x , +-.BR ddf , +-.BR imsm . +- +-.B AUTO +-should be given at most once. Subsequent lines are silently ignored. +-Thus an earlier config file in a config directory will over-ride +-the setting in a later config file. +- +-.TP +-.B POLICY +-This is used to specify what automatic behavior is allowed on devices +-newly appearing in the system and provides a way of marking spares that can +-be moved to other arrays as well as the migration domains. +-.I Domain +-can be defined through +-.I policy +-line by specifying a domain name for a number of paths from +-.BR /dev/disk/by-path/ . +-A device may belong to several domains. The domain of an array is a union +-of domains of all devices in that array. A spare can be automatically +-moved from one array to another if the set of the destination array's +-.I domains +-contains all the +-.I domains +-of the new disk or if both arrays have the same +-.IR spare-group . +- +-To update hot plug configuration it is necessary to execute +-.B mdadm \-\-udev\-rules +-command after changing the config file +- +-Keywords used in the +-.I POLICY +-line and supported values are: +- +-.RS 4 +-.TP +-.B domain= +-any arbitrary string +-.TP +-.B metadata= +-0.9 1.x ddf or imsm +-.TP +-.B path= +-file glob matching anything from +-.B /dev/disk/by-path +-.TP +-.B type= +-either +-.B disk +-or +-.BR part . +-.TP +-.B action= +-include, re-add, spare, spare-same-slot, or force-spare +-.TP +-.B auto= +-yes, no, or homehost. +- +-.P +-The +-.I action +-item determines the automatic behavior allowed for devices matching the +-.I path +-and +-.I type +-in the same line. If a device matches several lines with different +-.I actions +-then the most permissive will apply. The ordering of policy lines +-is irrelevant to the end result. +-.TP +-.B include +-allows adding a disk to an array if metadata on that disk matches that array +-.TP +-.B re\-add +-will include the device in the array if it appears to be a current member +-or a member that was recently removed and the array has a +-write-intent-bitmap to allow the +-.B re\-add +-functionality. +-.TP +-.B spare +-as above and additionally: if the device is bare it can +-become a spare if there is any array that it is a candidate for based +-on domains and metadata. +-.TP +-.B spare\-same\-slot +-as above and additionally if given slot was used by an array that went +-degraded recently and the device plugged in has no metadata then it will +-be automatically added to that array (or it's container) +-.TP +-.B force\-spare +-as above and the disk will become a spare in remaining cases +-.RE +- +-.TP +-.B PART-POLICY +-This is similar to +-.B POLICY +-and accepts the same keyword assignments. It allows a consistent set +-of policies to applied to each of the partitions of a device. +- +-A +-.B PART-POLICY +-line should set +-.I type=disk +-and identify the path to one or more disk devices. Each partition on +-these disks will be treated according to the +-.I action= +-setting from this line. If a +-.I domain +-is set in the line, then the domain associated with each patition will +-be based on the domain, but with +-.RB \(dq -part N\(dq +-appended, when N is the partition number for the partition that was +-found. +- +-.TP +-.B SYSFS +-The +-.B SYSFS +-line lists custom values of MD device's sysfs attributes which will be +-stored in sysfs after the array is assembled. Multiple lines are allowed and each +-line has to contain the uuid or the name of the device to which it relates. +-.RS 4 +-.TP +-.B uuid= +-hexadecimal identifier of MD device. This has to match the uuid stored in the +-superblock. +-.TP +-.B name= +-name of the MD device as was given to +-.I mdadm +-when the array was created. It will be ignored if +-.B uuid +-is not empty. +-.RE +- +-.TP +-.B MONITORDELAY +-The +-.B monitordelay +-line gives a delay in seconds +-.I mdadm +-shall wait before pooling md arrays +-when +-.I mdadm +-is running in +-.B \-\-monitor +-mode. +-.B \-d/\-\-delay +-command line argument takes precedence over the config file +- +-.SH EXAMPLE +-DEVICE /dev/sd[bcdjkl]1 +-.br +-DEVICE /dev/hda1 /dev/hdb1 +- +-# /dev/md0 is known by its UUID. +-.br +-ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371 +-.br +-# /dev/md1 contains all devices with a minor number of +-.br +-# 1 in the superblock. +-.br +-ARRAY /dev/md1 superminor=1 +-.br +-# /dev/md2 is made from precisely these two devices +-.br +-ARRAY /dev/md2 devices=/dev/hda1,/dev/hdb1 +- +-# /dev/md4 and /dev/md5 are a spare-group and spares +-.br +-# can be moved between them +-.br +-ARRAY /dev/md4 uuid=b23f3c6d:aec43a9f:fd65db85:369432df +-.br +- spare\-group=group1 +-.br +-ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977 +-.br +- spare\-group=group1 +-.br +-# /dev/md/home is created if need to be a partitionable md array +-.br +-# any spare device number is allocated. +-.br +-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 +-.br +-POLICY domain=domain1 metadata=imsm path=pci-0000:04:00.0-scsi-[01]* +-.br +- action=include +-.br +-# One domain comprising of devices attached to specified paths is defined. +-.br +-# Bare device matching first path will be made an imsm spare on hot plug. +-.br +-# If more than one array is created on devices belonging to domain1 and +-.br +-# one of them becomes degraded, then any imsm spare matching any path for +-.br +-# given domain name can be migrated. +-.br +-MAILADDR root@mydomain.tld +-.br +-PROGRAM /usr/sbin/handle\-mdadm\-events +-.br +-CREATE group=system mode=0640 auto=part\-8 +-.br +-HOMEHOST +-.br +-AUTO +1.x homehost \-all +-.br +-SYSFS name=/dev/md/raid5 group_thread_cnt=4 sync_speed_max=1000000 +-.br +-SYSFS uuid=bead5eb6:31c17a27:da120ba2:7dfda40d group_thread_cnt=4 +-sync_speed_max=1000000 +-.br +-MONITORDELAY 60 +- +-.SH SEE ALSO +-.BR mdadm (8), +-.BR md (4). +diff --git a/mdadm.conf.5.in b/mdadm.conf.5.in +new file mode 100644 +index 00000000..83edd008 +--- /dev/null ++++ b/mdadm.conf.5.in +@@ -0,0 +1,706 @@ ++.\" Copyright Neil Brown and others. ++.\" 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. ++.\" See file COPYING in distribution for details. ++.TH MDADM.CONF 5 ++.SH NAME ++mdadm.conf \- configuration for management of Software RAID with mdadm ++.SH SYNOPSIS ++{CONFFILE} ++.SH DESCRIPTION ++.PP ++.I mdadm ++is a tool for creating, managing, and monitoring RAID devices using the ++.B md ++driver in Linux. ++.PP ++Some common tasks, such as assembling all arrays, can be simplified ++by describing the devices and arrays in this configuration file. ++ ++.SS SYNTAX ++The file should be seen as a collection of words separated by white ++space (space, tab, or newline). ++Any word that beings with a hash sign (#) starts a comment and that ++word together with the remainder of the line is ignored. ++ ++Spaces can be included in a word using quotation characters. Either ++single quotes ++.RB ( ' ) ++or double quotes (\fB"\fP) ++may be used. All the characters from one quotation character to ++next identical character are protected and will not be used to ++separate words to start new quoted strings. To include a single quote ++it must be between double quotes. To include a double quote it must ++be between single quotes. ++ ++Any line that starts with white space (space or tab) is treated as ++though it were a continuation of the previous line. ++ ++Empty lines are ignored, but otherwise each (non continuation) line ++must start with a keyword as listed below. The keywords are case ++insensitive and can be abbreviated to 3 characters. ++ ++The keywords are: ++.TP ++.B DEVICE ++A ++.B device ++line lists the devices (whole devices or partitions) that might contain ++a component of an MD array. When looking for the components of an ++array, ++.I mdadm ++will scan these devices (or any devices listed on the command line). ++ ++The ++.B device ++line may contain a number of different devices (separated by spaces) ++and each device name can contain wild cards as defined by ++.BR glob (7). ++ ++Also, there may be several device lines present in the file. ++ ++Alternatively, a ++.B device ++line can contain either or both of the words ++.B containers ++and ++.BR partitions . ++The word ++.B containers ++will cause ++.I mdadm ++to look for assembled CONTAINER arrays and included them as a source ++for assembling further arrays. ++ ++The word ++.I partitions ++will cause ++.I mdadm ++to read ++.I /proc/partitions ++and include all devices and partitions found therein. ++.I mdadm ++does not use the names from ++.I /proc/partitions ++but only the major and minor device numbers. It scans ++.I /dev ++to find the name that matches the numbers. ++ ++If no DEVICE line is present, then "DEVICE partitions containers" is assumed. ++ ++For example: ++.IP ++DEVICE /dev/hda* /dev/hdc* ++.br ++DEV /dev/sd* ++.br ++DEVICE /dev/disk/by-path/pci* ++.br ++DEVICE partitions ++ ++.TP ++.B ARRAY ++The ARRAY lines identify actual arrays. The second word on the line ++may be the name of the device where the array is normally ++assembled, such as ++.B /dev/md1 ++or ++.BR /dev/md/backup . ++If the name does not start with a slash ++.RB (' / '), ++it is treated as being in ++.BR /dev/md/ . ++Alternately the word ++.B ++(complete with angle brackets) can be given in which case any array ++which matches the rest of the line will never be automatically assembled. ++If no device name is given, ++.I mdadm ++will use various heuristics to determine an appropriate name. ++ ++Subsequent words identify the array, or identify the array as a member ++of a group. If multiple identities are given, ++then a component device must match ALL identities to be considered a ++match. Each identity word has a tag, and equals sign, and some value. ++The tags are: ++.RS 4 ++.TP ++.B uuid= ++The value should be a 128 bit uuid in hexadecimal, with punctuation ++interspersed if desired. This must match the uuid stored in the ++superblock. ++.TP ++.B name= ++The value should be a simple textual name as was given to ++.I mdadm ++when the array was created. This must match the name stored in the ++superblock on a device for that device to be included in the array. ++Not all superblock formats support names. ++.TP ++.B super\-minor= ++The value is an integer which indicates the minor number that was ++stored in the superblock when the array was created. When an array is ++created as /dev/mdX, then the minor number X is stored. ++.TP ++.B devices= ++The value is a comma separated list of device names or device name ++patterns. ++Only devices with names which match one entry in the list will be used ++to assemble the array. Note that the devices ++listed there must also be listed on a DEVICE line. ++.TP ++.B level= ++The value is a RAID level. This is not normally used to ++identify an array, but is supported so that the output of ++ ++.B "mdadm \-\-examine \-\-scan" ++ ++can be use directly in the configuration file. ++.TP ++.B num\-devices= ++The value is the number of devices in a complete active array. As with ++.B level= ++this is mainly for compatibility with the output of ++ ++.BR "mdadm \-\-examine \-\-scan" . ++ ++.TP ++.B spares= ++The value is a number of spare devices to expect the array to have. ++The sole use of this keyword and value is as follows: ++.B mdadm \-\-monitor ++will report an array if it is found to have fewer than this number of ++spares when ++.B \-\-monitor ++starts or when ++.B \-\-oneshot ++is used. ++ ++.TP ++.B spare\-group= ++The value is a textual name for a group of arrays. All arrays with ++the same ++.B spare\-group ++name are considered to be part of the same group. The significance of ++a group of arrays is that ++.I mdadm ++will, when monitoring the arrays, move a spare drive from one array in ++a group to another array in that group if the first array had a failed ++or missing drive but no spare. ++ ++.TP ++.B auto= ++This option is rarely needed with mdadm-3.0, particularly if use with ++the Linux kernel v2.6.28 or later. ++It tells ++.I mdadm ++whether to use partitionable array or non-partitionable arrays and, ++in the absence of ++.IR udev , ++how many partition devices to create. From 2.6.28 all md array ++devices are partitionable, hence this option is not needed. ++ ++The value of this option can be "yes" or "md" to indicate that a ++traditional, non-partitionable md array should be created, or "mdp", ++"part" or "partition" to indicate that a partitionable md array (only ++available in linux 2.6 and later) should be used. This later set can ++also have a number appended to indicate how many partitions to create ++device files for, e.g. ++.BR auto=mdp5 . ++The default is 4. ++ ++.TP ++.B bitmap= ++The option specifies a file in which a write-intent bitmap should be ++found. When assembling the array, ++.I mdadm ++will provide this file to the ++.B md ++driver as the bitmap file. This has the same function as the ++.B \-\-bitmap\-file ++option to ++.BR \-\-assemble . ++ ++.TP ++.B metadata= ++Specify the metadata format that the array has. This is mainly ++recognised for comparability with the output of ++.BR "mdadm \-Es" . ++ ++.TP ++.B container= ++Specify that this array is a member array of some container. The ++value given can be either a path name in /dev, or a UUID of the ++container array. ++ ++.TP ++.B member= ++Specify that this array is a member array of some container. Each ++type of container has some way to enumerate member arrays, often a ++simple sequence number. The value identifies which member of a ++container the array is. It will usually accompany a "container=" word. ++.RE ++ ++.TP ++.B MAILADDR ++The ++.B mailaddr ++line gives an E-mail address that alerts should be ++sent to when ++.I mdadm ++is running in ++.B \-\-monitor ++mode (and was given the ++.B \-\-scan ++option). There should only be one ++.B MAILADDR ++line and it should have only one address. Any subsequent addresses ++are silently ignored. ++ ++.TP ++.B MAILFROM ++The ++.B mailfrom ++line (which can only be abbreviated to at least 5 characters) gives an ++address to appear in the "From" address for alert mails. This can be ++useful if you want to explicitly set a domain, as the default from ++address is "root" with no domain. All words on this line are ++catenated with spaces to form the address. ++ ++Note that this value cannot be set via the ++.I mdadm ++commandline. It is only settable via the config file. ++ ++.TP ++.B PROGRAM ++The ++.B program ++line gives the name of a program to be run when ++.B "mdadm \-\-monitor" ++detects potentially interesting events on any of the arrays that it ++is monitoring. This program gets run with two or three arguments, they ++being the Event, the md device, and possibly the related component ++device. ++ ++There should only be one ++.B program ++line and it should be give only one program. ++ ++ ++.TP ++.B CREATE ++The ++.B create ++line gives default values to be used when creating arrays, new members ++of arrays, and device entries for arrays. ++These include: ++ ++.RS 4 ++.TP ++.B owner= ++.TP ++.B group= ++These can give user/group ids or names to use instead of system ++defaults (root/wheel or root/disk). ++.TP ++.B mode= ++An octal file mode such as 0660 can be given to override the default ++of 0600. ++.TP ++.B auto= ++This corresponds to the ++.B \-\-auto ++flag to mdadm. Give ++.BR yes , ++.BR md , ++.BR mdp , ++.B part ++\(em possibly followed by a number of partitions \(em to indicate how ++missing device entries should be created. ++ ++.TP ++.B metadata= ++The name of the metadata format to use if none is explicitly given. ++This can be useful to impose a system-wide default of version-1 superblocks. ++ ++.TP ++.B symlinks=no ++Normally when creating devices in ++.B /dev/md/ ++.I mdadm ++will create a matching symlink from ++.B /dev/ ++with a name starting ++.B md ++or ++.BR md_ . ++Give ++.B symlinks=no ++to suppress this symlink creation. ++ ++.TP ++.B names=yes ++Since Linux 2.6.29 it has been possible to create ++.B md ++devices with a name like ++.B md_home ++rather than just a number, like ++.BR md3 . ++.I mdadm ++will use the numeric alternative by default as other tools that interact ++with md arrays may expect only numbers. ++If ++.B names=yes ++is given in ++.I mdadm.conf ++then ++.I mdadm ++will use a name when appropriate. ++If ++.B names=no ++is given, then non-numeric ++.I md ++device names will not be used even if the default changes in a future ++release of ++.IR mdadm . ++ ++.TP ++.B bbl=no ++By default, ++.I mdadm ++will reserve space for a bad block list (bbl) on all devices ++included in or added to any array that supports them. Setting ++.B bbl=no ++will prevent this, so newly added devices will not have a bad ++block log. ++.RE ++ ++.TP ++.B HOMEHOST ++The ++.B homehost ++line gives a default value for the ++.B \-\-homehost= ++option to mdadm. There should normally be only one other word on the line. ++It should either be a host name, or one of the special words ++.BR , ++.B ++and ++.BR . ++If ++.B ++is given, then the ++.BR gethostname ( 2 ) ++systemcall is used to get the host name. This is the default. ++ ++If ++.B ++is given, then a flag is set so that when arrays are being ++auto-assembled the checking of the recorded ++.I homehost ++is disabled. ++If ++.B ++is given it is also possible to give an explicit name which will be ++used when creating arrays. This is the only case when there can be ++more that one other word on the ++.B HOMEHOST ++line. If there are other words, or other ++.B HOMEHOST ++lines, they are silently ignored. ++ ++If ++.B ++is given, then the default of using ++.BR gethostname ( 2 ) ++is over-ridden and no homehost name is assumed. ++ ++When arrays are created, this host name will be stored in the ++metadata. When arrays are assembled using auto-assembly, arrays which ++do not record the correct homehost name in their metadata will be ++assembled using a "foreign" name. A "foreign" name alway ends with a ++digit string preceded by an underscore to differentiate it ++from any possible local name. e.g. ++.B /dev/md/1_1 ++or ++.BR /dev/md/home_0 . ++.TP ++.B AUTO ++A list of names of metadata format can be given, each preceded by a ++plus or minus sign. Also the word ++.I homehost ++is allowed as is ++.I all ++preceded by plus or minus sign. ++.I all ++is usually last. ++ ++When ++.I mdadm ++is auto-assembling an array, either via ++.I \-\-assemble ++or ++.I \-\-incremental ++and it finds metadata of a given type, it checks that metadata type ++against those listed in this line. The first match wins, where ++.I all ++matches anything. ++If a match is found that was preceded by a plus sign, the auto ++assembly is allowed. If the match was preceded by a minus sign, the ++auto assembly is disallowed. If no match is found, the auto assembly ++is allowed. ++ ++If the metadata indicates that the array was created for ++.I this ++host, and the word ++.I homehost ++appears before any other match, then the array is treated as a valid ++candidate for auto-assembly. ++ ++This can be used to disable all auto-assembly (so that only arrays ++explicitly listed in mdadm.conf or on the command line are assembled), ++or to disable assembly of certain metadata types which might be ++handled by other software. It can also be used to disable assembly of ++all foreign arrays - normally such arrays are assembled but given a ++non-deterministic name in ++.BR /dev/md/ . ++ ++The known metadata types are ++.BR 0.90 , ++.BR 1.x , ++.BR ddf , ++.BR imsm . ++ ++.B AUTO ++should be given at most once. Subsequent lines are silently ignored. ++Thus an earlier config file in a config directory will over-ride ++the setting in a later config file. ++ ++.TP ++.B POLICY ++This is used to specify what automatic behavior is allowed on devices ++newly appearing in the system and provides a way of marking spares that can ++be moved to other arrays as well as the migration domains. ++.I Domain ++can be defined through ++.I policy ++line by specifying a domain name for a number of paths from ++.BR /dev/disk/by-path/ . ++A device may belong to several domains. The domain of an array is a union ++of domains of all devices in that array. A spare can be automatically ++moved from one array to another if the set of the destination array's ++.I domains ++contains all the ++.I domains ++of the new disk or if both arrays have the same ++.IR spare-group . ++ ++To update hot plug configuration it is necessary to execute ++.B mdadm \-\-udev\-rules ++command after changing the config file ++ ++Keywords used in the ++.I POLICY ++line and supported values are: ++ ++.RS 4 ++.TP ++.B domain= ++any arbitrary string ++.TP ++.B metadata= ++0.9 1.x ddf or imsm ++.TP ++.B path= ++file glob matching anything from ++.B /dev/disk/by-path ++.TP ++.B type= ++either ++.B disk ++or ++.BR part . ++.TP ++.B action= ++include, re-add, spare, spare-same-slot, or force-spare ++.TP ++.B auto= ++yes, no, or homehost. ++ ++.P ++The ++.I action ++item determines the automatic behavior allowed for devices matching the ++.I path ++and ++.I type ++in the same line. If a device matches several lines with different ++.I actions ++then the most permissive will apply. The ordering of policy lines ++is irrelevant to the end result. ++.TP ++.B include ++allows adding a disk to an array if metadata on that disk matches that array ++.TP ++.B re\-add ++will include the device in the array if it appears to be a current member ++or a member that was recently removed and the array has a ++write-intent-bitmap to allow the ++.B re\-add ++functionality. ++.TP ++.B spare ++as above and additionally: if the device is bare it can ++become a spare if there is any array that it is a candidate for based ++on domains and metadata. ++.TP ++.B spare\-same\-slot ++as above and additionally if given slot was used by an array that went ++degraded recently and the device plugged in has no metadata then it will ++be automatically added to that array (or it's container) ++.TP ++.B force\-spare ++as above and the disk will become a spare in remaining cases ++.RE ++ ++.TP ++.B PART-POLICY ++This is similar to ++.B POLICY ++and accepts the same keyword assignments. It allows a consistent set ++of policies to applied to each of the partitions of a device. ++ ++A ++.B PART-POLICY ++line should set ++.I type=disk ++and identify the path to one or more disk devices. Each partition on ++these disks will be treated according to the ++.I action= ++setting from this line. If a ++.I domain ++is set in the line, then the domain associated with each patition will ++be based on the domain, but with ++.RB \(dq -part N\(dq ++appended, when N is the partition number for the partition that was ++found. ++ ++.TP ++.B SYSFS ++The ++.B SYSFS ++line lists custom values of MD device's sysfs attributes which will be ++stored in sysfs after the array is assembled. Multiple lines are allowed and each ++line has to contain the uuid or the name of the device to which it relates. ++.RS 4 ++.TP ++.B uuid= ++hexadecimal identifier of MD device. This has to match the uuid stored in the ++superblock. ++.TP ++.B name= ++name of the MD device as was given to ++.I mdadm ++when the array was created. It will be ignored if ++.B uuid ++is not empty. ++.RE ++ ++.TP ++.B MONITORDELAY ++The ++.B monitordelay ++line gives a delay in seconds ++.I mdadm ++shall wait before pooling md arrays ++when ++.I mdadm ++is running in ++.B \-\-monitor ++mode. ++.B \-d/\-\-delay ++command line argument takes precedence over the config file ++ ++.SH EXAMPLE ++DEVICE /dev/sd[bcdjkl]1 ++.br ++DEVICE /dev/hda1 /dev/hdb1 ++ ++# /dev/md0 is known by its UUID. ++.br ++ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371 ++.br ++# /dev/md1 contains all devices with a minor number of ++.br ++# 1 in the superblock. ++.br ++ARRAY /dev/md1 superminor=1 ++.br ++# /dev/md2 is made from precisely these two devices ++.br ++ARRAY /dev/md2 devices=/dev/hda1,/dev/hdb1 ++ ++# /dev/md4 and /dev/md5 are a spare-group and spares ++.br ++# can be moved between them ++.br ++ARRAY /dev/md4 uuid=b23f3c6d:aec43a9f:fd65db85:369432df ++.br ++ spare\-group=group1 ++.br ++ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977 ++.br ++ spare\-group=group1 ++.br ++# /dev/md/home is created if need to be a partitionable md array ++.br ++# any spare device number is allocated. ++.br ++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 ++.br ++POLICY domain=domain1 metadata=imsm path=pci-0000:04:00.0-scsi-[01]* ++.br ++ action=include ++.br ++# One domain comprising of devices attached to specified paths is defined. ++.br ++# Bare device matching first path will be made an imsm spare on hot plug. ++.br ++# If more than one array is created on devices belonging to domain1 and ++.br ++# one of them becomes degraded, then any imsm spare matching any path for ++.br ++# given domain name can be migrated. ++.br ++MAILADDR root@mydomain.tld ++.br ++PROGRAM /usr/sbin/handle\-mdadm\-events ++.br ++CREATE group=system mode=0640 auto=part\-8 ++.br ++HOMEHOST ++.br ++AUTO +1.x homehost \-all ++.br ++SYSFS name=/dev/md/raid5 group_thread_cnt=4 sync_speed_max=1000000 ++.br ++SYSFS uuid=bead5eb6:31c17a27:da120ba2:7dfda40d group_thread_cnt=4 ++sync_speed_max=1000000 ++.br ++MONITORDELAY 60 ++ ++.SH SEE ALSO ++.BR mdadm (8), ++.BR md (4). +-- +2.31.1 + diff --git a/0007-mdadm-Update-ReadMe.patch b/0007-mdadm-Update-ReadMe.patch new file mode 100644 index 0000000..90ce556 --- /dev/null +++ b/0007-mdadm-Update-ReadMe.patch @@ -0,0 +1,48 @@ +From c23400377bb3d8e98e810cd92dba478dac1dff82 Mon Sep 17 00:00:00 2001 +From: Lukasz Florczak +Date: Fri, 18 Mar 2022 09:26:05 +0100 +Subject: [PATCH 07/12] mdadm: Update ReadMe + +Instead of hardcoded config file path give reference to config manual. + +Add missing monitordelay and homecluster parameters. + +Signed-off-by: Lukasz Florczak +Acked-by: Coly Li +Signed-off-by: Jes Sorensen +--- + ReadMe.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/ReadMe.c b/ReadMe.c +index 81399765..8f873c48 100644 +--- a/ReadMe.c ++++ b/ReadMe.c +@@ -613,7 +613,6 @@ char Help_incr[] = + ; + + char Help_config[] = +-"The /etc/mdadm.conf config file:\n\n" + " The config file contains, apart from blank lines and comment lines that\n" + " start with a hash(#), array lines, device lines, and various\n" + " configuration lines.\n" +@@ -636,10 +635,12 @@ char Help_config[] = + " than a device must match all of them to be considered.\n" + "\n" + " Other configuration lines include:\n" +-" mailaddr, mailfrom, program used for --monitor mode\n" +-" create, auto used when creating device names in /dev\n" +-" homehost, policy, part-policy used to guide policy in various\n" +-" situations\n" ++" mailaddr, mailfrom, program, monitordelay used for --monitor mode\n" ++" create, auto used when creating device names in /dev\n" ++" homehost, homecluster, policy, part-policy used to guide policy in various\n" ++" situations\n" ++"\n" ++"For more details see mdadm.conf(5).\n" + "\n" + ; + +-- +2.31.1 + diff --git a/0008-mdadm-Update-config-man-regarding-default-files-and-.patch b/0008-mdadm-Update-config-man-regarding-default-files-and-.patch new file mode 100644 index 0000000..8375fd9 --- /dev/null +++ b/0008-mdadm-Update-config-man-regarding-default-files-and-.patch @@ -0,0 +1,203 @@ +From 24e075c659d0a8718aabefe5af4c97195a188af7 Mon Sep 17 00:00:00 2001 +From: Lukasz Florczak +Date: Fri, 18 Mar 2022 09:26:06 +0100 +Subject: [PATCH 08/12] mdadm: Update config man regarding default files and + multi-keyword behavior + +Simplify default and alternative config file and directory location references +from mdadm(8) as references to mdadm.conf(5). Add FILE section in config man +and explain order and conditions in which default and alternative config files +and directories are used. + +Update config man behavior regarding parsing order when multiple keywords/config +files are involved. + +Signed-off-by: Lukasz Florczak +Acked-by: Coly Li +Signed-off-by: Jes Sorensen +--- + mdadm.8.in | 30 +++++++++-------------- + mdadm.conf.5.in | 65 ++++++++++++++++++++++++++++++++++++++++++++----- + 2 files changed, 71 insertions(+), 24 deletions(-) + +diff --git a/mdadm.8.in b/mdadm.8.in +index 8b21ffd4..0be02e4a 100644 +--- a/mdadm.8.in ++++ b/mdadm.8.in +@@ -266,14 +266,11 @@ the exact meaning of this option in different contexts. + + .TP + .BR \-c ", " \-\-config= +-Specify the config file or directory. Default is to use +-.B {CONFFILE} +-and +-.BR {CONFFILE}.d , +-or if those are missing then +-.B {CONFFILE2} +-and +-.BR {CONFFILE2}.d . ++Specify the config file or directory. If not specified, default config file ++and default conf.d directory will be used. See ++.BR mdadm.conf (5) ++for more details. ++ + If the config file given is + .B "partitions" + then nothing will be read, but +@@ -2013,11 +2010,9 @@ The config file is only used if explicitly named with + .B \-\-config + or requested with (a possibly implicit) + .BR \-\-scan . +-In the later case, +-.B {CONFFILE} +-or +-.B {CONFFILE2} +-is used. ++In the later case, default config file is used. See ++.BR mdadm.conf (5) ++for more details. + + If + .B \-\-scan +@@ -3346,16 +3341,15 @@ on Monitor mode. + + .SS {CONFFILE} (or {CONFFILE2}) + +-The config file lists which devices may be scanned to see if +-they contain MD super block, and gives identifying information +-(e.g. UUID) about known MD arrays. See ++Default config file. See + .BR mdadm.conf (5) + for more details. + + .SS {CONFFILE}.d (or {CONFFILE2}.d) + +-A directory containing configuration files which are read in lexical +-order. ++Default directory containing configuration files. See ++.BR mdadm.conf (5) ++for more details. + + .SS {MAP_PATH} + When +diff --git a/mdadm.conf.5.in b/mdadm.conf.5.in +index 83edd008..dd331a6a 100644 +--- a/mdadm.conf.5.in ++++ b/mdadm.conf.5.in +@@ -88,7 +88,8 @@ but only the major and minor device numbers. It scans + .I /dev + to find the name that matches the numbers. + +-If no DEVICE line is present, then "DEVICE partitions containers" is assumed. ++If no DEVICE line is present in any config file, ++then "DEVICE partitions containers" is assumed. + + For example: + .IP +@@ -272,6 +273,10 @@ catenated with spaces to form the address. + Note that this value cannot be set via the + .I mdadm + commandline. It is only settable via the config file. ++There should only be one ++.B MAILADDR ++line and it should have only one address. Any subsequent addresses ++are silently ignored. + + .TP + .B PROGRAM +@@ -286,7 +291,8 @@ device. + + There should only be one + .B program +-line and it should be give only one program. ++line and it should be given only one program. Any subsequent programs ++are silently ignored. + + + .TP +@@ -295,7 +301,14 @@ The + .B create + line gives default values to be used when creating arrays, new members + of arrays, and device entries for arrays. +-These include: ++ ++There should only be one ++.B create ++line. Any subsequent lines will override the previous settings. ++ ++Keywords used in the ++.I CREATE ++line and supported values are: + + .RS 4 + .TP +@@ -475,8 +488,8 @@ The known metadata types are + + .B AUTO + should be given at most once. Subsequent lines are silently ignored. +-Thus an earlier config file in a config directory will over-ride +-the setting in a later config file. ++Thus a later config file in a config directory will not overwrite ++the setting in an earlier config file. + + .TP + .B POLICY +@@ -594,6 +607,7 @@ The + line lists custom values of MD device's sysfs attributes which will be + stored in sysfs after the array is assembled. Multiple lines are allowed and each + line has to contain the uuid or the name of the device to which it relates. ++Lines are applied in reverse order. + .RS 4 + .TP + .B uuid= +@@ -621,7 +635,46 @@ is running in + .B \-\-monitor + mode. + .B \-d/\-\-delay +-command line argument takes precedence over the config file ++command line argument takes precedence over the config file. ++ ++If multiple ++.B MINITORDELAY ++lines are provided, only first non-zero value is considered. ++ ++.SH FILES ++ ++.SS {CONFFILE} ++ ++The default config file location, used when ++.I mdadm ++is running without --config option. ++ ++.SS {CONFFILE}.d ++ ++The default directory with config files. Used when ++.I mdadm ++is running without --config option, after successful reading of the ++.B {CONFFILE} ++default config file. Files in that directory ++are read in lexical order. ++ ++ ++.SS {CONFFILE2} ++ ++Alternative config file that is read, when ++.I mdadm ++is running without --config option and the ++.B {CONFFILE} ++default config file was not opened successfully. ++ ++.SS {CONFFILE2}.d ++ ++The alternative directory with config files. Used when ++.I mdadm ++is runninng without --config option, after reading the ++.B {CONFFILE2} ++alternative config file whether it was successful or not. Files in ++that directory are read in lexical order. + + .SH EXAMPLE + DEVICE /dev/sd[bcdjkl]1 +-- +2.31.1 + diff --git a/0009-mdadm-Update-config-manual.patch b/0009-mdadm-Update-config-manual.patch new file mode 100644 index 0000000..313b2c9 --- /dev/null +++ b/0009-mdadm-Update-config-manual.patch @@ -0,0 +1,45 @@ +From c33bbda5b0e127bb161fd4ad44bcfaa2a5daf153 Mon Sep 17 00:00:00 2001 +From: Lukasz Florczak +Date: Fri, 18 Mar 2022 09:26:07 +0100 +Subject: [PATCH 09/12] mdadm: Update config manual + +Add missing HOMECLUSTER keyword description. + +Signed-off-by: Lukasz Florczak +Acked-by: Coly Li +Signed-off-by: Jes Sorensen +--- + mdadm.conf.5.in | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/mdadm.conf.5.in b/mdadm.conf.5.in +index dd331a6a..cd4e6a9d 100644 +--- a/mdadm.conf.5.in ++++ b/mdadm.conf.5.in +@@ -439,6 +439,23 @@ from any possible local name. e.g. + .B /dev/md/1_1 + or + .BR /dev/md/home_0 . ++ ++.TP ++.B HOMECLUSTER ++The ++.B homcluster ++line gives a default value for the ++.B \-\-homecluster= ++option to mdadm. It specifies the cluster name for the md device. ++The md device can be assembled only on the cluster which matches ++the name specified. If ++.B homcluster ++is not provided, mdadm tries to detect the cluster name automatically. ++ ++There should only be one ++.B homecluster ++line. Any subsequent lines will be silently ignored. ++ + .TP + .B AUTO + A list of names of metadata format can be given, each preceded by a +-- +2.31.1 + diff --git a/0010-Create-Build-use-default_layout.patch b/0010-Create-Build-use-default_layout.patch new file mode 100644 index 0000000..a15ae3e --- /dev/null +++ b/0010-Create-Build-use-default_layout.patch @@ -0,0 +1,153 @@ +From 913f07d1db4a0078acc26d6ccabe1c315cf9273c Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +Date: Thu, 20 Jan 2022 13:18:32 +0100 +Subject: [PATCH 10/12] Create, Build: use default_layout() + +This code is duplicated for Build mode so make default_layout() extern +and use it. Simplify the function structure. + +It introduced change for Build mode, now for raid0 RAID0_ORIG_LAYOUT +will be returned same as for Create. + +Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Jes Sorensen +--- + Build.c | 23 +------------------ + Create.c | 67 ++++++++++++++++++++++++++++++++++---------------------- + mdadm.h | 1 + + 3 files changed, 43 insertions(+), 48 deletions(-) + +diff --git a/Build.c b/Build.c +index 962c2e37..8d6f6f58 100644 +--- a/Build.c ++++ b/Build.c +@@ -71,28 +71,7 @@ int Build(char *mddev, struct mddev_dev *devlist, + } + + if (s->layout == UnSet) +- switch(s->level) { +- default: /* no layout */ +- s->layout = 0; +- break; +- case 10: +- s->layout = 0x102; /* near=2, far=1 */ +- if (c->verbose > 0) +- pr_err("layout defaults to n1\n"); +- break; +- case 5: +- case 6: +- s->layout = map_name(r5layout, "default"); +- if (c->verbose > 0) +- pr_err("layout defaults to %s\n", map_num(r5layout, s->layout)); +- break; +- case LEVEL_FAULTY: +- s->layout = map_name(faultylayout, "default"); +- +- if (c->verbose > 0) +- pr_err("layout defaults to %s\n", map_num(faultylayout, s->layout)); +- break; +- } ++ s->layout = default_layout(NULL, s->level, c->verbose); + + /* We need to create the device. It can have no name. */ + map_lock(&map); +diff --git a/Create.c b/Create.c +index 0ff1922d..9ea19de0 100644 +--- a/Create.c ++++ b/Create.c +@@ -39,39 +39,54 @@ static int round_size_and_verify(unsigned long long *size, int chunk) + return 0; + } + +-static int default_layout(struct supertype *st, int level, int verbose) ++/** ++ * default_layout() - Get default layout for level. ++ * @st: metadata requested, could be NULL. ++ * @level: raid level requested. ++ * @verbose: verbose level. ++ * ++ * Try to ask metadata handler first, otherwise use global defaults. ++ * ++ * Return: Layout or &UnSet, return value meaning depends of level used. ++ */ ++int default_layout(struct supertype *st, int level, int verbose) + { + int layout = UnSet; ++ mapping_t *layout_map = NULL; ++ char *layout_name = NULL; + + if (st && st->ss->default_geometry) + st->ss->default_geometry(st, &level, &layout, NULL); + +- if (layout == UnSet) +- switch(level) { +- default: /* no layout */ +- layout = 0; +- break; +- case 0: +- layout = RAID0_ORIG_LAYOUT; +- break; +- case 10: +- layout = 0x102; /* near=2, far=1 */ +- if (verbose > 0) +- pr_err("layout defaults to n2\n"); +- break; +- case 5: +- case 6: +- layout = map_name(r5layout, "default"); +- if (verbose > 0) +- pr_err("layout defaults to %s\n", map_num(r5layout, layout)); +- break; +- case LEVEL_FAULTY: +- layout = map_name(faultylayout, "default"); ++ if (layout != UnSet) ++ return layout; + +- if (verbose > 0) +- pr_err("layout defaults to %s\n", map_num(faultylayout, layout)); +- break; +- } ++ switch (level) { ++ default: /* no layout */ ++ layout = 0; ++ break; ++ case 0: ++ layout = RAID0_ORIG_LAYOUT; ++ break; ++ case 10: ++ layout = 0x102; /* near=2, far=1 */ ++ layout_name = "n2"; ++ break; ++ case 5: ++ case 6: ++ layout_map = r5layout; ++ break; ++ case LEVEL_FAULTY: ++ layout_map = faultylayout; ++ break; ++ } ++ ++ if (layout_map) { ++ layout = map_name(layout_map, "default"); ++ layout_name = map_num(layout_map, layout); ++ } ++ if (layout_name && verbose > 0) ++ pr_err("layout defaults to %s\n", layout_name); + + return layout; + } +diff --git a/mdadm.h b/mdadm.h +index 26e7e5cd..cd72e711 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -1512,6 +1512,7 @@ extern int get_linux_version(void); + extern int mdadm_version(char *version); + extern unsigned long long parse_size(char *size); + extern int parse_uuid(char *str, int uuid[4]); ++int default_layout(struct supertype *st, int level, int verbose); + extern int is_near_layout_10(int layout); + extern int parse_layout_10(char *layout); + extern int parse_layout_faulty(char *layout); +-- +2.31.1 + diff --git a/0011-mdadm-add-map_num_s.patch b/0011-mdadm-add-map_num_s.patch new file mode 100644 index 0000000..196d47d --- /dev/null +++ b/0011-mdadm-add-map_num_s.patch @@ -0,0 +1,382 @@ +From 5f21d67472ad08c1e96b4385254adba79aa1c467 Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +Date: Thu, 20 Jan 2022 13:18:33 +0100 +Subject: [PATCH 11/12] mdadm: add map_num_s() + +map_num() returns NULL if key is not defined. This patch adds +alternative, non NULL version for cases where NULL is not expected. + +There are many printf() calls where map_num() is called on variable +without NULL verification. It works, even if NULL is passed because +gcc is able to ignore NULL argument quietly but the behavior is +undefined. For safety reasons such usages will use map_num_s() now. +It is a potential point of regression. + +Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Jes Sorensen +--- + Assemble.c | 6 ++---- + Create.c | 2 +- + Detail.c | 4 ++-- + Grow.c | 16 ++++++++-------- + Query.c | 4 ++-- + maps.c | 24 ++++++++++++++++++++++++ + mdadm.c | 20 ++++++++++---------- + mdadm.h | 2 +- + super-ddf.c | 6 +++--- + super-intel.c | 2 +- + super0.c | 2 +- + super1.c | 2 +- + sysfs.c | 9 +++++---- + 13 files changed, 61 insertions(+), 38 deletions(-) + +diff --git a/Assemble.c b/Assemble.c +index 704b8293..9eac9ce0 100644 +--- a/Assemble.c ++++ b/Assemble.c +@@ -63,7 +63,7 @@ static void set_array_assembly_status(struct context *c, + struct assembly_array_info *arr) + { + int raid_disks = arr->preexist_cnt + arr->new_cnt; +- char *status_msg = map_num(assemble_statuses, status); ++ char *status_msg = map_num_s(assemble_statuses, status); + + if (c->export && result) + *result |= status; +@@ -77,9 +77,7 @@ static void set_array_assembly_status(struct context *c, + fprintf(stderr, " (%d new)", arr->new_cnt); + if (arr->exp_cnt) + fprintf(stderr, " ( + %d for expansion)", arr->exp_cnt); +- if (status_msg) +- fprintf(stderr, " %s", status_msg); +- fprintf(stderr, ".\n"); ++ fprintf(stderr, " %s.\n", status_msg); + } + + static int name_matches(char *found, char *required, char *homehost, int require_homehost) +diff --git a/Create.c b/Create.c +index 9ea19de0..c84c1ac8 100644 +--- a/Create.c ++++ b/Create.c +@@ -83,7 +83,7 @@ int default_layout(struct supertype *st, int level, int verbose) + + if (layout_map) { + layout = map_name(layout_map, "default"); +- layout_name = map_num(layout_map, layout); ++ layout_name = map_num_s(layout_map, layout); + } + if (layout_name && verbose > 0) + pr_err("layout defaults to %s\n", layout_name); +diff --git a/Detail.c b/Detail.c +index 95d4cc70..ce7a8445 100644 +--- a/Detail.c ++++ b/Detail.c +@@ -495,8 +495,8 @@ int Detail(char *dev, struct context *c) + if (array.state & (1 << MD_SB_CLEAN)) { + if ((array.level == 0) || + (array.level == LEVEL_LINEAR)) +- arrayst = map_num(sysfs_array_states, +- sra->array_state); ++ arrayst = map_num_s(sysfs_array_states, ++ sra->array_state); + else + arrayst = "clean"; + } else { +diff --git a/Grow.c b/Grow.c +index 18c5719b..8a242b0f 100644 +--- a/Grow.c ++++ b/Grow.c +@@ -547,7 +547,7 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha + if (s->consistency_policy != CONSISTENCY_POLICY_RESYNC && + s->consistency_policy != CONSISTENCY_POLICY_PPL) { + pr_err("Operation not supported for consistency policy %s\n", +- map_num(consistency_policies, s->consistency_policy)); ++ map_num_s(consistency_policies, s->consistency_policy)); + return 1; + } + +@@ -578,14 +578,14 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha + + if (sra->consistency_policy == (unsigned)s->consistency_policy) { + pr_err("Consistency policy is already %s\n", +- map_num(consistency_policies, s->consistency_policy)); ++ map_num_s(consistency_policies, s->consistency_policy)); + ret = 1; + goto free_info; + } else if (sra->consistency_policy != CONSISTENCY_POLICY_RESYNC && + sra->consistency_policy != CONSISTENCY_POLICY_PPL) { + pr_err("Current consistency policy is %s, cannot change to %s\n", +- map_num(consistency_policies, sra->consistency_policy), +- map_num(consistency_policies, s->consistency_policy)); ++ map_num_s(consistency_policies, sra->consistency_policy), ++ map_num_s(consistency_policies, s->consistency_policy)); + ret = 1; + goto free_info; + } +@@ -704,8 +704,8 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha + } + + ret = sysfs_set_str(sra, NULL, "consistency_policy", +- map_num(consistency_policies, +- s->consistency_policy)); ++ map_num_s(consistency_policies, ++ s->consistency_policy)); + if (ret) + pr_err("Failed to change array consistency policy\n"); + +@@ -2241,7 +2241,7 @@ size_change_error: + info.new_layout = UnSet; + if (info.array.level == 6 && info.new_level == UnSet) { + char l[40], *h; +- strcpy(l, map_num(r6layout, info.array.layout)); ++ strcpy(l, map_num_s(r6layout, info.array.layout)); + h = strrchr(l, '-'); + if (h && strcmp(h, "-6") == 0) { + *h = 0; +@@ -2266,7 +2266,7 @@ size_change_error: + info.new_layout = info.array.layout; + else if (info.array.level == 5 && info.new_level == 6) { + char l[40]; +- strcpy(l, map_num(r5layout, info.array.layout)); ++ strcpy(l, map_num_s(r5layout, info.array.layout)); + strcat(l, "-6"); + info.new_layout = map_name(r6layout, l); + } else { +diff --git a/Query.c b/Query.c +index 23fbf8aa..adcd231e 100644 +--- a/Query.c ++++ b/Query.c +@@ -93,7 +93,7 @@ int Query(char *dev) + else { + printf("%s: %s %s %d devices, %d spare%s. Use mdadm --detail for more detail.\n", + dev, human_size_brief(larray_size,IEC), +- map_num(pers, level), raid_disks, ++ map_num_s(pers, level), raid_disks, + spare_disks, spare_disks == 1 ? "" : "s"); + } + st = guess_super(fd); +@@ -131,7 +131,7 @@ int Query(char *dev) + dev, + info.disk.number, info.array.raid_disks, + activity, +- map_num(pers, info.array.level), ++ map_num_s(pers, info.array.level), + mddev); + if (st->ss == &super0) + put_md_name(mddev); +diff --git a/maps.c b/maps.c +index a4fd2797..20fcf719 100644 +--- a/maps.c ++++ b/maps.c +@@ -166,6 +166,30 @@ mapping_t sysfs_array_states[] = { + { NULL, ARRAY_UNKNOWN_STATE } + }; + ++/** ++ * map_num_s() - Safer alternative of map_num() function. ++ * @map: map to search. ++ * @num: key to match. ++ * ++ * Shall be used only if key existence is quaranted. ++ * ++ * Return: Pointer to name of the element. ++ */ ++char *map_num_s(mapping_t *map, int num) ++{ ++ char *ret = map_num(map, num); ++ ++ assert(ret); ++ return ret; ++} ++ ++/** ++ * map_num() - get element name by key. ++ * @map: map to search. ++ * @num: key to match. ++ * ++ * Return: Pointer to name of the element or NULL. ++ */ + char *map_num(mapping_t *map, int num) + { + while (map->name) { +diff --git a/mdadm.c b/mdadm.c +index 26299b2e..be40686c 100644 +--- a/mdadm.c ++++ b/mdadm.c +@@ -280,8 +280,8 @@ int main(int argc, char *argv[]) + else + fprintf(stderr, "-%c", opt); + fprintf(stderr, " would set mdadm mode to \"%s\", but it is already set to \"%s\".\n", +- map_num(modes, newmode), +- map_num(modes, mode)); ++ map_num_s(modes, newmode), ++ map_num_s(modes, mode)); + exit(2); + } else if (!mode && newmode) { + mode = newmode; +@@ -544,7 +544,7 @@ int main(int argc, char *argv[]) + switch(s.level) { + default: + pr_err("layout not meaningful for %s arrays.\n", +- map_num(pers, s.level)); ++ map_num_s(pers, s.level)); + exit(2); + case UnSet: + pr_err("raid level must be given before layout.\n"); +@@ -1248,10 +1248,10 @@ int main(int argc, char *argv[]) + if (option_index > 0) + pr_err(":option --%s not valid in %s mode\n", + long_options[option_index].name, +- map_num(modes, mode)); ++ map_num_s(modes, mode)); + else + pr_err("option -%c not valid in %s mode\n", +- opt, map_num(modes, mode)); ++ opt, map_num_s(modes, mode)); + exit(2); + + } +@@ -1276,7 +1276,7 @@ int main(int argc, char *argv[]) + if (s.consistency_policy != CONSISTENCY_POLICY_UNKNOWN && + s.consistency_policy != CONSISTENCY_POLICY_JOURNAL) { + pr_err("--write-journal is not supported with consistency policy: %s\n", +- map_num(consistency_policies, s.consistency_policy)); ++ map_num_s(consistency_policies, s.consistency_policy)); + exit(2); + } + } +@@ -1285,12 +1285,12 @@ int main(int argc, char *argv[]) + s.consistency_policy != CONSISTENCY_POLICY_UNKNOWN) { + if (s.level <= 0) { + pr_err("--consistency-policy not meaningful with level %s.\n", +- map_num(pers, s.level)); ++ map_num_s(pers, s.level)); + exit(2); + } else if (s.consistency_policy == CONSISTENCY_POLICY_JOURNAL && + !s.journaldisks) { + pr_err("--write-journal is required for consistency policy: %s\n", +- map_num(consistency_policies, s.consistency_policy)); ++ map_num_s(consistency_policies, s.consistency_policy)); + exit(2); + } else if (s.consistency_policy == CONSISTENCY_POLICY_PPL && + s.level != 5) { +@@ -1300,14 +1300,14 @@ int main(int argc, char *argv[]) + (!s.bitmap_file || + strcmp(s.bitmap_file, "none") == 0)) { + pr_err("--bitmap is required for consistency policy: %s\n", +- map_num(consistency_policies, s.consistency_policy)); ++ map_num_s(consistency_policies, s.consistency_policy)); + exit(2); + } else if (s.bitmap_file && + strcmp(s.bitmap_file, "none") != 0 && + s.consistency_policy != CONSISTENCY_POLICY_BITMAP && + s.consistency_policy != CONSISTENCY_POLICY_JOURNAL) { + pr_err("--bitmap is not compatible with consistency policy: %s\n", +- map_num(consistency_policies, s.consistency_policy)); ++ map_num_s(consistency_policies, s.consistency_policy)); + exit(2); + } + } +diff --git a/mdadm.h b/mdadm.h +index cd72e711..09915a00 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -770,7 +770,7 @@ extern int restore_stripes(int *dest, unsigned long long *offsets, + #endif + + #define SYSLOG_FACILITY LOG_DAEMON +- ++extern char *map_num_s(mapping_t *map, int num); + extern char *map_num(mapping_t *map, int num); + extern int map_name(mapping_t *map, char *name); + extern mapping_t r0layout[], r5layout[], r6layout[], +diff --git a/super-ddf.c b/super-ddf.c +index 3f304cdc..8cda23a7 100644 +--- a/super-ddf.c ++++ b/super-ddf.c +@@ -1477,13 +1477,13 @@ static void examine_vds(struct ddf_super *sb) + printf("\n"); + printf(" unit[%d] : %d\n", i, be16_to_cpu(ve->unit)); + printf(" state[%d] : %s, %s%s\n", i, +- map_num(ddf_state, ve->state & 7), ++ map_num_s(ddf_state, ve->state & 7), + (ve->state & DDF_state_morphing) ? "Morphing, ": "", + (ve->state & DDF_state_inconsistent)? "Not Consistent" : "Consistent"); + printf(" init state[%d] : %s\n", i, +- map_num(ddf_init_state, ve->init_state&DDF_initstate_mask)); ++ map_num_s(ddf_init_state, ve->init_state & DDF_initstate_mask)); + printf(" access[%d] : %s\n", i, +- map_num(ddf_access, (ve->init_state & DDF_access_mask) >> 6)); ++ map_num_s(ddf_access, (ve->init_state & DDF_access_mask) >> 6)); + printf(" Name[%d] : %.16s\n", i, ve->name); + examine_vd(i, sb, ve->guid); + } +diff --git a/super-intel.c b/super-intel.c +index 6ff336ee..ba3bd41f 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -5625,7 +5625,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info, + free(dev); + free(dv); + pr_err("imsm does not support consistency policy %s\n", +- map_num(consistency_policies, s->consistency_policy)); ++ map_num_s(consistency_policies, s->consistency_policy)); + return 0; + } + +diff --git a/super0.c b/super0.c +index b79b97a9..61c9ec1d 100644 +--- a/super0.c ++++ b/super0.c +@@ -288,7 +288,7 @@ static void export_examine_super0(struct supertype *st) + { + mdp_super_t *sb = st->sb; + +- printf("MD_LEVEL=%s\n", map_num(pers, sb->level)); ++ printf("MD_LEVEL=%s\n", map_num_s(pers, sb->level)); + printf("MD_DEVICES=%d\n", sb->raid_disks); + if (sb->minor_version >= 90) + printf("MD_UUID=%08x:%08x:%08x:%08x\n", +diff --git a/super1.c b/super1.c +index a12a5bc8..e3e2f954 100644 +--- a/super1.c ++++ b/super1.c +@@ -671,7 +671,7 @@ static void export_examine_super1(struct supertype *st) + int len = 32; + int layout; + +- printf("MD_LEVEL=%s\n", map_num(pers, __le32_to_cpu(sb->level))); ++ printf("MD_LEVEL=%s\n", map_num_s(pers, __le32_to_cpu(sb->level))); + printf("MD_DEVICES=%d\n", __le32_to_cpu(sb->raid_disks)); + for (i = 0; i < 32; i++) + if (sb->set_name[i] == '\n' || sb->set_name[i] == '\0') { +diff --git a/sysfs.c b/sysfs.c +index 2995713d..0d98a65f 100644 +--- a/sysfs.c ++++ b/sysfs.c +@@ -689,7 +689,7 @@ int sysfs_set_array(struct mdinfo *info, int vers) + if (info->array.level < 0) + return 0; /* FIXME */ + rv |= sysfs_set_str(info, NULL, "level", +- map_num(pers, info->array.level)); ++ map_num_s(pers, info->array.level)); + if (info->reshape_active && info->delta_disks != UnSet) + raid_disks -= info->delta_disks; + rv |= sysfs_set_num(info, NULL, "raid_disks", raid_disks); +@@ -724,9 +724,10 @@ int sysfs_set_array(struct mdinfo *info, int vers) + } + + if (info->consistency_policy == CONSISTENCY_POLICY_PPL) { +- if (sysfs_set_str(info, NULL, "consistency_policy", +- map_num(consistency_policies, +- info->consistency_policy))) { ++ char *policy = map_num_s(consistency_policies, ++ info->consistency_policy); ++ ++ if (sysfs_set_str(info, NULL, "consistency_policy", policy)) { + pr_err("This kernel does not support PPL. Falling back to consistency-policy=resync.\n"); + info->consistency_policy = CONSISTENCY_POLICY_RESYNC; + } +-- +2.31.1 + diff --git a/0012-mdadm-systemd-remove-KillMode-none-from-service-file.patch b/0012-mdadm-systemd-remove-KillMode-none-from-service-file.patch new file mode 100644 index 0000000..dafe87a --- /dev/null +++ b/0012-mdadm-systemd-remove-KillMode-none-from-service-file.patch @@ -0,0 +1,69 @@ +From 52c67fcdd6dadc4138ecad73e65599551804d445 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Tue, 15 Feb 2022 21:34:15 +0800 +Subject: [PATCH 12/12] mdadm/systemd: remove KillMode=none from service file + +For mdadm's systemd configuration, current systemd KillMode is "none" in +following service files, +- mdadm-grow-continue@.service +- mdmon@.service + +This "none" mode is strongly againsted by systemd developers (see man 5 +systemd.kill for "KillMode=" section), and is considering to remove in +future systemd version. + +As systemd developer explained in disuccsion, the systemd kill process +is, +1. send the signal specified by KillSignal= to the list of processes (if + any), TERM is the default +2. wait until either the target of process(es) exit or a timeout expires +3. if the timeout expires send the signal specified by FinalKillSignal=, + KILL is the default + +For "control-group", all remaining processes will receive the SIGTERM +signal (by default) and if there are still processes after a period f +time, they will get the SIGKILL signal. + +For "mixed", only the main process will receive the SIGTERM signal, and +if there are still processes after a period of time, all remaining +processes (including the main one) will receive the SIGKILL signal. + +From the above comment, currently KillMode=control-group is a proper +kill mode. Since control-gropu is the default kill mode, the fix can be +simply removing KillMode=none line from the service file, then the +default mode will take effect. + +Signed-off-by: Coly Li +Cc: Benjamin Brunner +Cc: Franck Bui +Cc: Jes Sorensen +Cc: Mariusz Tkaczyk +Cc: Neil Brown +Cc: Xiao Ni +Signed-off-by: Jes Sorensen +--- + systemd/mdadm-grow-continue@.service | 1 - + systemd/mdmon@.service | 1 - + 2 files changed, 2 deletions(-) + +diff --git a/systemd/mdadm-grow-continue@.service b/systemd/mdadm-grow-continue@.service +index 5c667d2a..9fdc8ec7 100644 +--- a/systemd/mdadm-grow-continue@.service ++++ b/systemd/mdadm-grow-continue@.service +@@ -14,4 +14,3 @@ ExecStart=BINDIR/mdadm --grow --continue /dev/%I + StandardInput=null + StandardOutput=null + StandardError=null +-KillMode=none +diff --git a/systemd/mdmon@.service b/systemd/mdmon@.service +index 85a3a7c5..77533958 100644 +--- a/systemd/mdmon@.service ++++ b/systemd/mdmon@.service +@@ -25,4 +25,3 @@ Type=forking + # it out) and systemd will remove it when transitioning from + # initramfs to rootfs. + #PIDFile=/run/mdadm/%I.pid +-KillMode=none +-- +2.31.1 + diff --git a/0001-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch b/Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch similarity index 100% rename from 0001-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch rename to Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch diff --git a/mdadm.spec b/mdadm.spec index cf23fc5..c9e9dc9 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -2,7 +2,7 @@ Summary: The mdadm program controls Linux md devices (software RAID arrays) Name: mdadm Version: 4.2 # extraversion is used to define rhel internal version -%define extraversion 2 +%define extraversion 3 Release: %{extraversion}%{?dist} Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}%{?subversion:-%{subversion}}.tar.xz Source1: mdmonitor.init @@ -17,7 +17,19 @@ Source9: mdcheck Source10: mdadm_env.sh Patch000: disable-Werror.patch -Patch001: 0001-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch +Patch001: Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch +Patch002: 0001-Unify-error-message.patch +Patch003: 0002-mdadm-Fix-double-free.patch +Patch004: 0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch +Patch005: 0004-udev-adapt-rules-to-systemd-v247.patch +Patch006: 0005-Replace-error-prone-signal-with-sigaction.patch +Patch007: 0006-mdadm-Respect-config-file-location-in-man.patch +Patch008: 0007-mdadm-Update-ReadMe.patch +Patch009: 0008-mdadm-Update-config-man-regarding-default-files-and-.patch +Patch010: 0009-mdadm-Update-config-manual.patch +Patch011: 0010-Create-Build-use-default_layout.patch +Patch012: 0011-mdadm-add-map_num_s.patch +Patch013: 0012-mdadm-systemd-remove-KillMode-none-from-service-file.patch # RHEL customization patches Patch200: mdadm-3.3-udev.patch @@ -49,7 +61,19 @@ file can be used to help with some common tasks. %setup -q -n %{name}-%{version}%{?subversion:_%{subversion}} %patch000 -p1 -b .disable -%patch001 -p1 -b .0001 +%patch001 -p1 -b .Revert +%patch002 -p1 -b .0001 +%patch003 -p1 -b .0002 +%patch004 -p1 -b .0003 +%patch005 -p1 -b .0004 +%patch006 -p1 -b .0005 +%patch007 -p1 -b .0006 +%patch008 -p1 -b .0007 +%patch009 -p1 -b .0008 +%patch010 -p1 -b .0009 +%patch011 -p1 -b .0010 +%patch012 -p1 -b .0011 +%patch013 -p1 -b .0012 # RHEL customization patches %patch200 -p1 -b .udev @@ -121,6 +145,10 @@ rm -rf %{buildroot} /usr/lib/mdadm/mdadm_env.sh %changelog +* Mon May 30 2022 Xiao Ni - 4.2-3 +- Update mdadm to latest upstream +- Resolves rhbz#2052563, rhbz#1991596 + * Thu Feb 24 2022 Xiao Ni - 4.2-2 - mdadm re-add fault/removed disk failed - Resolves rhbz#2046323