diff --git a/0001-Assemble-keep-MD_DISK_FAILFAST-and-MD_DISK_WRITEMOST.patch b/0001-Assemble-keep-MD_DISK_FAILFAST-and-MD_DISK_WRITEMOST.patch deleted file mode 100644 index e0423f9bf09e498233274560a1db8a1e34c45519..0000000000000000000000000000000000000000 --- a/0001-Assemble-keep-MD_DISK_FAILFAST-and-MD_DISK_WRITEMOST.patch +++ /dev/null @@ -1,39 +0,0 @@ -From d164718cc46b5b2ca3096829f385c935c5d99776 Mon Sep 17 00:00:00 2001 -From: Gioh Kim -Date: Tue, 6 Nov 2018 15:27:42 +0100 -Subject: [PATCH 01/27] Assemble: keep MD_DISK_FAILFAST and MD_DISK_WRITEMOSTLY - flag - -Before updating superblock of slave disks, desired_state value -is set for the target state of the slave disks. But it forgets -to check MD_DISK_FAILFAST and MD_DISK_WRITEMOSTLY flags. Then -start_arrays() calls ADD_NEW_DISK ioctl-call and pass the state -without MD_DISK_FAILFAST and MD_DISK_WRITEMOSTLY. - -Currenlty it does not generate any problem because kernel does not -care MD_DISK_FAILFAST or MD_DISK_WRITEMOSTLY flags. - -Reviewed-by: NeilBrown -Signed-off-by: Gioh Kim -Signed-off-by: Jes Sorensen ---- - Assemble.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/Assemble.c b/Assemble.c -index a79466c..f39c9e1 100644 ---- a/Assemble.c -+++ b/Assemble.c -@@ -1704,6 +1704,9 @@ try_again: - else - desired_state = (1< Date: Mon, 29 Jun 2020 21:33:22 +0800 -Subject: [PATCH 27/27] mdadm: remove -Werror to fix +Subject: [PATCH] mdadm: remove -Werror to fix [-Werror=address-of-packed-member] problem gcc reports [-Werror=address-of-packed-member] error when building @@ -14,12 +14,12 @@ Signed-off-by: Zhiqiang Liu 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile -index 2767ac6..5e24cbd 100644 +index 2a51d81..ee5bdad 100644 --- a/Makefile +++ b/Makefile -@@ -48,7 +48,7 @@ endif - - CC ?= $(CROSS_COMPILE)gcc +@@ -50,7 +50,7 @@ ifeq ($(origin CC),default) + CC := $(CROSS_COMPILE)gcc + endif CXFLAGS ?= -ggdb -CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter +CWFLAGS = -Wall -Wstrict-prototypes -Wextra -Wno-unused-parameter @@ -27,5 +27,5 @@ index 2767ac6..5e24cbd 100644 CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3 endif -- -2.21.1 (Apple Git-122.3) +2.33.0 diff --git a/0002-Document-PART-POLICY-lines.patch b/0002-Document-PART-POLICY-lines.patch deleted file mode 100644 index 1576de56bcf55ba6eae54ea727dc390c55194a50..0000000000000000000000000000000000000000 --- a/0002-Document-PART-POLICY-lines.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 3a5189df04c3bfa74e59014de1bf7b4d1acd2c10 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Fri, 9 Nov 2018 17:12:33 +1100 -Subject: [PATCH 02/27] Document PART-POLICY lines - -PART-POLICY has been accepted in mdadm.conf since the same -time that POLICY was accepted, but it was never documented. -So add the missing documentation. - -Also fix a bug which would have stopped it from working if -anyone had ever tried to use it. - -Signed-off-by: NeilBrown -Signed-off-by: Jes Sorensen ---- - mdadm.conf.5 | 24 +++++++++++++++++++++++- - policy.c | 2 +- - 2 files changed, 24 insertions(+), 2 deletions(-) - -diff --git a/mdadm.conf.5 b/mdadm.conf.5 -index 18512cb..47c962a 100644 ---- a/mdadm.conf.5 -+++ b/mdadm.conf.5 -@@ -501,7 +501,7 @@ To update hot plug configuration it is necessary to execute - .B mdadm \-\-udev\-rules - command after changing the config file - --Key words used in the -+Keywords used in the - .I POLICY - line and supported values are: - -@@ -565,6 +565,28 @@ be automatically added to that array (or it's container) - 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. -+ - .SH EXAMPLE - DEVICE /dev/sd[bcdjkl]1 - .br -diff --git a/policy.c b/policy.c -index c0d18a7..258f393 100644 ---- a/policy.c -+++ b/policy.c -@@ -300,7 +300,7 @@ static int path_has_part(char *path, char **part) - l--; - if (l < 5 || strncmp(path+l-5, "-part", 5) != 0) - return 0; -- *part = path+l-4; -+ *part = path+l-5; - return 1; - } - --- -2.21.1 (Apple Git-122.3) - diff --git a/0002-mdadm-Fix-mdadm-r-remove-option-regresision.patch b/0002-mdadm-Fix-mdadm-r-remove-option-regresision.patch new file mode 100644 index 0000000000000000000000000000000000000000..4ae6c086c483f2f36528a3f6262f8553c1d98e13 --- /dev/null +++ b/0002-mdadm-Fix-mdadm-r-remove-option-regresision.patch @@ -0,0 +1,82 @@ +From 7b94dd6398bc08ec58088c3ca93a8bcd6e4c2c04 Mon Sep 17 00:00:00 2001 +From: Logan Gunthorpe +Date: Thu, 12 May 2022 10:30:55 -0600 +Subject: [PATCH] mdadm: Fix mdadm -r remove option regresision + +The commit noted below globally adds a parameter to the -r option but missed +the fact that -r is used for another purpose: --remove. + +After that commit, a command such as: + + mdadm /dev/md0 -r /dev/loop0 + +will do nothing seeing the device parameter will be consumed as a +argument to the -r option; thus, there will only be one device +seen one the command line, devs_found will only be 1 and nothing will +happen. + +This caused the 01r5integ and 01raid6integ tests to hang indefinitely +as mdadm did not remove the failed device. With the device not removed, +it would not be readded. Then the loop waiting for the array status to +change would loop forever. + +To fix this, revert the changes in the noted patch and create a new subopt +type for the monitor mode with parameters required for -r. + +Fixes: 546047688e1c ("mdadm: fix coredump of mdadm --monitor -r") +Cc: Wu Guanghao +Cc: Mariusz Tkaczyk +Signed-off-by: Logan Gunthorpe +--- + ReadMe.c | 7 ++++--- + mdadm.c | 1 + + mdadm.h | 1 + + 3 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/ReadMe.c b/ReadMe.c +index 8f873c48..556104f7 100644 +--- a/ReadMe.c ++++ b/ReadMe.c +@@ -81,11 +81,12 @@ char Version[] = "mdadm - v" VERSION " - " VERS_DATE EXTRAVERSION "\n"; + * found, it is started. + */ + +-char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k"; ++char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k"; ++char short_monitor_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k"; + char short_bitmap_options[]= +- "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:sarfRSow1tye:k:"; ++ "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:"; + char short_bitmap_auto_options[]= +- "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:sa:rfRSow1tye:k:"; ++ "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:k:"; + + struct option long_options[] = { + {"manage", 0, 0, ManageOpt}, +diff --git a/mdadm.c b/mdadm.c +index be40686c..d0c5e6de 100644 +--- a/mdadm.c ++++ b/mdadm.c +@@ -227,6 +227,7 @@ int main(int argc, char *argv[]) + shortopt = short_bitmap_auto_options; + break; + case 'F': newmode = MONITOR; ++ shortopt = short_monitor_options; + break; + case 'G': newmode = GROW; + shortopt = short_bitmap_options; +diff --git a/mdadm.h b/mdadm.h +index 09915a00..559da3f6 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -419,6 +419,7 @@ enum mode { + }; + + extern char short_options[]; ++extern char short_monitor_options[]; + extern char short_bitmap_options[]; + extern char short_bitmap_auto_options[]; + extern struct option long_options[]; +-- +2.27.0 + diff --git a/0003-Grow-avoid-overflow-in-compute_backup_blocks.patch b/0003-Grow-avoid-overflow-in-compute_backup_blocks.patch deleted file mode 100644 index 90da9392a8da85d3148f8d20906cb548acc2f1ba..0000000000000000000000000000000000000000 --- a/0003-Grow-avoid-overflow-in-compute_backup_blocks.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 488555f211b2bae7f54670e6f3fc3aef14215f44 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 6 Dec 2018 10:35:41 +1100 -Subject: [PATCH 03/27] Grow: avoid overflow in compute_backup_blocks() - -With a chunk size of 16Meg and data drive count of 8, -this calculate can easily overflow the 'int' type that -is used for the multiplications. -So force it to use "long" instead. - -Reported-and-tested-by: Ed Spiridonov -Signed-off-by: NeilBrown -Signed-off-by: Jes Sorensen ---- - Grow.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/Grow.c b/Grow.c -index 4436a4d..76f82c0 100644 ---- a/Grow.c -+++ b/Grow.c -@@ -1196,7 +1196,8 @@ unsigned long compute_backup_blocks(int nchunk, int ochunk, - /* Find GCD */ - a = GCD(a, b); - /* LCM == product / GCD */ -- blocks = (ochunk/512) * (nchunk/512) * odata * ndata / a; -+ blocks = (unsigned long)(ochunk/512) * (unsigned long)(nchunk/512) * -+ odata * ndata / a; - - return blocks; - } --- -2.21.1 (Apple Git-122.3) - diff --git a/0003-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch b/0003-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch new file mode 100644 index 0000000000000000000000000000000000000000..dd381e243ffa6335046157e1ea3f2058bd76bdaa --- /dev/null +++ b/0003-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch @@ -0,0 +1,35 @@ +From 9ae62977b51dab0f4bb46b1c8ea5ebd1705b2f4d Mon Sep 17 00:00:00 2001 +From: Logan Gunthorpe +Date: Wed, 22 Jun 2022 14:25:10 -0600 +Subject: [PATCH] monitor: Avoid segfault when calling NULL get_bad_blocks + +Not all struct superswitch implement a get_bad_blocks() function, +yet mdmon seems to call it without checking for NULL and thus +occasionally segfaults in the test 10ddf-geometry. + +Fix this by checking for NULL before calling it. + +Signed-off-by: Logan Gunthorpe +Acked-by: Mariusz Tkaczyk +Signed-off-by: Jes Sorensen +--- + monitor.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/monitor.c b/monitor.c +index b877e595..820a93d0 100644 +--- a/monitor.c ++++ b/monitor.c +@@ -311,6 +311,9 @@ static int check_for_cleared_bb(struct active_array *a, struct mdinfo *mdi) + struct md_bb *bb; + int i; + ++ if (!ss->get_bad_blocks) ++ return -1; ++ + /* + * Get a list of bad blocks for an array, then read list of + * acknowledged bad blocks from kernel and compare it against metadata +-- +2.33.0 + diff --git a/0004-Grow-report-correct-new-chunk-size.patch b/0004-Grow-report-correct-new-chunk-size.patch deleted file mode 100644 index 9fcecc9a15d7d1d47c4191e7d36274b20bda5e38..0000000000000000000000000000000000000000 --- a/0004-Grow-report-correct-new-chunk-size.patch +++ /dev/null @@ -1,30 +0,0 @@ -From a3afc5af0cdf29652c8350d03b6d7fbb28f4ccf9 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 6 Dec 2018 10:36:28 +1100 -Subject: [PATCH 04/27] Grow: report correct new chunk size. - -When using "--grow --chunk=" to change chunk -size, the old chunksize is reported instead of the new. - -Signed-off-by: NeilBrown -Signed-off-by: Jes Sorensen ---- - Grow.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Grow.c b/Grow.c -index 76f82c0..363b209 100644 ---- a/Grow.c -+++ b/Grow.c -@@ -3286,7 +3286,7 @@ static int reshape_array(char *container, int fd, char *devname, - goto release; - } else if (verbose >= 0) - printf("chunk size for %s set to %d\n", -- devname, array.chunk_size); -+ devname, info->new_chunk); - } - unfreeze(st); - return 0; --- -2.21.1 (Apple Git-122.3) - diff --git a/0004-mdadm-mdcheck_start.service-mdcheck_continue.service.patch b/0004-mdadm-mdcheck_start.service-mdcheck_continue.service.patch new file mode 100644 index 0000000000000000000000000000000000000000..82018f18f3806046150db8d8d7139296d841f231 --- /dev/null +++ b/0004-mdadm-mdcheck_start.service-mdcheck_continue.service.patch @@ -0,0 +1,37 @@ +From c68df6f3ed2ab5de2148577e69cd5d58745985b3 Mon Sep 17 00:00:00 2001 +From: miaoguanqin +Date: Sat, 3 Dec 2022 10:36:55 +0800 +Subject: [PATCH] mdcheck_start.service and mdcheck_continue.service set the + path of Execstart to /usr/share/mdadm/mdcheck, But mdcheck was not exist in + this path. When we launch service, It would execute error. We change the path + of ExecStart to /usr/sbin/check, then service would br launched correctly. + +Signed-off-by: miaoguanqin +--- + systemd/mdcheck_continue.service | 2 +- + systemd/mdcheck_start.service | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/systemd/mdcheck_continue.service b/systemd/mdcheck_continue.service +index 854317f..935004b 100644 +--- a/systemd/mdcheck_continue.service ++++ b/systemd/mdcheck_continue.service +@@ -14,4 +14,4 @@ Type=oneshot + Environment="MDADM_CHECK_DURATION=6 hours" + EnvironmentFile=-/run/sysconfig/mdadm + ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh +-ExecStart=/usr/share/mdadm/mdcheck --continue --duration ${MDADM_CHECK_DURATION} ++ExecStart=BINDIR/mdcheck --continue --duration ${MDADM_CHECK_DURATION} +diff --git a/systemd/mdcheck_start.service b/systemd/mdcheck_start.service +index 3bb3d13..58d84c6 100644 +--- a/systemd/mdcheck_start.service ++++ b/systemd/mdcheck_start.service +@@ -14,4 +14,4 @@ Type=oneshot + Environment="MDADM_CHECK_DURATION=6 hours" + EnvironmentFile=-/run/sysconfig/mdadm + ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh +-ExecStart=/usr/share/mdadm/mdcheck --duration ${MDADM_CHECK_DURATION} ++ExecStart=BINDIR/mdcheck --duration ${MDADM_CHECK_DURATION} +-- +2.27.0 + diff --git a/0005-Fix-spelling-typos.patch b/0005-Fix-spelling-typos.patch deleted file mode 100644 index 165c888613a2821e3d82ccc3f27dee57d182f968..0000000000000000000000000000000000000000 --- a/0005-Fix-spelling-typos.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 73b33b805f386c1aee582b2579d82ae5cbbd0f98 Mon Sep 17 00:00:00 2001 -From: Dimitri John Ledkov -Date: Tue, 15 Jan 2019 19:08:37 +0000 -Subject: [PATCH 05/27] Fix spelling typos. - -Signed-off-by: Dimitri John Ledkov -Signed-off-by: Jes Sorensen ---- - Assemble.c | 2 +- - Create.c | 2 +- - Grow.c | 6 +++--- - super-ddf.c | 2 +- - super-intel.c | 2 +- - 5 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/Assemble.c b/Assemble.c -index f39c9e1..3fa996f 100644 ---- a/Assemble.c -+++ b/Assemble.c -@@ -876,7 +876,7 @@ static int force_array(struct mdinfo *content, - current_events = devices[chosen_drive].i.events; - add_another: - if (c->verbose >= 0) -- pr_err("forcing event count in %s(%d) from %d upto %d\n", -+ pr_err("forcing event count in %s(%d) from %d up to %d\n", - devices[chosen_drive].devname, - devices[chosen_drive].i.disk.raid_disk, - (int)(devices[chosen_drive].i.events), -diff --git a/Create.c b/Create.c -index 04b1dfc..6f1b228 100644 ---- a/Create.c -+++ b/Create.c -@@ -823,7 +823,7 @@ int Create(struct supertype *st, char *mddev, - } - bitmap_fd = open(s->bitmap_file, O_RDWR); - if (bitmap_fd < 0) { -- pr_err("weird: %s cannot be openned\n", -+ pr_err("weird: %s cannot be opened\n", - s->bitmap_file); - goto abort_locked; - } -diff --git a/Grow.c b/Grow.c -index 363b209..6d32661 100644 ---- a/Grow.c -+++ b/Grow.c -@@ -446,7 +446,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) - if (offset_setable) { - st->ss->getinfo_super(st, mdi, NULL); - if (sysfs_init(mdi, fd, NULL)) { -- pr_err("failed to intialize sysfs.\n"); -+ pr_err("failed to initialize sysfs.\n"); - free(mdi); - } - rv = sysfs_set_num_signed(mdi, NULL, "bitmap/location", -@@ -2178,7 +2178,7 @@ size_change_error: - memset(&info, 0, sizeof(info)); - info.array = array; - if (sysfs_init(&info, fd, NULL)) { -- pr_err("failed to intialize sysfs.\n"); -+ pr_err("failed to initialize sysfs.\n"); - rv = 1; - goto release; - } -@@ -2903,7 +2903,7 @@ static int impose_level(int fd, int level, char *devname, int verbose) - struct mdinfo info; - - if (sysfs_init(&info, fd, NULL)) { -- pr_err("failed to intialize sysfs.\n"); -+ pr_err("failed to initialize sysfs.\n"); - return 1; - } - -diff --git a/super-ddf.c b/super-ddf.c -index 618542c..c095e8a 100644 ---- a/super-ddf.c -+++ b/super-ddf.c -@@ -1900,7 +1900,7 @@ static struct vd_config *find_vdcr(struct ddf_super *ddf, unsigned int inst, - return conf; - } - bad: -- pr_err("Could't find disk %d in array %u\n", n, inst); -+ pr_err("Couldn't find disk %d in array %u\n", n, inst); - return NULL; - } - -diff --git a/super-intel.c b/super-intel.c -index 6438987..401a3ea 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -9956,7 +9956,7 @@ static void imsm_process_update(struct supertype *st, - break; - } - default: -- pr_err("error: unsuported process update type:(type: %d)\n", type); -+ pr_err("error: unsupported process update type:(type: %d)\n", type); - } - } - --- -2.21.1 (Apple Git-122.3) - diff --git a/0006-Detail.c-do-not-skip-first-character-when-calling-xs.patch b/0006-Detail.c-do-not-skip-first-character-when-calling-xs.patch deleted file mode 100644 index 60cdd8808dd33166a49fcb7105eda171edec4f55..0000000000000000000000000000000000000000 --- a/0006-Detail.c-do-not-skip-first-character-when-calling-xs.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 3f772cd2f7c81f7475b425f0128e97f2cc142490 Mon Sep 17 00:00:00 2001 -From: Coly Li -Date: Tue, 12 Feb 2019 12:53:18 +0800 -Subject: [PATCH 06/27] Detail.c: do not skip first character when calling - xstrdup in Detail() - -'Commit b9c9bd9bacaa ("Detail: ensure --export names are acceptable as -shell variables")' duplicates mdi->sys_name to sysdev string by, - char *sysdev = xstrdup(mdi->sys_name + 1); -which skips the first character of mdi->sys_name. Then when running -mdadm --detail --export, the output looks like, - MD_DEVICE_ev_sda2_ROLE=1 - MD_DEVICE_ev_sda2_DEV=/dev/sda2 -The first character of md device (between MD_DEVICE and _ROLE/_DEV) -is dropped. The expected output should be, - MD_DEVICE_dev_sda2_ROLE=1 - MD_DEVICE_dev_sda2_DEV=/dev/sda2 - -This patch removes the '+ 1' from calling xstrdup() in Detail(), which -gets the dropped first character back. - -Reported-by: Arvin Schnell -Fixes: b9c9bd9bacaa ("Detail: ensure --export names are acceptable as 4 shell variables") -Signed-off-by: Coly Li -Cc: NeilBrown -Signed-off-by: Jes Sorensen ---- - Detail.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Detail.c b/Detail.c -index b3e857a..20ea03a 100644 ---- a/Detail.c -+++ b/Detail.c -@@ -284,7 +284,7 @@ int Detail(char *dev, struct context *c) - struct mdinfo *mdi; - for (mdi = sra->devs; mdi; mdi = mdi->next) { - char *path; -- char *sysdev = xstrdup(mdi->sys_name + 1); -+ char *sysdev = xstrdup(mdi->sys_name); - char *cp; - - path = map_dev(mdi->disk.major, --- -2.21.1 (Apple Git-122.3) - diff --git a/0007-Fix-reshape-for-decreasing-data-offset.patch b/0007-Fix-reshape-for-decreasing-data-offset.patch deleted file mode 100644 index e9d68fda6bb896dcd631ac62b055648941b8f84b..0000000000000000000000000000000000000000 --- a/0007-Fix-reshape-for-decreasing-data-offset.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 896bd7389840921f586bb52d9d6b73a5cae13f52 Mon Sep 17 00:00:00 2001 -From: Corey Hickey -Date: Mon, 11 Feb 2019 17:18:38 -0800 -Subject: [PATCH 07/27] Fix reshape for decreasing data offset - -...when not changing the number of disks. - -This patch needs context to explain. These are the relevant parts of -the original code (condensed and annotated): - -if (dir > 0) { - /* Increase data offset (reshape backwards) */ - if (data_offset < sd->data_offset + min) { - pr_err("--data-offset too small on %s\n", - dn); - goto release; - } -} else { - /* Decrease data offset (reshape forwards) */ - if (data_offset < sd->data_offset - min) { - pr_err("--data-offset too small on %s\n", - dn); - goto release; - } -} - -When this code is reached, mdadm has already decided on a reshape -direction. When increasing the data offset, the reshape runs backwards -(dir==1); when decreasing the data offset, the reshape runs forwards -(dir==-1). - -The conditional within the backwards reshape is correct: the requested -offset must be larger than the old offset plus a minimum delta; thus the -reshape has room to work. - -For the forwards reshape, the requested offset needs to be smaller than -the old offset minus a minimum delta; to do this correctly, the -comparison must be reversed. - -Also update the error message. - -Note: I have tested this change on a RAID 5 on Linux 4.18.0 and verified -that there were no errors from the kernel and that the device data -remained intact. I do not know if there are considerations for different -RAID levels. - -Signed-off-by: Corey Hickey -Signed-off-by: Jes Sorensen ---- - Grow.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Grow.c b/Grow.c -index 6d32661..764374f 100644 ---- a/Grow.c -+++ b/Grow.c -@@ -2613,8 +2613,8 @@ static int set_new_data_offset(struct mdinfo *sra, struct supertype *st, - goto release; - } - if (data_offset != INVALID_SECTORS && -- data_offset < sd->data_offset - min) { -- pr_err("--data-offset too small on %s\n", -+ data_offset > sd->data_offset - min) { -+ pr_err("--data-offset too large on %s\n", - dn); - goto release; - } --- -2.21.1 (Apple Git-122.3) - diff --git a/0008-mdmon-don-t-attempt-to-manage-new-arrays-when-termin.patch b/0008-mdmon-don-t-attempt-to-manage-new-arrays-when-termin.patch deleted file mode 100644 index 4a45fda6159782b32680bd16427f0d464617c563..0000000000000000000000000000000000000000 --- a/0008-mdmon-don-t-attempt-to-manage-new-arrays-when-termin.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 195b937685f1076d9e418d01b77e3274dffb29dc Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Fri, 22 Feb 2019 10:15:45 +0100 -Subject: [PATCH 08/27] mdmon: don't attempt to manage new arrays when - terminating - -When mdmon gets a SIGTERM, it stops managing arrays that are clean. If -there is more that one array in the container and one of them is dirty -and the clean one is still present in mdstat, mdmon will treat it as a -new array and start managing it again. This leads to a cycle of -remove_old() / manage_new() calls for the clean array, until the other -one also becomes clean. - -Prevent this by not calling manage_new() if sigterm is set. Also, remove -a check for sigterm in manage_new() because the condition will never be -true. - -Signed-off-by: Artur Paszkiewicz -Signed-off-by: Jes Sorensen ---- - managemon.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/managemon.c b/managemon.c -index 101231c..29b91ba 100644 ---- a/managemon.c -+++ b/managemon.c -@@ -727,9 +727,7 @@ static void manage_new(struct mdstat_ent *mdstat, - dprintf("inst: %s action: %d state: %d\n", inst, - new->action_fd, new->info.state_fd); - -- if (sigterm) -- new->info.safe_mode_delay = 1; -- else if (mdi->safe_mode_delay >= 50) -+ if (mdi->safe_mode_delay >= 50) - /* Normal start, mdadm set this. */ - new->info.safe_mode_delay = mdi->safe_mode_delay; - else -@@ -803,7 +801,7 @@ void manage(struct mdstat_ent *mdstat, struct supertype *container) - break; - } - } -- if (a == NULL || !a->container) -+ if ((a == NULL || !a->container) && !sigterm) - manage_new(mdstat, container, a); - } - } --- -2.21.1 (Apple Git-122.3) - diff --git a/0009-mdmon-wait-for-previous-mdmon-to-exit-during-takeove.patch b/0009-mdmon-wait-for-previous-mdmon-to-exit-during-takeove.patch deleted file mode 100644 index 653b1db22ac4536ebd1013ef5c13d36a7fe1c9d6..0000000000000000000000000000000000000000 --- a/0009-mdmon-wait-for-previous-mdmon-to-exit-during-takeove.patch +++ /dev/null @@ -1,57 +0,0 @@ -From ba21bae7f771a7e1ac9b9eaa0e0357fa597447e8 Mon Sep 17 00:00:00 2001 -From: Pawel Baldysiak -Date: Fri, 22 Feb 2019 13:30:27 +0100 -Subject: [PATCH 09/27] mdmon: wait for previous mdmon to exit during takeover - -Since the patch c76242c5("mdmon: get safe mode delay file descriptor -early"), safe_mode_dalay is set properly by initrd mdmon. But in some -cases with filesystem traffic since the very start of the system, it -might take a while to transit to clean state. Due to fact that new -mdmon does not wait for the old one to exit - it might happen that the -new one switches safe_mode_delay back to seconds, before old one exits. -As the result two mdmons are running concurrently on same array. - -Wait for the old mdmon to exit by pinging it with SIGUSR1 signal, just -in case it is sleeping. - -Signed-off-by: Pawel Baldysiak -Signed-off-by: Jes Sorensen ---- - mdmon.c | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -diff --git a/mdmon.c b/mdmon.c -index 0955fcc..ff985d2 100644 ---- a/mdmon.c -+++ b/mdmon.c -@@ -171,6 +171,7 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock) - int fd; - int n; - long fl; -+ int rv; - - /* first rule of survival... don't off yourself */ - if (pid == getpid()) -@@ -201,9 +202,16 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock) - fl &= ~O_NONBLOCK; - fcntl(sock, F_SETFL, fl); - n = read(sock, buf, 100); -- /* Ignore result, it is just the wait that -- * matters -- */ -+ -+ /* If there is I/O going on it might took some time to get to -+ * clean state. Wait for monitor to exit fully to avoid races. -+ * Ping it with SIGUSR1 in case that it is sleeping */ -+ for (n = 0; n < 25; n++) { -+ rv = kill(pid, SIGUSR1); -+ if (rv < 0) -+ break; -+ usleep(200000); -+ } - } - - void remove_pidfile(char *devname) --- -2.21.1 (Apple Git-122.3) - diff --git a/0010-Assemble-Fix-starting-array-with-initial-reshape-che.patch b/0010-Assemble-Fix-starting-array-with-initial-reshape-che.patch deleted file mode 100644 index 498b93f81e1b140ac7c81cac81c2736bc7e8434b..0000000000000000000000000000000000000000 --- a/0010-Assemble-Fix-starting-array-with-initial-reshape-che.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 428f76d7aa74c7980cf4dbda3714a25b0d4b48ee Mon Sep 17 00:00:00 2001 -From: Pawel Baldysiak -Date: Fri, 22 Feb 2019 12:56:27 +0100 -Subject: [PATCH 10/27] Assemble: Fix starting array with initial reshape - checkpoint - -If array was stopped during reshape initialization, -there might be a "0" checkpoint recorded in metadata. -If array with such condition (reshape with position 0) -is passed to kernel - it will refuse to start such array. - -Treat such array as normal during assemble, Grow_continue() will -reinitialize and start the reshape. - -Signed-off-by: Pawel Baldysiak -Signed-off-by: Jes Sorensen ---- - Assemble.c | 18 ++++++++++++++++-- - 1 file changed, 16 insertions(+), 2 deletions(-) - -diff --git a/Assemble.c b/Assemble.c -index 3fa996f..bcf6487 100644 ---- a/Assemble.c -+++ b/Assemble.c -@@ -2058,8 +2058,22 @@ int assemble_container_content(struct supertype *st, int mdfd, - spare, &c->backup_file, c->verbose) == 1) - return 1; - -- err = sysfs_set_str(content, NULL, -- "array_state", "readonly"); -+ if (content->reshape_progress == 0) { -+ /* If reshape progress is 0 - we are assembling the -+ * array that was stopped, before reshape has started. -+ * Array needs to be started as active, Grow_continue() -+ * will start the reshape. -+ */ -+ sysfs_set_num(content, NULL, "reshape_position", -+ MaxSector); -+ err = sysfs_set_str(content, NULL, -+ "array_state", "active"); -+ sysfs_set_num(content, NULL, "reshape_position", 0); -+ } else { -+ err = sysfs_set_str(content, NULL, -+ "array_state", "readonly"); -+ } -+ - if (err) - return 1; - --- -2.21.1 (Apple Git-122.3) - diff --git a/0011-add-missing-units-to-examine.patch b/0011-add-missing-units-to-examine.patch deleted file mode 100644 index 8fdcac4b94d549f7fc58555a43d085c7222f4c0a..0000000000000000000000000000000000000000 --- a/0011-add-missing-units-to-examine.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 4e01454a7f340e09559f3c229f9a67381906119d Mon Sep 17 00:00:00 2001 -From: Corey Hickey -Date: Mon, 11 Feb 2019 17:42:27 -0800 -Subject: [PATCH 11/27] add missing units to --examine - -Within the output of "mdadm --examine", there are three sizes reported -on adjacent lines. For example: - -$ sudo mdadm --examine /dev/md3 -[...] - Avail Dev Size : 17580545024 (8383.06 GiB 9001.24 GB) - Array Size : 17580417024 (16765.99 GiB 18002.35 GB) - Used Dev Size : 11720278016 (5588.66 GiB 6000.78 GB) -[...] - -This can be confusing, since the first and third line are in 512-byte -sectors, and the second is in KiB. - -Add units to avoid ambiguity. - -(I don't particularly like the "KiB" notation, but it is at least -unambiguous.) - -Signed-off-by: Corey Hickey -Signed-off-by: Jes Sorensen ---- - super1.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/super1.c b/super1.c -index 636a286..b85dc20 100644 ---- a/super1.c -+++ b/super1.c -@@ -360,7 +360,7 @@ static void examine_super1(struct supertype *st, char *homehost) - printf(" Raid Level : %s\n", c?c:"-unknown-"); - printf(" Raid Devices : %d\n", __le32_to_cpu(sb->raid_disks)); - printf("\n"); -- printf(" Avail Dev Size : %llu%s\n", -+ printf(" Avail Dev Size : %llu sectors%s\n", - (unsigned long long)__le64_to_cpu(sb->data_size), - human_size(__le64_to_cpu(sb->data_size)<<9)); - if (__le32_to_cpu(sb->level) > 0) { -@@ -378,11 +378,11 @@ static void examine_super1(struct supertype *st, char *homehost) - if (ddsks) { - long long asize = __le64_to_cpu(sb->size); - asize = (asize << 9) * ddsks / ddsks_denom; -- printf(" Array Size : %llu%s\n", -+ printf(" Array Size : %llu KiB%s\n", - asize >> 10, human_size(asize)); - } - if (sb->size != sb->data_size) -- printf(" Used Dev Size : %llu%s\n", -+ printf(" Used Dev Size : %llu sectors%s\n", - (unsigned long long)__le64_to_cpu(sb->size), - human_size(__le64_to_cpu(sb->size)<<9)); - } --- -2.21.1 (Apple Git-122.3) - diff --git a/0012-Create-Block-rounding-size-to-max.patch b/0012-Create-Block-rounding-size-to-max.patch deleted file mode 100644 index a80293625a3b7ed697a532a188f8e9ae70b23d53..0000000000000000000000000000000000000000 --- a/0012-Create-Block-rounding-size-to-max.patch +++ /dev/null @@ -1,94 +0,0 @@ -From a03332b6f634b9c504a5bef920141fa63335aeb8 Mon Sep 17 00:00:00 2001 -From: Mariusz Tkaczyk -Date: Mon, 1 Apr 2019 16:53:41 +0200 -Subject: [PATCH 12/27] Create: Block rounding size to max - -When passed size is smaller than chunk, mdadm rounds it to 0 but 0 there -means max available space. -Block it for every metadata. Remove the same check from imsm routine. - -Signed-off-by: Mariusz Tkaczyk -Signed-off-by: Jes Sorensen ---- - Create.c | 23 ++++++++++++++++++++--- - super-intel.c | 5 ++--- - 2 files changed, 22 insertions(+), 6 deletions(-) - -diff --git a/Create.c b/Create.c -index 6f1b228..292f92a 100644 ---- a/Create.c -+++ b/Create.c -@@ -27,6 +27,18 @@ - #include "md_p.h" - #include - -+static int round_size_and_verify(unsigned long long *size, int chunk) -+{ -+ if (*size == 0) -+ return 0; -+ *size &= ~(unsigned long long)(chunk - 1); -+ if (*size == 0) { -+ pr_err("Size cannot be smaller than chunk.\n"); -+ return 1; -+ } -+ return 0; -+} -+ - static int default_layout(struct supertype *st, int level, int verbose) - { - int layout = UnSet; -@@ -248,11 +260,14 @@ int Create(struct supertype *st, char *mddev, - pr_err("unknown level %d\n", s->level); - return 1; - } -+ - if (s->size == MAX_SIZE) - /* use '0' to mean 'max' now... */ - s->size = 0; - if (s->size && s->chunk && s->chunk != UnSet) -- s->size &= ~(unsigned long long)(s->chunk - 1); -+ if (round_size_and_verify(&s->size, s->chunk)) -+ return 1; -+ - newsize = s->size * 2; - if (st && ! st->ss->validate_geometry(st, s->level, s->layout, s->raiddisks, - &s->chunk, s->size*2, -@@ -267,7 +282,8 @@ int Create(struct supertype *st, char *mddev, - /* default chunk was just set */ - if (c->verbose > 0) - pr_err("chunk size defaults to %dK\n", s->chunk); -- s->size &= ~(unsigned long long)(s->chunk - 1); -+ if (round_size_and_verify(&s->size, s->chunk)) -+ return 1; - do_default_chunk = 0; - } - } -@@ -413,7 +429,8 @@ int Create(struct supertype *st, char *mddev, - /* default chunk was just set */ - if (c->verbose > 0) - pr_err("chunk size defaults to %dK\n", s->chunk); -- s->size &= ~(unsigned long long)(s->chunk - 1); -+ if (round_size_and_verify(&s->size, s->chunk)) -+ return 1; - do_default_chunk = 0; - } - } -diff --git a/super-intel.c b/super-intel.c -index 401a3ea..5c3f9cb 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -7385,9 +7385,8 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout, - verbose); - } - -- if (size && ((size < 1024) || (*chunk != UnSet && -- size < (unsigned long long) *chunk))) { -- pr_err("Given size must be greater than 1M and chunk size.\n"); -+ if (size && (size < 1024)) { -+ pr_err("Given size must be greater than 1M.\n"); - /* Depends on algorithm in Create.c : - * if container was given (dev == NULL) return -1, - * if block device was given ( dev != NULL) return 0. --- -2.21.1 (Apple Git-122.3) - diff --git a/0013-super-intel-Fix-issue-with-abs-being-irrelevant.patch b/0013-super-intel-Fix-issue-with-abs-being-irrelevant.patch deleted file mode 100644 index 618a758a63542ac9acbbcd4957859dd24025f793..0000000000000000000000000000000000000000 --- a/0013-super-intel-Fix-issue-with-abs-being-irrelevant.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 5d494b2e4a4fc1208e56a78cfdc8bfb20c6ffa83 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 9 Jul 2019 13:26:08 -0400 -Subject: [PATCH 13/27] super-intel: Fix issue with abs() being irrelevant - -gcc9 complains about subtracting unsigned from unsigned and code -assuming the result can be negative. - -Signed-off-by: Jes Sorensen ---- - super-intel.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/super-intel.c b/super-intel.c -index 5c3f9cb..988883e 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -2805,7 +2805,7 @@ static unsigned long long calc_component_size(struct imsm_map *map, - { - unsigned long long component_size; - unsigned long long dev_size = imsm_dev_size(dev); -- unsigned long long calc_dev_size = 0; -+ long long calc_dev_size = 0; - unsigned int member_disks = imsm_num_data_members(map); - - if (member_disks == 0) -@@ -2819,7 +2819,7 @@ static unsigned long long calc_component_size(struct imsm_map *map, - * 2048 blocks per each device. If the difference is higher it means - * that array size was expanded and num_data_stripes was not updated. - */ -- if ((unsigned int)abs(calc_dev_size - dev_size) > -+ if (llabs(calc_dev_size - (long long)dev_size) > - (1 << SECT_PER_MB_SHIFT) * member_disks) { - component_size = dev_size / member_disks; - dprintf("Invalid num_data_stripes in metadata; expected=%llu, found=%llu\n", --- -2.21.1 (Apple Git-122.3) - diff --git a/0014-imsm-close-removed-drive-fd.patch b/0014-imsm-close-removed-drive-fd.patch deleted file mode 100644 index 721dadd90fdc0253a244e36705f903721957c6d7..0000000000000000000000000000000000000000 --- a/0014-imsm-close-removed-drive-fd.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 055124106fe3c77db639fd7d315b099c5d52f517 Mon Sep 17 00:00:00 2001 -From: Mariusz Tkaczyk -Date: Mon, 15 Jul 2019 09:25:35 +0200 -Subject: [PATCH 14/27] imsm: close removed drive fd. - -When member drive fails, managemon prepares metadata update and adds -the drive to disk_mgmt_list with DISK_REMOVE flag. It fills only -minor and major. It is enough to recognize the device later. - -Monitor thread while processing this update will remove the drive from -super only if it is a spare. It never removes failed member from -disks list. As a result, it still keeps opened descriptor to -non-existing device. - -If removed drive is not a spare fill fd in disk_cfg structure -(prepared by managemon), monitor will close fd during freeing it. - -Also set this drive fd to -1 in super to avoid double closing because -monitor will close the fd (if needed) while replacing removed drive -in array. - -Signed-off-by: Mariusz Tkaczyk -Signed-off-by: Jes Sorensen ---- - super-intel.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/super-intel.c b/super-intel.c -index 988883e..8b7709f 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -9121,6 +9121,9 @@ static int add_remove_disk_update(struct intel_super *super) - remove_disk_super(super, - disk_cfg->major, - disk_cfg->minor); -+ } else { -+ disk_cfg->fd = disk->fd; -+ disk->fd = -1; - } - } - /* release allocate disk structure */ --- -2.21.1 (Apple Git-122.3) - diff --git a/0015-mdadm-force-a-uuid-swap-on-big-endian.patch b/0015-mdadm-force-a-uuid-swap-on-big-endian.patch deleted file mode 100644 index d71cdbdf6bd90f8efa952cc269a5c8a5dfcee40a..0000000000000000000000000000000000000000 --- a/0015-mdadm-force-a-uuid-swap-on-big-endian.patch +++ /dev/null @@ -1,40 +0,0 @@ -From dac0e65954e43bdf93a8cfccc73108c97d060254 Mon Sep 17 00:00:00 2001 -From: Nigel Croxon -Date: Tue, 24 Sep 2019 11:39:24 -0400 -Subject: [PATCH 15/27] mdadm: force a uuid swap on big endian - -The code path for metadata 0.90 calls a common routine -fname_from_uuid that uses metadata 1.2. The code expects member -swapuuid to be setup and usable. But it is only setup when using -metadata 1.2. Since the metadata 0.90 did not create swapuuid -and set it. The test (st->ss == &super1) ? 1 : st->ss->swapuuid -fails. The swapuuid is set at compile time based on byte order. -Any call based on metadata 0.90 and on big endian processors, -the --export uuid will be incorrect. - -Signed-Off-by: Nigel Croxon -Signed-off-by: Jes Sorensen ---- - util.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/util.c b/util.c -index c26cf5f..64dd409 100644 ---- a/util.c -+++ b/util.c -@@ -685,8 +685,12 @@ char *fname_from_uuid(struct supertype *st, struct mdinfo *info, - // work, but can't have it set if we want this printout to match - // all the other uuid printouts in super1.c, so we force swapuuid - // to 1 to make our printout match the rest of super1 -+#if __BYTE_ORDER == BIG_ENDIAN -+ return __fname_from_uuid(info->uuid, 1, buf, sep); -+#else - return __fname_from_uuid(info->uuid, (st->ss == &super1) ? 1 : - st->ss->swapuuid, buf, sep); -+#endif - } - - int check_ext2(int fd, char *name) --- -2.21.1 (Apple Git-122.3) - diff --git a/0016-Init-devlist-as-an-array.patch b/0016-Init-devlist-as-an-array.patch deleted file mode 100644 index ec0e80ba41fd55986481698c48377b4fd69d6c49..0000000000000000000000000000000000000000 --- a/0016-Init-devlist-as-an-array.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 13a018075abb72609288d865565ac4f8be34a335 Mon Sep 17 00:00:00 2001 -From: Xiao Ni -Date: Mon, 30 Sep 2019 19:47:59 +0800 -Subject: [PATCH 16/27] Init devlist as an array - -devlist is an string. It will change to an array if there is disk that -is sbd disk. If one device is sbd, it runs devlist=(). -This line code changes devlist from a string to an array. If there is -no sbd device, it can't run this line code. So it will still be a string. -The later codes need an array, rather than an string. So init devlist -as an array to fix this problem. - -Signed-off-by: Xiao Ni -Signed-off-by: Jes Sorensen ---- - clustermd_tests/func.sh | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/clustermd_tests/func.sh b/clustermd_tests/func.sh -index 642cc96..801d604 100644 ---- a/clustermd_tests/func.sh -+++ b/clustermd_tests/func.sh -@@ -39,6 +39,9 @@ fetch_devlist() - devlist=($(ls /dev/disk/by-path/*$ISCSI_ID*)) - fi - # sbd disk cannot use in testing -+ # Init devlist as an array -+ i='' -+ devlist=(${devlist[@]#$i}) - for i in ${devlist[@]} - do - sbd -d $i dump &> /dev/null --- -2.21.1 (Apple Git-122.3) - diff --git a/0017-Don-t-need-to-check-recovery-after-re-add-when-no-I-.patch b/0017-Don-t-need-to-check-recovery-after-re-add-when-no-I-.patch deleted file mode 100644 index d3c55dd61389ade118c5f1207574fe137e2a5771..0000000000000000000000000000000000000000 --- a/0017-Don-t-need-to-check-recovery-after-re-add-when-no-I-.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 3bf7f0b83339a8b76983bbc9b806f4dffa890092 Mon Sep 17 00:00:00 2001 -From: Xiao Ni -Date: Mon, 30 Sep 2019 19:48:00 +0800 -Subject: [PATCH 17/27] Don't need to check recovery after re-add when no I/O - writes to raid - -If there is no write I/O between removing member disk and re-add it, there is no -recovery after re-adding member disk. - -Signed-off-by: Xiao Ni -Signed-off-by: Jes Sorensen ---- - clustermd_tests/02r1_Manage_re-add | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/clustermd_tests/02r1_Manage_re-add b/clustermd_tests/02r1_Manage_re-add -index dd9c416..d0d13e5 100644 ---- a/clustermd_tests/02r1_Manage_re-add -+++ b/clustermd_tests/02r1_Manage_re-add -@@ -9,8 +9,6 @@ check all state UU - check all dmesg - mdadm --manage $md0 --fail $dev0 --remove $dev0 - mdadm --manage $md0 --re-add $dev0 --check $NODE1 recovery --check all wait - check all state UU - check all dmesg - stop_md all $md0 --- -2.21.1 (Apple Git-122.3) - diff --git a/0018-Manage-Remove-the-legacy-code-for-md-driver-prior-to.patch b/0018-Manage-Remove-the-legacy-code-for-md-driver-prior-to.patch deleted file mode 100644 index f7f1b06d6c3516d278784813ea72cd41e1c34e1d..0000000000000000000000000000000000000000 --- a/0018-Manage-Remove-the-legacy-code-for-md-driver-prior-to.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 5983db9ecae579c1acd7a32e785ecfda5a659f9f Mon Sep 17 00:00:00 2001 -From: Xiao Yang -Date: Wed, 27 Nov 2019 11:59:24 +0800 -Subject: [PATCH 18/27] Manage: Remove the legacy code for md driver prior to - 0.90.03 - -Previous re-add operation only calls ioctl(HOT_ADD_DISK) for array without -metadata(e.g. mdadm -B/--build) when md driver is less than 0.90.02, but -commit 091e8e6 breaks the logic and current re-add operation can call -ioctl(HOT_ADD_DISK) even if md driver is 0.90.03. - -This issue is reproduced by 05r1-re-add-nosuper: ------------------------------------------------- -++ die 'resync or recovery is happening!' -++ echo -e '\n\tERROR: resync or recovery is happening! \n' -ERROR: resync or recovery is happening! ------------------------------------------------- - -Fixes: 091e8e6("Manage: Remove all references to md_get_version()") -Reported-by: kernel test robot -Signed-off-by: Xiao Yang -Signed-off-by: Jes Sorensen ---- - Manage.c | 12 ------------ - 1 file changed, 12 deletions(-) - -diff --git a/Manage.c b/Manage.c -index 21536f5..ffe55f8 100644 ---- a/Manage.c -+++ b/Manage.c -@@ -741,18 +741,6 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv, - " Adding anyway as --force was given.\n", - dv->devname, devname); - } -- if (!tst->ss->external && array->major_version == 0) { -- if (ioctl(fd, HOT_ADD_DISK, rdev)==0) { -- if (verbose >= 0) -- pr_err("hot added %s\n", -- dv->devname); -- return 1; -- } -- -- pr_err("hot add failed for %s: %s\n", -- dv->devname, strerror(errno)); -- return -1; -- } - - if (array->not_persistent == 0 || tst->ss->external) { - --- -2.21.1 (Apple Git-122.3) - diff --git a/0019-imsm-Correct-minimal-device-size.patch b/0019-imsm-Correct-minimal-device-size.patch deleted file mode 100644 index 2925f6d2c371befecc6c02afc877d3c6289e60cc..0000000000000000000000000000000000000000 --- a/0019-imsm-Correct-minimal-device-size.patch +++ /dev/null @@ -1,32 +0,0 @@ -From fd91a74b58cecc99872a17883289b12e8cd1f163 Mon Sep 17 00:00:00 2001 -From: Blazej Kucman -Date: Wed, 11 Mar 2020 15:40:13 +0100 -Subject: [PATCH 19/27] imsm: Correct minimal device size. - -Check if given size of member drive is not less than 1 MibiByte. - -Signed-off-by: Blazej Kucman -Signed-off-by: Jes Sorensen ---- - super-intel.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/super-intel.c b/super-intel.c -index 8b7709f..5da99d5 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -7385,7 +7385,10 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout, - verbose); - } - -- if (size && (size < 1024)) { -+ /* -+ * Size is given in sectors. -+ */ -+ if (size && (size < 2048)) { - pr_err("Given size must be greater than 1M.\n"); - /* Depends on algorithm in Create.c : - * if container was given (dev == NULL) return -1, --- -2.21.1 (Apple Git-122.3) - diff --git a/0020-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch b/0020-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch deleted file mode 100644 index cbf9bd52e38b27d8e234ada7684800ba6903d958..0000000000000000000000000000000000000000 --- a/0020-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch +++ /dev/null @@ -1,30 +0,0 @@ -From d4f8d99b03fb4f3da105e7f3e52d712a0dea45b7 Mon Sep 17 00:00:00 2001 -From: Lidong Zhong -Date: Mon, 16 Mar 2020 10:16:49 +0800 -Subject: [PATCH 20/27] Detail: show correct bitmap info for cluster raid - device - -Signed-off-by: Lidong Zhong -Signed-off-by: Jes Sorensen ---- - Detail.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/Detail.c b/Detail.c -index 20ea03a..dadcafe 100644 ---- a/Detail.c -+++ b/Detail.c -@@ -467,7 +467,9 @@ int Detail(char *dev, struct context *c) - if (ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 && bmf.pathname[0]) { - printf(" Intent Bitmap : %s\n", bmf.pathname); - printf("\n"); -- } else if (array.state & (1< -Date: Tue, 16 Apr 2019 18:08:17 +0200 -Subject: [PATCH 21/27] Assemble: print error message if mdadm fails assembling - with --uuid option - -When mdadm tries to assemble one working device and one zeroed-out device, -it failed but print successful message because there is --uuid option. - -Following script always reproduce it. - -dd if=/dev/zero of=/dev/ram0 oflag=direct -dd if=/dev/zero of=/dev/ram1 oflag=direct -./mdadm -C /dev/md111 -e 1.2 --uuid="12345678:12345678:12345678:12345678" \ - -l1 -n2 /dev/ram0 /dev/ram1 -./mdadm -S /dev/md111 -dd if=/dev/zero of=/dev/ram1 oflag=direct -./mdadm -A /dev/md111 --uuid="12345678:12345678:12345678:12345678" \ - /dev/ram0 /dev/ram1 - -Following is message from mdadm. - -mdadm: No super block found on /dev/ram1 (Expected magic a92b4efc, got 00000000) -mdadm: no RAID superblock on /dev/ram1 -mdadm: /dev/md111 assembled from 1 drive - need all 2 to start it (use --run to insist). - -The mdadm say that it assembled but mdadm does not create /dev/md111. -The message is wrong. - -After applying this patch, mdadm reports error correctly as following. - -mdadm: No super block found on /dev/ram1 (Expected magic a92b4efc, got 00000000) -mdadm: no RAID superblock on /dev/ram1 -mdadm: /dev/ram1 has no superblock - assembly aborted - -Signed-off-by: Gioh Kim -Signed-off-by: Jes Sorensen ---- - Assemble.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Assemble.c b/Assemble.c -index bcf6487..f302deb 100644 ---- a/Assemble.c -+++ b/Assemble.c -@@ -269,7 +269,7 @@ static int select_devices(struct mddev_dev *devlist, - if (auto_assem || !inargv) - /* Ignore unrecognised devices during auto-assembly */ - goto loop; -- if (ident->uuid_set || ident->name[0] || -+ if (ident->name[0] || - ident->super_minor != UnSet) - /* Ignore unrecognised device if looking for - * specific array */ --- -2.21.1 (Apple Git-122.3) - diff --git a/0022-Include-count-for-0-character-when-using-strncpy-to-.patch b/0022-Include-count-for-0-character-when-using-strncpy-to-.patch deleted file mode 100644 index efdfb50e841c9d91a14802925988e0a5e72f7de7..0000000000000000000000000000000000000000 --- a/0022-Include-count-for-0-character-when-using-strncpy-to-.patch +++ /dev/null @@ -1,34 +0,0 @@ -From d62151dfb6ec7f9ede978097421eeba82928710f Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 18 May 2020 20:19:53 -0400 -Subject: [PATCH 22/27] Include count for \0 character when using strncpy to - implement strdup. - -We have to include the \0 character in the length when copying a -string with strncpy() for which length was found with strlen(). -Otherwise the destination will not get null terminated - except that -we explicitly zeroed it out earlier. - -This quiets down the compiler's warnings. - -Signed-off-by: Jes Sorensen ---- - dlink.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/dlink.c b/dlink.c -index 3efa94b..69aa7aa 100644 ---- a/dlink.c -+++ b/dlink.c -@@ -63,7 +63,7 @@ char *dl_strndup(char *s, int l) - if (s == NULL) - return NULL; - n = dl_newv(char, l+1); -- strncpy(n, s, l); -+ strncpy(n, s, l+1); - n[l] = 0; - return n; - } --- -2.21.1 (Apple Git-122.3) - diff --git a/0023-restripe-fix-ignoring-return-value-of-read-and-lseek.patch b/0023-restripe-fix-ignoring-return-value-of-read-and-lseek.patch deleted file mode 100644 index bff6b11ec8528d008c7bee9ca76145edf36cbce4..0000000000000000000000000000000000000000 --- a/0023-restripe-fix-ignoring-return-value-of-read-and-lseek.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0a0051cb0e573d76a1ebd99d4ac0932fc45460d3 Mon Sep 17 00:00:00 2001 -From: Guoqing Jiang -Date: Mon, 18 May 2020 23:53:36 +0200 -Subject: [PATCH 23/27] =?UTF-8?q?restripe:=20fix=20ignoring=20return=20val?= - =?UTF-8?q?ue=20of=20=E2=80=98read=E2=80=99=20and=20lseek?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Got below error when run "make everything". - -restripe.c: In function ‘test_stripes’: -restripe.c:870:4: error: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Werror=unused-result] - read(source[i], stripes[i], chunk_size); - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Fix it by check the return value of ‘read’, and free memory -in the failure case. - -And check the return value of lseek as well per Jes's comment. - -Signed-off-by: Guoqing Jiang -Signed-off-by: Jes Sorensen ---- - restripe.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/restripe.c b/restripe.c -index 31b07e8..86e1d00 100644 ---- a/restripe.c -+++ b/restripe.c -@@ -866,8 +866,16 @@ int test_stripes(int *source, unsigned long long *offsets, - int disk; - - for (i = 0 ; i < raid_disks ; i++) { -- lseek64(source[i], offsets[i]+start, 0); -- read(source[i], stripes[i], chunk_size); -+ if ((lseek64(source[i], offsets[i]+start, 0) < 0) || -+ (read(source[i], stripes[i], chunk_size) != -+ chunk_size)) { -+ free(q); -+ free(p); -+ free(blocks); -+ free(stripes); -+ free(stripe_buf); -+ return -1; -+ } - } - for (i = 0 ; i < data_disks ; i++) { - int disk = geo_map(i, start/chunk_size, raid_disks, --- -2.21.1 (Apple Git-122.3) - diff --git a/0024-Block-overwriting-existing-links-while-manual-assemb.patch b/0024-Block-overwriting-existing-links-while-manual-assemb.patch deleted file mode 100644 index 46cb1bf65ed745d82de867c8400bef3649ee5cf4..0000000000000000000000000000000000000000 --- a/0024-Block-overwriting-existing-links-while-manual-assemb.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 5d11bd766ee17d3b9a7d96e184704723c11a99d1 Mon Sep 17 00:00:00 2001 -From: Kinga Tanska -Date: Fri, 29 May 2020 08:31:36 +0200 -Subject: [PATCH 24/27] Block overwriting existing links while manual assembly - -Manual assembly with existing link caused overwriting -this link. Add checking link and block this situation. - -Signed-off-by: Kinga Tanska -Signed-off-by: Jes Sorensen ---- - Assemble.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/Assemble.c b/Assemble.c -index f302deb..914c193 100644 ---- a/Assemble.c -+++ b/Assemble.c -@@ -1467,6 +1467,10 @@ try_again: - name = content->name; - break; - } -+ if (mddev && map_by_name(&map, mddev) != NULL) { -+ pr_err("Cannot create device with %s because is in use\n", mddev); -+ goto out; -+ } - if (!auto_assem) - /* If the array is listed in mdadm.conf or on - * command line, then we trust the name --- -2.21.1 (Apple Git-122.3) - diff --git a/0025-Detect-too-small-device-error-rather-than-underflow-.patch b/0025-Detect-too-small-device-error-rather-than-underflow-.patch deleted file mode 100644 index 9155cc16a97af4239fa423d6efac25253e5bf00e..0000000000000000000000000000000000000000 --- a/0025-Detect-too-small-device-error-rather-than-underflow-.patch +++ /dev/null @@ -1,76 +0,0 @@ -From bcc3a5ea9c631645b792f151e1beb9a4b1a4e34e Mon Sep 17 00:00:00 2001 -From: David Favro -Date: Sat, 23 May 2020 08:24:59 -0400 -Subject: [PATCH 25/27] Detect too-small device: error rather than - underflow/crash - -For 1.x metadata, when the user requested creation of an array on -component devices that were too small even to hold the superblock, -an undetected integer wraparound (underflow) resulted in an enormous -computed size which resulted in various follow-on errors such as -floating-point exception. - -This patch detects this condition, prints a reasonable diagnostic -message, and refuses to continue. - -Signed-off-by: David Favro -Signed-off-by: Jes Sorensen ---- - super1.c | 19 ++++++++++++++----- - 1 file changed, 14 insertions(+), 5 deletions(-) - -diff --git a/super1.c b/super1.c -index b85dc20..06bc145 100644 ---- a/super1.c -+++ b/super1.c -@@ -2715,6 +2715,7 @@ static int validate_geometry1(struct supertype *st, int level, - unsigned long long ldsize, devsize; - int bmspace; - unsigned long long headroom; -+ unsigned long long overhead; - int fd; - - if (level == LEVEL_CONTAINER) { -@@ -2747,10 +2748,6 @@ static int validate_geometry1(struct supertype *st, int level, - close(fd); - - devsize = ldsize >> 9; -- if (devsize < 24) { -- *freesize = 0; -- return 0; -- } - - /* creating: allow suitable space for bitmap or PPL */ - if (consistency_policy == CONSISTENCY_POLICY_PPL) -@@ -2791,15 +2788,27 @@ static int validate_geometry1(struct supertype *st, int level, - case 0: /* metadata at end. Round down and subtract space to reserve */ - devsize = (devsize & ~(4ULL*2-1)); - /* space for metadata, bblog, bitmap/ppl */ -- devsize -= 8*2 + 8 + bmspace; -+ overhead = 8*2 + 8 + bmspace; -+ if (devsize < overhead) /* detect underflow */ -+ goto dev_too_small_err; -+ devsize -= overhead; - break; - case 1: - case 2: -+ if (devsize < data_offset) /* detect underflow */ -+ goto dev_too_small_err; - devsize -= data_offset; - break; - } - *freesize = devsize; - return 1; -+ -+/* Error condition, device cannot even hold the overhead. */ -+dev_too_small_err: -+ fprintf(stderr, "device %s is too small (%lluK) for " -+ "required metadata!\n", subdev, devsize>>1); -+ *freesize = 0; -+ return 0; - } - - void *super1_make_v0(struct supertype *st, struct mdinfo *info, mdp_super_t *sb0) --- -2.21.1 (Apple Git-122.3) - diff --git a/0026-mdadm-Grow-prevent-md-s-fd-from-being-occupied-durin.patch b/0026-mdadm-Grow-prevent-md-s-fd-from-being-occupied-durin.patch deleted file mode 100644 index db462f54507ade4283d4682a9905b1d147e034f1..0000000000000000000000000000000000000000 --- a/0026-mdadm-Grow-prevent-md-s-fd-from-being-occupied-durin.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 17ee1b8ebaf51b117e17578f48ffb1ad293ff117 Mon Sep 17 00:00:00 2001 -From: allenpeng -Date: Fri, 12 Jun 2020 17:00:39 +0800 -Subject: [PATCH 26/27] mdadm/Grow: prevent md's fd from being occupied during - delayed time - -If we start reshaping on md which shares sub-devices with another -resyncing md, it may be forced to wait for others to complete. mdadm -occupies the md's fd during this time, which causes the md can not be -stopped and the filesystem can not be mounted on the md. We can close -md's fd earlier to solve this problem. - -Reproducible Steps: - -1. create two partitions on sda, sdb, sdc, sdd -2. create raid1 with sda1, sdb1 -mdadm -C /dev/md1 --assume-clean -l1 -n2 /dev/sda1 /dev/sdb1 -3. create raid5 with sda2, sdb2, sdc2 -mdadm -C /dev/md2 --assume-clean -l5 -n3 /dev/sda2 /dev/sdb2 /dev/sdc2 -4. start resync at md1 -echo repair > /sys/block/md1/md/sync_action -5. reshape raid5 to raid6 -mdadm -a /dev/md2 /dev/sdd2 -mdadm --grow /dev/md2 -n4 -l6 --backup-file=/root/md2-backup - -Now mdadm is occupying the fd of md2, causing md2 unable to be stopped - -6.Try to stop md2, an error message shows -mdadm -S /dev/md2 -mdadm: Cannot get exclusive access to /dev/md3:Perhaps a running process, -mounted filesystem or active volume group? - -Reviewed-by: Alex Wu -Reviewed-by: BingJing Chang -Reviewed-by: Danny Shih -Signed-off-by: ChangSyun Peng -Signed-off-by: Jes Sorensen ---- - Grow.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Grow.c b/Grow.c -index 764374f..57db7d4 100644 ---- a/Grow.c -+++ b/Grow.c -@@ -3517,6 +3517,7 @@ started: - return 0; - } - -+ close(fd); - /* Now we just need to kick off the reshape and watch, while - * handling backups of the data... - * This is all done by a forked background process. -@@ -3569,7 +3570,6 @@ started: - mdstat_wait(30 - (delayed-1) * 25); - } while (delayed); - mdstat_close(); -- close(fd); - if (check_env("MDADM_GROW_VERIFY")) - fd = open(devname, O_RDONLY | O_DIRECT); - else --- -2.21.1 (Apple Git-122.3) - diff --git a/mdadm-4.1.tar.xz b/mdadm-4.1.tar.xz deleted file mode 100644 index 169dfc02fc7d1412813f76a19f16c7cafa6cb262..0000000000000000000000000000000000000000 Binary files a/mdadm-4.1.tar.xz and /dev/null differ diff --git a/mdadm-4.2.tar.xz b/mdadm-4.2.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..ce190ba3dc36ca85275727e297994035138286e3 Binary files /dev/null and b/mdadm-4.2.tar.xz differ diff --git a/mdadm.spec b/mdadm.spec index 3ec31a5d2fea5794f26a53d429c7c9d67ce69df6..c40ab8ef6968c56826ed3ddb3549189902211727 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,6 +1,6 @@ Name: mdadm -Version: 4.1 -Release: 5 +Version: 4.2 +Release: 3 Summary: The software RAID arrays user manage tools License: GPLv2+ URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ @@ -10,35 +10,12 @@ Source1: mdcheck-cron Source2: mdmonitor.service Source3: mdadm.conf -Patch1: 0001-Assemble-keep-MD_DISK_FAILFAST-and-MD_DISK_WRITEMOST.patch -Patch2: 0002-Document-PART-POLICY-lines.patch -Patch3: 0003-Grow-avoid-overflow-in-compute_backup_blocks.patch -Patch4: 0004-Grow-report-correct-new-chunk-size.patch -Patch5: 0005-Fix-spelling-typos.patch -Patch6: 0006-Detail.c-do-not-skip-first-character-when-calling-xs.patch -Patch7: 0007-Fix-reshape-for-decreasing-data-offset.patch -Patch8: 0008-mdmon-don-t-attempt-to-manage-new-arrays-when-termin.patch -Patch9: 0009-mdmon-wait-for-previous-mdmon-to-exit-during-takeove.patch -Patch10: 0010-Assemble-Fix-starting-array-with-initial-reshape-che.patch -Patch11: 0011-add-missing-units-to-examine.patch -Patch12: 0012-Create-Block-rounding-size-to-max.patch -Patch13: 0013-super-intel-Fix-issue-with-abs-being-irrelevant.patch -Patch14: 0014-imsm-close-removed-drive-fd.patch -Patch15: 0015-mdadm-force-a-uuid-swap-on-big-endian.patch -Patch16: 0016-Init-devlist-as-an-array.patch -Patch17: 0017-Don-t-need-to-check-recovery-after-re-add-when-no-I-.patch -Patch18: 0018-Manage-Remove-the-legacy-code-for-md-driver-prior-to.patch -Patch19: 0019-imsm-Correct-minimal-device-size.patch -Patch20: 0020-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch -Patch21: 0021-Assemble-print-error-message-if-mdadm-fails-assembli.patch -Patch22: 0022-Include-count-for-0-character-when-using-strncpy-to-.patch -Patch23: 0023-restripe-fix-ignoring-return-value-of-read-and-lseek.patch -Patch24: 0024-Block-overwriting-existing-links-while-manual-assemb.patch -Patch25: 0025-Detect-too-small-device-error-rather-than-underflow-.patch -Patch26: 0026-mdadm-Grow-prevent-md-s-fd-from-being-occupied-durin.patch -Patch27: 0027-mdadm-remove-Werror-to-fix-Werror-address-of-packed-.patch - -BuildRequires: systemd gcc binutils +Patch1: 0001-mdadm-remove-Werror-to-fix-Werror-address-of-packed-.patch +Patch2: 0002-mdadm-Fix-mdadm-r-remove-option-regresision.patch +Patch3: 0003-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch +Patch4: 0004-mdadm-mdcheck_start.service-mdcheck_continue.service.patch + +BuildRequires: systemd gcc binutils libudev-devel Requires(post): systemd coreutils Requires(preun): systemd Requires(postun): systemd coreutils @@ -102,6 +79,18 @@ install -d -m 710 %{buildroot}/var/run/mdadm/ %{_mandir}/man*/* %changelog +* Fri Dec 2 2022 miaoguanqin - 4.2-3 +- mdadmcheck_start.service mdadm_continue.service error + +* Mon Nov 14 2022 Zhiqiang Liu - 4.2-2 +- backport upstream bugfix patch to fix segfault problem + +* Mon Oct 17 2022 wuguanghao - 4.2-1 +- upgrade version to 4.2 + +* Sat Jun 25 2022 wuguanghao - 4.1-6 +- fix segfault of --monitor -r + * Wed Nov 4 2020 lixiaokeng - 4.1-5 - add make test