Hello community, here is the log from the commit of package mdadm for openSUSE:Factory checked in at 2020-10-20 15:59:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mdadm (Old) and /work/SRC/openSUSE:Factory/.mdadm.new.3486 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mdadm" Tue Oct 20 15:59:42 2020 rev:124 rq:842010 version:4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/mdadm/mdadm.changes 2020-07-17 20:46:17.928632496 +0200 +++ /work/SRC/openSUSE:Factory/.mdadm.new.3486/mdadm.changes 2020-10-20 15:59:50.289709413 +0200 @@ -1,0 +2,68 @@ +Sun Oct 11 16:14:50 UTC 2020 - Coly Li <[email protected]> + +- Update to latest mdadm which is requested by jsc#SLE-13700 from + partners. Mostly the purpose is for latest Intel IMSM raid + support, while some other fixes are important too. + +- imsm: Correct minimal device size (jsc#SLE-13700) + 0073-imsm-Correct-minimal-device-size.patch +- Detail: show correct bitmap info for cluster raid device + (jsc#SLE-13700) + 0074-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch +- imsm: support the Array Creation Time field in metadata + (jsc#SLE-13700) + 0075-imsm-support-the-Array-Creation-Time-field-in-metada.patch +- imsm: show Subarray and Volume ID in --examine output + (jsc#SLE-13700) + 0076-imsm-show-Subarray-and-Volume-ID-in-examine-output.patch +- udev: Ignore change event for imsm (jsc#SLE-13700) + 0077-udev-Ignore-change-event-for-imsm.patch +- Manage, imsm: Write metadata before add (jsc#SLE-13700) + 0078-Manage-imsm-Write-metadata-before-add.patch +- Assemble: print error message if mdadm fails assembling + with --uuid option (jsc#SLE-13700) + 0079-Assemble-print-error-message-if-mdadm-fails-assembli.patch +- clean up meaning of small typo (jsc#SLE-13700) + 0080-clean-up-meaning-of-small-typo.patch +- Assemble.c: respect force flag (jsc#SLE-13700) + 0081-Assemble.c-respect-force-flag.patch +- mdcheck: Log when done (jsc#SLE-13700) + 0082-mdcheck-Log-when-done.patch +- Makefile: add EXTRAVERSION support (jsc#SLE-13700) + 0083-Makefile-add-EXTRAVERSION-support.patch +- uuid.c: split uuid stuffs from util.c (jsc#SLE-13700) + 0084-uuid.c-split-uuid-stuffs-from-util.c.patch +- Include count for \0 character when using strncpy to + implement strdup. (jsc#SLE-13700) + 0085-Include-count-for-0-character-when-using-strncpy-to-.patch +- restripe: fix ignoring return value of read and lseek + (jsc#SLE-13700) + 0086-restripe-fix-ignoring-return-value-of-read-and-lseek.patch +- Block overwriting existing links while manual assembly + (jsc#SLE-13700) + 0087-Block-overwriting-existing-links-while-manual-assemb.patch +- Detect too-small device: error rather than underflow/crash + (jsc#SLE-13700) + 0088-Detect-too-small-device-error-rather-than-underflow-.patch +- Use more secure HTTPS URLs (jsc#SLE-13700) + 0089-Use-more-secure-HTTPS-URLs.patch +- Update link to Intel page for IMSM (jsc#SLE-13700) + 0090-Update-link-to-Intel-page-for-IMSM.patch +- mdadm/Grow: prevent md's fd from being occupied during delayed time + (jsc#SLE-13700) + 0091-mdadm-Grow-prevent-md-s-fd-from-being-occupied-durin.patch +- Specify nodes number when updating cluster nodes (jsc#SLE-13700) + 0092-Specify-nodes-number-when-updating-cluster-nodes.patch +- mdadm/md.4: update path to in-kernel-tree documentation + (jsc#SLE-13700) + 0093-mdadm-md.4-update-path-to-in-kernel-tree-documentati.patch +- manual: update --examine-badblocks (jsc#SLE-13700) + 0094-manual-update-examine-badblocks.patch + +------------------------------------------------------------------- +Sun Aug 30 16:08:02 UTC 2020 - Coly Li <[email protected]> + +- mdadm: treat the Dell softraid array as local array (bsc#1175004) + 1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch + +------------------------------------------------------------------- New: ---- 0073-imsm-Correct-minimal-device-size.patch 0074-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch 0075-imsm-support-the-Array-Creation-Time-field-in-metada.patch 0076-imsm-show-Subarray-and-Volume-ID-in-examine-output.patch 0077-udev-Ignore-change-event-for-imsm.patch 0078-Manage-imsm-Write-metadata-before-add.patch 0079-Assemble-print-error-message-if-mdadm-fails-assembli.patch 0080-clean-up-meaning-of-small-typo.patch 0081-Assemble.c-respect-force-flag.patch 0082-mdcheck-Log-when-done.patch 0083-Makefile-add-EXTRAVERSION-support.patch 0084-uuid.c-split-uuid-stuffs-from-util.c.patch 0085-Include-count-for-0-character-when-using-strncpy-to-.patch 0086-restripe-fix-ignoring-return-value-of-read-and-lseek.patch 0087-Block-overwriting-existing-links-while-manual-assemb.patch 0088-Detect-too-small-device-error-rather-than-underflow-.patch 0089-Use-more-secure-HTTPS-URLs.patch 0090-Update-link-to-Intel-page-for-IMSM.patch 0091-mdadm-Grow-prevent-md-s-fd-from-being-occupied-durin.patch 0092-Specify-nodes-number-when-updating-cluster-nodes.patch 0093-mdadm-md.4-update-path-to-in-kernel-tree-documentati.patch 0094-manual-update-examine-badblocks.patch 1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mdadm.spec ++++++ --- /var/tmp/diff_new_pack.jjbtic/_old 2020-10-20 15:59:53.577710970 +0200 +++ /var/tmp/diff_new_pack.jjbtic/_new 2020-10-20 15:59:53.581710972 +0200 @@ -109,8 +109,31 @@ Patch65: 0070-imsm-Remove-dump-restore-implementation.patch Patch66: 0071-Monitor-improve-check_one_sharer-for-checking-duplic.patch Patch67: 0072-Detail-adding-sync-status-for-cluster-device.patch +Patch73: 0073-imsm-Correct-minimal-device-size.patch +Patch74: 0074-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch +Patch75: 0075-imsm-support-the-Array-Creation-Time-field-in-metada.patch +Patch76: 0076-imsm-show-Subarray-and-Volume-ID-in-examine-output.patch +Patch77: 0077-udev-Ignore-change-event-for-imsm.patch +Patch78: 0078-Manage-imsm-Write-metadata-before-add.patch +Patch79: 0079-Assemble-print-error-message-if-mdadm-fails-assembli.patch +Patch80: 0080-clean-up-meaning-of-small-typo.patch +Patch81: 0081-Assemble.c-respect-force-flag.patch +Patch82: 0082-mdcheck-Log-when-done.patch +Patch83: 0083-Makefile-add-EXTRAVERSION-support.patch +Patch84: 0084-uuid.c-split-uuid-stuffs-from-util.c.patch +Patch85: 0085-Include-count-for-0-character-when-using-strncpy-to-.patch +Patch86: 0086-restripe-fix-ignoring-return-value-of-read-and-lseek.patch +Patch87: 0087-Block-overwriting-existing-links-while-manual-assemb.patch +Patch88: 0088-Detect-too-small-device-error-rather-than-underflow-.patch +Patch89: 0089-Use-more-secure-HTTPS-URLs.patch +Patch90: 0090-Update-link-to-Intel-page-for-IMSM.patch +Patch91: 0091-mdadm-Grow-prevent-md-s-fd-from-being-occupied-durin.patch +Patch92: 0092-Specify-nodes-number-when-updating-cluster-nodes.patch +Patch93: 0093-mdadm-md.4-update-path-to-in-kernel-tree-documentati.patch +Patch94: 0094-manual-update-examine-badblocks.patch Patch1001: 1001-display-timeout-status.patch Patch1002: 1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch +Patch1003: 1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch %define _udevdir %(pkg-config --variable=udevdir udev) %define _systemdshutdowndir %{_unitdir}/../system-shutdown @@ -187,8 +210,31 @@ %patch65 -p1 %patch66 -p1 %patch67 -p1 +%patch73 -p1 +%patch74 -p1 +%patch75 -p1 +%patch76 -p1 +%patch77 -p1 +%patch78 -p1 +%patch79 -p1 +%patch80 -p1 +%patch81 -p1 +%patch82 -p1 +%patch83 -p1 +%patch84 -p1 +%patch85 -p1 +%patch86 -p1 +%patch87 -p1 +%patch88 -p1 +%patch89 -p1 +%patch90 -p1 +%patch91 -p1 +%patch92 -p1 +%patch93 -p1 +%patch94 -p1 %patch1001 -p1 %patch1002 -p1 +%patch1003 -p1 %build make %{?_smp_mflags} CC="%__cc" CXFLAGS="%{optflags} -Wno-error" SUSE=yes ++++++ 0073-imsm-Correct-minimal-device-size.patch ++++++ >From 06a6101c0a4d2658798dc42f461ace8e6900f840 Mon Sep 17 00:00:00 2001 From: Blazej Kucman <[email protected]> Date: Wed, 11 Mar 2020 15:40:13 +0100 Subject: [PATCH 66/89] imsm: Correct minimal device size. Git-commit: 06a6101c0a4d2658798dc42f461ace8e6900f840 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Check if given size of member drive is not less than 1 MibiByte. Signed-off-by: Blazej Kucman <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- super-intel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/super-intel.c b/super-intel.c index c9a1af5..6680df2 100644 --- a/super-intel.c +++ b/super-intel.c @@ -7425,7 +7425,10 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout, verbose); } - if (size && (size < 1024)) { + /* + * Size is given in sectors. + */ + if (size && (size < 2048)) { pr_err("Given size must be greater than 1M.\n"); /* Depends on algorithm in Create.c : * if container was given (dev == NULL) return -1, -- 2.26.2 ++++++ 0074-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch ++++++ >From 9e4494051de3f53228fabae56c116879bff5a0c8 Mon Sep 17 00:00:00 2001 From: Lidong Zhong <[email protected]> Date: Mon, 16 Mar 2020 10:16:49 +0800 Subject: [PATCH 67/89] Detail: show correct bitmap info for cluster raid device Git-commit: 9e4494051de3f53228fabae56c116879bff5a0c8 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Signed-off-by: Lidong Zhong <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- Detail.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Detail.c b/Detail.c index 832485f..daec4f1 100644 --- a/Detail.c +++ b/Detail.c @@ -468,7 +468,9 @@ int Detail(char *dev, struct context *c) if (ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 && bmf.pathname[0]) { printf(" Intent Bitmap : %s\n", bmf.pathname); printf("\n"); - } else if (array.state & (1<<MD_SB_BITMAP_PRESENT)) + } else if (array.state & (1<<MD_SB_CLUSTERED)) + printf(" Intent Bitmap : Internal(Clustered)\n\n"); + else if (array.state & (1<<MD_SB_BITMAP_PRESENT)) printf(" Intent Bitmap : Internal\n\n"); atime = array.utime; if (atime) -- 2.26.2 ++++++ 0075-imsm-support-the-Array-Creation-Time-field-in-metada.patch ++++++ >From e48aed3c81a75fa3f761fb5b84e5d16f2baee709 Mon Sep 17 00:00:00 2001 From: Artur Paszkiewicz <[email protected]> Date: Tue, 17 Mar 2020 10:20:12 +0100 Subject: [PATCH 68/89] imsm: support the Array Creation Time field in metadata Git-commit: e48aed3c81a75fa3f761fb5b84e5d16f2baee709 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Also present its value in --examine and --examine --export. Signed-off-by: Artur Paszkiewicz <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- super-intel.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/super-intel.c b/super-intel.c index 6680df2..8840fff 100644 --- a/super-intel.c +++ b/super-intel.c @@ -260,8 +260,9 @@ struct imsm_super { * (starts at 1) */ __u16 filler1; /* 0x4E - 0x4F */ -#define IMSM_FILLERS 34 - __u32 filler[IMSM_FILLERS]; /* 0x50 - 0xD7 RAID_MPB_FILLERS */ + __u64 creation_time; /* 0x50 - 0x57 Array creation time */ +#define IMSM_FILLERS 32 + __u32 filler[IMSM_FILLERS]; /* 0x58 - 0xD7 RAID_MPB_FILLERS */ struct imsm_disk disk[1]; /* 0xD8 diskTbl[numDisks] */ /* here comes imsm_dev[num_raid_devs] */ /* here comes BBM logs */ @@ -2014,6 +2015,7 @@ static void examine_super_imsm(struct supertype *st, char *homehost) __u32 sum; __u32 reserved = imsm_reserved_sectors(super, super->disks); struct dl *dl; + time_t creation_time; strncpy(str, (char *)mpb->sig, MPB_SIG_LEN); str[MPB_SIG_LEN-1] = '\0'; @@ -2022,6 +2024,9 @@ static void examine_super_imsm(struct supertype *st, char *homehost) printf(" Orig Family : %08x\n", __le32_to_cpu(mpb->orig_family_num)); printf(" Family : %08x\n", __le32_to_cpu(mpb->family_num)); printf(" Generation : %08x\n", __le32_to_cpu(mpb->generation_num)); + creation_time = __le64_to_cpu(mpb->creation_time); + printf(" Creation Time : %.24s\n", + creation_time ? ctime(&creation_time) : "Unknown"); printf(" Attributes : "); if (imsm_check_attributes(mpb->attributes)) printf("All supported\n"); @@ -2126,6 +2131,7 @@ static void export_examine_super_imsm(struct supertype *st) printf("MD_LEVEL=container\n"); printf("MD_UUID=%s\n", nbuf+5); printf("MD_DEVICES=%u\n", mpb->num_disks); + printf("MD_CREATION_TIME=%llu\n", __le64_to_cpu(mpb->creation_time)); } static void detail_super_imsm(struct supertype *st, char *homehost, @@ -5762,6 +5768,7 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk, sum += __gen_imsm_checksum(mpb); mpb->family_num = __cpu_to_le32(sum); mpb->orig_family_num = mpb->family_num; + mpb->creation_time = __cpu_to_le64((__u64)time(NULL)); } super->current_disk = dl; return 0; -- 2.26.2 ++++++ 0076-imsm-show-Subarray-and-Volume-ID-in-examine-output.patch ++++++ >From ba1b3bc80ea555c288f1119e69d9273249967081 Mon Sep 17 00:00:00 2001 From: Artur Paszkiewicz <[email protected]> Date: Tue, 17 Mar 2020 10:21:03 +0100 Subject: [PATCH 69/89] imsm: show Subarray and Volume ID in --examine output Git-commit: ba1b3bc80ea555c288f1119e69d9273249967081 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Show the index of the subarray as 'Subarray' and the value of the my_vol_raid_dev_num field as 'Volume ID'. Signed-off-by: Artur Paszkiewicz <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- super-intel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/super-intel.c b/super-intel.c index 8840fff..562a58c 100644 --- a/super-intel.c +++ b/super-intel.c @@ -1579,6 +1579,7 @@ static void print_imsm_dev(struct intel_super *super, printf("\n"); printf("[%.16s]:\n", dev->volume); + printf(" Subarray : %d\n", super->current_vol); printf(" UUID : %s\n", uuid); printf(" RAID Level : %d", get_imsm_raid_level(map)); if (map2) @@ -1683,6 +1684,8 @@ static void print_imsm_dev(struct intel_super *super, printf("Multiple PPLs on journaling drive\n"); else printf("<unknown:%d>\n", dev->rwh_policy); + + printf(" Volume ID : %u\n", dev->my_vol_raid_dev_num); } static void print_imsm_disk(struct imsm_disk *disk, -- 2.26.2 ++++++ 0077-udev-Ignore-change-event-for-imsm.patch ++++++ >From e1b92ee0de26576a33b20c9dd6ef6bd8cab8e283 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk <[email protected]> Date: Wed, 8 Apr 2020 16:44:52 +0200 Subject: [PATCH 70/89] udev: Ignore change event for imsm Git-commit: e1b92ee0de26576a33b20c9dd6ef6bd8cab8e283 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 When adding a device to a container mdadm has to close its file descriptor before sysfs_add_disk(). This generates change event. There is race possibility because metadata is already written and other -I process can place drive differently. As a result device can be added to two containers simultaneously. >From IMSM perspective there is no need to react for change event. IMSM doesn't support stacked devices. Signed-off-by: Mariusz Tkaczyk <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- udev-md-raid-assembly.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev-md-raid-assembly.rules b/udev-md-raid-assembly.rules index 9f055ed..d668cdd 100644 --- a/udev-md-raid-assembly.rules +++ b/udev-md-raid-assembly.rules @@ -23,7 +23,7 @@ IMPORT{cmdline}="nodmraid" ENV{nodmraid}=="?*", GOTO="md_inc_end" ENV{ID_FS_TYPE}=="ddf_raid_member", GOTO="md_inc" ENV{noiswmd}=="?*", GOTO="md_inc_end" -ENV{ID_FS_TYPE}=="isw_raid_member", GOTO="md_inc" +ENV{ID_FS_TYPE}=="isw_raid_member", ACTION!="change", GOTO="md_inc" GOTO="md_inc_end" LABEL="md_inc" -- 2.26.2 ++++++ 0078-Manage-imsm-Write-metadata-before-add.patch ++++++ >From 12724c018c964596aa277489fd287d5c3506361a Mon Sep 17 00:00:00 2001 From: Tkaczyk Mariusz <[email protected]> Date: Fri, 17 Apr 2020 13:55:55 +0200 Subject: [PATCH 73/89] Manage, imsm: Write metadata before add Commit: 12724c018c964596aa277489fd287d5c3506361a Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 New drive in container always appears as spare. Manager is able to handle that, and queues appropriative update to monitor. No update from mdadm side has to be processed, just insert the drive and ping the mdmon. Metadata has to be written if no mdmon is running (case for Raid0 or container without arrays). If bare drive is added very early on startup (by custom bare rule), there is possiblity that mdmon was not restarted after switch root. Old one is not able to handle new drive. New one fails because there is drive without metadata in container and metadata cannot be loaded. To prevent this, write spare metadata before adding device to container. Mdmon will overwrite it (same case as spare migration, if drive appears it writes the most recent metadata). Metadata has to be written only on new drive before sysfs_add_disk(), don't race with mdmon if running. Signed-off-by: Tkaczyk Mariusz <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- Manage.c | 6 +---- super-intel.c | 66 +++++++++++++++++++++++++++++++++------------------ 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/Manage.c b/Manage.c index b22c396..0a5f09b 100644 --- a/Manage.c +++ b/Manage.c @@ -994,17 +994,13 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv, Kill(dv->devname, NULL, 0, -1, 0); dfd = dev_open(dv->devname, O_RDWR | O_EXCL|O_DIRECT); - if (mdmon_running(tst->container_devnm)) - tst->update_tail = &tst->updates; if (tst->ss->add_to_super(tst, &disc, dfd, dv->devname, INVALID_SECTORS)) { close(dfd); close(container_fd); return -1; } - if (tst->update_tail) - flush_metadata_updates(tst); - else + if (!mdmon_running(tst->container_devnm)) tst->ss->sync_metadata(tst); sra = sysfs_read(container_fd, NULL, 0); diff --git a/super-intel.c b/super-intel.c index 562a58c..3a73d2b 100644 --- a/super-intel.c +++ b/super-intel.c @@ -5809,6 +5809,9 @@ int mark_spare(struct dl *disk) return ret_val; } + +static int write_super_imsm_spare(struct intel_super *super, struct dl *d); + static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, int fd, char *devname, unsigned long long data_offset) @@ -5938,9 +5941,13 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, dd->next = super->disk_mgmt_list; super->disk_mgmt_list = dd; } else { + /* this is called outside of mdmon + * write initial spare metadata + * mdmon will overwrite it. + */ dd->next = super->disks; super->disks = dd; - super->updates_pending++; + write_super_imsm_spare(super, dd); } return 0; @@ -5979,15 +5986,15 @@ static union { struct imsm_super anchor; } spare_record __attribute__ ((aligned(MAX_SECTOR_SIZE))); -/* spare records have their own family number and do not have any defined raid - * devices - */ -static int write_super_imsm_spares(struct intel_super *super, int doclose) + +static int write_super_imsm_spare(struct intel_super *super, struct dl *d) { struct imsm_super *mpb = super->anchor; struct imsm_super *spare = &spare_record.anchor; __u32 sum; - struct dl *d; + + if (d->index != -1) + return 1; spare->mpb_size = __cpu_to_le32(sizeof(struct imsm_super)); spare->generation_num = __cpu_to_le32(1UL); @@ -6000,28 +6007,41 @@ static int write_super_imsm_spares(struct intel_super *super, int doclose) snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH, MPB_SIGNATURE MPB_VERSION_RAID0); - for (d = super->disks; d; d = d->next) { - if (d->index != -1) - continue; + spare->disk[0] = d->disk; + if (__le32_to_cpu(d->disk.total_blocks_hi) > 0) + spare->attributes |= MPB_ATTRIB_2TB_DISK; - spare->disk[0] = d->disk; - if (__le32_to_cpu(d->disk.total_blocks_hi) > 0) - spare->attributes |= MPB_ATTRIB_2TB_DISK; + if (super->sector_size == 4096) + convert_to_4k_imsm_disk(&spare->disk[0]); - if (super->sector_size == 4096) - convert_to_4k_imsm_disk(&spare->disk[0]); + sum = __gen_imsm_checksum(spare); + spare->family_num = __cpu_to_le32(sum); + spare->orig_family_num = 0; + sum = __gen_imsm_checksum(spare); + spare->check_sum = __cpu_to_le32(sum); - sum = __gen_imsm_checksum(spare); - spare->family_num = __cpu_to_le32(sum); - spare->orig_family_num = 0; - sum = __gen_imsm_checksum(spare); - spare->check_sum = __cpu_to_le32(sum); + if (store_imsm_mpb(d->fd, spare)) { + pr_err("failed for device %d:%d %s\n", + d->major, d->minor, strerror(errno)); + return 1; + } + + return 0; +} +/* spare records have their own family number and do not have any defined raid + * devices + */ +static int write_super_imsm_spares(struct intel_super *super, int doclose) +{ + struct dl *d; + + for (d = super->disks; d; d = d->next) { + if (d->index != -1) + continue; - if (store_imsm_mpb(d->fd, spare)) { - pr_err("failed for device %d:%d %s\n", - d->major, d->minor, strerror(errno)); + if (write_super_imsm_spare(super, d)) return 1; - } + if (doclose) { close(d->fd); d->fd = -1; -- 2.26.2 ++++++ 0079-Assemble-print-error-message-if-mdadm-fails-assembli.patch ++++++ >From 5cfb79dea26d9d7266f79c7c196a1a9f70c16a28 Mon Sep 17 00:00:00 2001 From: Gioh Kim <[email protected]> Date: Tue, 16 Apr 2019 18:08:17 +0200 Subject: [PATCH 74/89] Assemble: print error message if mdadm fails assembling with --uuid option Git-commit: 5cfb79dea26d9d7266f79c7c196a1a9f70c16a28 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 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 <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- Assemble.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assemble.c b/Assemble.c index 6b5a7c8..2ed5884 100644 --- a/Assemble.c +++ b/Assemble.c @@ -269,7 +269,7 @@ static int select_devices(struct mddev_dev *devlist, if (auto_assem || !inargv) /* Ignore unrecognised devices during auto-assembly */ goto loop; - if (ident->uuid_set || ident->name[0] || + if (ident->name[0] || ident->super_minor != UnSet) /* Ignore unrecognised device if looking for * specific array */ -- 2.26.2 ++++++ 0080-clean-up-meaning-of-small-typo.patch ++++++ >From ec7d7ceefc1c2b9ba82cac1ba0f6a34d41a4a913 Mon Sep 17 00:00:00 2001 From: Nigel Croxon <[email protected]> Date: Mon, 4 May 2020 12:27:45 -0400 Subject: [PATCH 75/89] clean up meaning of small typo Git-commit: ec7d7ceefc1c2b9ba82cac1ba0f6a34d41a4a913 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Clean up the typo which leads to wrong understanding. Signed-off-by: Nigel Croxon <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- mdadm.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mdadm.8.in b/mdadm.8.in index a3494a1..9e7cb96 100644 --- a/mdadm.8.in +++ b/mdadm.8.in @@ -2878,7 +2878,7 @@ operation, as described below under LAYOUT CHANGES. .SS CHUNK-SIZE AND LAYOUT CHANGES -Changing the chunk-size of layout without also changing the number of +Changing the chunk-size or layout without also changing the number of devices as the same time will involve re-writing all blocks in-place. To ensure against data loss in the case of a crash, a .B --backup-file -- 2.26.2 ++++++ 0081-Assemble.c-respect-force-flag.patch ++++++ >From 7b99edab2834d5d08ef774b4cff784caaa1a186f Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk <[email protected]> Date: Tue, 5 May 2020 12:17:17 +0200 Subject: [PATCH 76/89] Assemble.c: respect force flag. Git-commit: 7b99edab2834d5d08ef774b4cff784caaa1a186f Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 If the array is dirty handler will set resync_start to 0 to inform kernel that resync is needed. RWH affects only raid456 module, for other levels array will be started even array is degraded and resync cannot be performed. Force is really meaningful for raid456. If array is degraded and resync is requested, kernel will reject an attempt to start the array. To respect force, it has to be marked as clean (this will be done for each array without PPL) and remove the resync request (only for raid 456). Data corruption may occur so proper warning is added. Signed-off-by: Mariusz Tkaczyk <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- Assemble.c | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/Assemble.c b/Assemble.c index 2ed5884..3e5d4e6 100644 --- a/Assemble.c +++ b/Assemble.c @@ -2030,6 +2030,15 @@ int assemble_container_content(struct supertype *st, int mdfd, free(avail); return err; } + } else if (c->force) { + /* Set the array as 'clean' so that we can proceed with starting + * it even if we don't have all devices. Mdmon doesn't care + * if the dirty flag is set in metadata, it will start managing + * it anyway. + * This is really important for raid456 (RWH case), other levels + * are started anyway. + */ + content->array.state |= 1; } if (enough(content->array.level, content->array.raid_disks, @@ -2049,20 +2058,36 @@ int assemble_container_content(struct supertype *st, int mdfd, } free(avail); - if (c->runstop <= 0 && - (working + preexist + expansion) < - content->array.working_disks) { - if (c->export && result) - *result |= INCR_UNSAFE; - else if (c->verbose >= 0) { - pr_err("%s assembled with %d device%s", - chosen_name, preexist + working, - preexist + working == 1 ? "":"s"); - if (preexist) - fprintf(stderr, " (%d new)", working); - fprintf(stderr, " but not safe to start\n"); + if ((working + preexist + expansion) < content->array.working_disks) { + if (c->runstop <= 0) { + if (c->export && result) + *result |= INCR_UNSAFE; + else if (c->verbose >= 0) { + pr_err("%s assembled with %d device%s", + chosen_name, preexist + working, + preexist + working == 1 ? "":"s"); + if (preexist) + fprintf(stderr, " (%d new)", working); + fprintf(stderr, " but not safe to start\n"); + if (c->force) + pr_err("Consider --run to start array as degraded.\n"); + } + return 1; + } else if (content->array.level >= 4 && + content->array.level <= 6 && + content->resync_start != MaxSector && + c->force) { + /* Don't inform the kernel that the array is not + * clean and requires resync. + */ + content->resync_start = MaxSector; + err = sysfs_set_num(content, NULL, "resync_start", + MaxSector); + if (err) + return 1; + pr_err("%s array state forced to clean. It may cause data corruption.\n", + chosen_name); } - return 1; } -- 2.26.2 ++++++ 0082-mdcheck-Log-when-done.patch ++++++ >From 3b7aae927bdb6e150d1aaf3aaf0d183a06abda0b Mon Sep 17 00:00:00 2001 From: Donald Buczek <[email protected]> Date: Wed, 13 May 2020 15:16:46 +0200 Subject: [PATCH 77/89] mdcheck: Log when done Git-commit: 3b7aae927bdb6e150d1aaf3aaf0d183a06abda0b Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Currently mdcheck (when called with `--duration`) logs only the beginning of the check, the pausing and the continuation but not the completion. So, log the completion, too, so that it can be determined how long the raid check took. 2020-05-08T18:00:02+02:00 deadpool root: mdcheck start checking /dev/md0 2020-05-08T18:00:02+02:00 deadpool root: mdcheck start checking /dev/md1 2020-05-09T15:32:04+02:00 deadpool root: mdcheck finished checking /dev/md1 2020-05-09T17:38:04+02:00 deadpool root: mdcheck finished checking /dev/md0 Cc: [email protected] Signed-off-by: Paul Menzel <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- misc/mdcheck | 2 ++ 1 file changed, 2 insertions(+) diff --git a/misc/mdcheck b/misc/mdcheck index 42d4094..700c3e2 100644 --- a/misc/mdcheck +++ b/misc/mdcheck @@ -125,11 +125,13 @@ do do eval fl=\$MD_${i}_fl eval sys=\$MD_${i}_sys + eval dev=\$MD_${i}_dev if [ -z "$fl" ]; then continue; fi if [ "`cat $sys/md/sync_action`" != 'check' ] then + logger -p daemon.info mdcheck finished checking $dev eval MD_${i}_fl= rm -f $fl continue; -- 2.26.2 ++++++ 0083-Makefile-add-EXTRAVERSION-support.patch ++++++ >From 03ab9763f51ddf2030f60f83e76cf9c1b50b726c Mon Sep 17 00:00:00 2001 From: Tkaczyk Mariusz <[email protected]> Date: Fri, 15 May 2020 11:23:14 +0200 Subject: [PATCH 78/89] Makefile: add EXTRAVERSION support Git-commit: 03ab9763f51ddf2030f60f83e76cf9c1b50b726c Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Add optional EXTRAVERSION parameter to Makefile and allow to mark version by user friendly label. It might be useful when creating custom spins of mdadm, or labeling some instance in between major releases. Signed-off-by: Tkaczyk Mariusz <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- Makefile | 3 ++- ReadMe.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a33319a..0a20b75 100644 --- a/Makefile +++ b/Makefile @@ -105,7 +105,8 @@ VERSION = $(shell [ -d .git ] && git describe HEAD | sed 's/mdadm-//') VERS_DATE = $(shell [ -d .git ] && date --iso-8601 --date="`git log -n1 --format=format:%cd --date=iso --date=short`") DVERS = $(if $(VERSION),-DVERSION=\"$(VERSION)\",) DDATE = $(if $(VERS_DATE),-DVERS_DATE="\"$(VERS_DATE)\"",) -CFLAGS += $(DVERS) $(DDATE) +DEXTRAVERSION = $(if $(EXTRAVERSION),-DEXTRAVERSION="\" - $(EXTRAVERSION)\"",) +CFLAGS += $(DVERS) $(DDATE) $(DEXTRAVERSION) # The glibc TLS ABI requires applications that call clone(2) to set up # TLS data structures, use pthreads until mdmon implements this support diff --git a/ReadMe.c b/ReadMe.c index eaf1042..06b8f7e 100644 --- a/ReadMe.c +++ b/ReadMe.c @@ -33,7 +33,10 @@ #ifndef VERS_DATE #define VERS_DATE "2018-10-01" #endif -char Version[] = "mdadm - v" VERSION " - " VERS_DATE "\n"; +#ifndef EXTRAVERSION +#define EXTRAVERSION "" +#endif +char Version[] = "mdadm - v" VERSION " - " VERS_DATE EXTRAVERSION "\n"; /* * File: ReadMe.c -- 2.26.2 ++++++ 0084-uuid.c-split-uuid-stuffs-from-util.c.patch ++++++ >From f4c8a605d2467c0ed25fcba5d27dd56540660e55 Mon Sep 17 00:00:00 2001 From: Guoqing Jiang <[email protected]> Date: Mon, 18 May 2020 23:53:35 +0200 Subject: [PATCH 79/89] uuid.c: split uuid stuffs from util.c Git-commit: f4c8a605d2467c0ed25fcba5d27dd56540660e55 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Currently, 'make raid6check' is build broken since commit b06815989 ("mdadm: load default sysfs attributes after assemblation"). /usr/bin/ld: sysfs.o: in function `sysfsline': sysfs.c:(.text+0x2707): undefined reference to `parse_uuid' /usr/bin/ld: sysfs.c:(.text+0x271a): undefined reference to `uuid_zero' /usr/bin/ld: sysfs.c:(.text+0x2721): undefined reference to `uuid_zero' Apparently, the compile of mdadm or raid6check are coupled with uuid functions inside util.c. However, we can't just add util.o to CHECK_OBJS which raid6check is needed, because it caused other worse problems. So, let's introduce a uuid.c file which is indenpended file to fix the problem, all the contents are splitted from util.c. Signed-off-by: Guoqing Jiang <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- Makefile | 6 +-- util.c | 87 ------------------------------------------ uuid.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 90 deletions(-) create mode 100644 uuid.c diff --git a/Makefile b/Makefile index 0a20b75..15d05d1 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,7 @@ else ECHO=: endif -OBJS = mdadm.o config.o policy.o mdstat.o ReadMe.o util.o maps.o lib.o \ +OBJS = mdadm.o config.o policy.o mdstat.o ReadMe.o uuid.o util.o maps.o lib.o \ Manage.o Assemble.o Build.o \ Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \ Incremental.o Dump.o \ @@ -149,13 +149,13 @@ OBJS = mdadm.o config.o policy.o mdstat.o ReadMe.o util.o maps.o lib.o \ restripe.o sysfs.o sha1.o mapfile.o crc32.o sg_io.o msg.o xmalloc.o \ platform-intel.o probe_roms.o crc32c.o -CHECK_OBJS = restripe.o sysfs.o maps.o lib.o xmalloc.o dlink.o +CHECK_OBJS = restripe.o uuid.o sysfs.o maps.o lib.o xmalloc.o dlink.o SRCS = $(patsubst %.o,%.c,$(OBJS)) INCL = mdadm.h part.h bitmap.h -MON_OBJS = mdmon.o monitor.o managemon.o util.o maps.o mdstat.o sysfs.o \ +MON_OBJS = mdmon.o monitor.o managemon.o uuid.o util.o maps.o mdstat.o sysfs.o \ policy.o lib.o \ Kill.o sg_io.o dlink.o ReadMe.o super-intel.o \ super-mbr.o super-gpt.o \ diff --git a/util.c b/util.c index 07f9dc3..579dd42 100644 --- a/util.c +++ b/util.c @@ -306,43 +306,6 @@ int md_get_disk_info(int fd, struct mdu_disk_info_s *disk) return ioctl(fd, GET_DISK_INFO, disk); } -/* - * Parse a 128 bit uuid in 4 integers - * format is 32 hexx nibbles with options :.<space> separator - * If not exactly 32 hex digits are found, return 0 - * else return 1 - */ -int parse_uuid(char *str, int uuid[4]) -{ - int hit = 0; /* number of Hex digIT */ - int i; - char c; - for (i = 0; i < 4; i++) - uuid[i] = 0; - - while ((c = *str++) != 0) { - int n; - if (c >= '0' && c <= '9') - n = c-'0'; - else if (c >= 'a' && c <= 'f') - n = 10 + c - 'a'; - else if (c >= 'A' && c <= 'F') - n = 10 + c - 'A'; - else if (strchr(":. -", c)) - continue; - else return 0; - - if (hit<32) { - uuid[hit/8] <<= 4; - uuid[hit/8] += n; - } - hit++; - } - if (hit == 32) - return 1; - return 0; -} - int get_linux_version() { struct utsname name; @@ -611,56 +574,6 @@ int enough(int level, int raid_disks, int layout, int clean, char *avail) } } -const int uuid_zero[4] = { 0, 0, 0, 0 }; - -int same_uuid(int a[4], int b[4], int swapuuid) -{ - if (swapuuid) { - /* parse uuids are hostendian. - * uuid's from some superblocks are big-ending - * if there is a difference, we need to swap.. - */ - unsigned char *ac = (unsigned char *)a; - unsigned char *bc = (unsigned char *)b; - int i; - for (i = 0; i < 16; i += 4) { - if (ac[i+0] != bc[i+3] || - ac[i+1] != bc[i+2] || - ac[i+2] != bc[i+1] || - ac[i+3] != bc[i+0]) - return 0; - } - return 1; - } else { - if (a[0]==b[0] && - a[1]==b[1] && - a[2]==b[2] && - a[3]==b[3]) - return 1; - return 0; - } -} - -void copy_uuid(void *a, int b[4], int swapuuid) -{ - if (swapuuid) { - /* parse uuids are hostendian. - * uuid's from some superblocks are big-ending - * if there is a difference, we need to swap.. - */ - unsigned char *ac = (unsigned char *)a; - unsigned char *bc = (unsigned char *)b; - int i; - for (i = 0; i < 16; i += 4) { - ac[i+0] = bc[i+3]; - ac[i+1] = bc[i+2]; - ac[i+2] = bc[i+1]; - ac[i+3] = bc[i+0]; - } - } else - memcpy(a, b, 16); -} - char *__fname_from_uuid(int id[4], int swap, char *buf, char sep) { int i, j; diff --git a/uuid.c b/uuid.c new file mode 100644 index 0000000..94b5abd --- /dev/null +++ b/uuid.c @@ -0,0 +1,112 @@ +/* + * mdadm - manage Linux "md" devices aka RAID arrays. + * + * Copyright (C) 2001-2013 Neil Brown <[email protected]> + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Neil Brown + * Email: <[email protected]> + */ + +#include <string.h> + +const int uuid_zero[4] = { 0, 0, 0, 0 }; + +int same_uuid(int a[4], int b[4], int swapuuid) +{ + if (swapuuid) { + /* parse uuids are hostendian. + * uuid's from some superblocks are big-ending + * if there is a difference, we need to swap.. + */ + unsigned char *ac = (unsigned char *)a; + unsigned char *bc = (unsigned char *)b; + int i; + for (i = 0; i < 16; i += 4) { + if (ac[i+0] != bc[i+3] || + ac[i+1] != bc[i+2] || + ac[i+2] != bc[i+1] || + ac[i+3] != bc[i+0]) + return 0; + } + return 1; + } else { + if (a[0]==b[0] && + a[1]==b[1] && + a[2]==b[2] && + a[3]==b[3]) + return 1; + return 0; + } +} + +void copy_uuid(void *a, int b[4], int swapuuid) +{ + if (swapuuid) { + /* parse uuids are hostendian. + * uuid's from some superblocks are big-ending + * if there is a difference, we need to swap.. + */ + unsigned char *ac = (unsigned char *)a; + unsigned char *bc = (unsigned char *)b; + int i; + for (i = 0; i < 16; i += 4) { + ac[i+0] = bc[i+3]; + ac[i+1] = bc[i+2]; + ac[i+2] = bc[i+1]; + ac[i+3] = bc[i+0]; + } + } else + memcpy(a, b, 16); +} + +/* + * Parse a 128 bit uuid in 4 integers + * format is 32 hexx nibbles with options :.<space> separator + * If not exactly 32 hex digits are found, return 0 + * else return 1 + */ +int parse_uuid(char *str, int uuid[4]) +{ + int hit = 0; /* number of Hex digIT */ + int i; + char c; + for (i = 0; i < 4; i++) + uuid[i] = 0; + + while ((c = *str++) != 0) { + int n; + if (c >= '0' && c <= '9') + n = c-'0'; + else if (c >= 'a' && c <= 'f') + n = 10 + c - 'a'; + else if (c >= 'A' && c <= 'F') + n = 10 + c - 'A'; + else if (strchr(":. -", c)) + continue; + else return 0; + + if (hit<32) { + uuid[hit/8] <<= 4; + uuid[hit/8] += n; + } + hit++; + } + if (hit == 32) + return 1; + return 0; +} -- 2.26.2 ++++++ 0085-Include-count-for-0-character-when-using-strncpy-to-.patch ++++++ >From 7d90f7603af6b59e7144cef6617a1e9dd42161bd Mon Sep 17 00:00:00 2001 From: Jes Sorensen <[email protected]> Date: Mon, 18 May 2020 20:19:53 -0400 Subject: [PATCH 80/89] Include count for \0 character when using strncpy to implement strdup. Git-commit: 7d90f7603af6b59e7144cef6617a1e9dd42161bd Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 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 <[email protected]> Signed-off-by: Coly Li <[email protected]> --- 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.26.2 ++++++ 0086-restripe-fix-ignoring-return-value-of-read-and-lseek.patch ++++++ >From d92cee7b374db9944b63bdd6c1784a2dd90ee9ca Mon Sep 17 00:00:00 2001 From: Guoqing Jiang <[email protected]> Date: Mon, 18 May 2020 23:53:36 +0200 Subject: [PATCH 81/89] restripe: fix ignoring return value of read and lseek Commit: d92cee7b374db9944b63bdd6c1784a2dd90ee9ca Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 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 <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- 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.26.2 ++++++ 0087-Block-overwriting-existing-links-while-manual-assemb.patch ++++++ >From 7758ada9f3872cc9cb4c76c733dbc553562b3d7d Mon Sep 17 00:00:00 2001 From: Kinga Tanska <[email protected]> Date: Fri, 29 May 2020 08:31:36 +0200 Subject: [PATCH 82/89] Block overwriting existing links while manual assembly Commit: 7758ada9f3872cc9cb4c76c733dbc553562b3d7d Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Manual assembly with existing link caused overwriting this link. Add checking link and block this situation. Signed-off-by: Kinga Tanska <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- Assemble.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Assemble.c b/Assemble.c index 3e5d4e6..ed0ddfb 100644 --- a/Assemble.c +++ b/Assemble.c @@ -1482,6 +1482,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.26.2 ++++++ 0088-Detect-too-small-device-error-rather-than-underflow-.patch ++++++ >From 2cf0433063203fca10d26629c9e090b51fb1d806 Mon Sep 17 00:00:00 2001 From: David Favro <[email protected]> Date: Sat, 23 May 2020 08:24:59 -0400 Subject: [PATCH 83/89] Detect too-small device: error rather than underflow/crash Commit: 2cf0433063203fca10d26629c9e090b51fb1d806 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 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 <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- super1.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/super1.c b/super1.c index e0d80be..7664883 100644 --- a/super1.c +++ b/super1.c @@ -2753,6 +2753,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) { @@ -2785,10 +2786,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) @@ -2829,15 +2826,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.26.2 ++++++ 0089-Use-more-secure-HTTPS-URLs.patch ++++++ >From 8e41153c91cdce696618c527906648625217470c Mon Sep 17 00:00:00 2001 From: Paul Menzel <[email protected]> Date: Thu, 28 May 2020 16:52:24 +0200 Subject: [PATCH 84/89] Use more secure HTTPS URLs Commit: 8e41153c91cdce696618c527906648625217470c Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 All URLs in the source are available over HTTPS, so convert all URLs to HTTPS with the command below. git grep -l 'http://' | xargs sed -i 's,http://,https://,g' Revert the changes to announcement files `ANNOUNCE-*` as requested by the maintainer. Cc: [email protected] Signed-off-by: Paul Menzel <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- external-reshape-design.txt | 2 +- mdadm.8.in | 6 +++--- mdadm.spec | 4 ++-- raid6check.8 | 2 +- restripe.c | 2 +- udev-md-raid-safe-timeouts.rules | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/external-reshape-design.txt b/external-reshape-design.txt index 10c57cc..e4cf4e1 100644 --- a/external-reshape-design.txt +++ b/external-reshape-design.txt @@ -277,4 +277,4 @@ sync_action ... -[1]: Linux kernel design patterns - part 3, Neil Brown http://lwn.net/Articles/336262/ +[1]: Linux kernel design patterns - part 3, Neil Brown https://lwn.net/Articles/336262/ diff --git a/mdadm.8.in b/mdadm.8.in index 9e7cb96..7f32762 100644 --- a/mdadm.8.in +++ b/mdadm.8.in @@ -367,7 +367,7 @@ Use the Intel(R) Matrix Storage Manager metadata format. This creates a which is managed in a similar manner to DDF, and is supported by an option-rom on some platforms: .IP -.B http://www.intel.com/design/chipsets/matrixstorage_sb.htm +.B https://www.intel.com/design/chipsets/matrixstorage_sb.htm .PP .RE @@ -3407,7 +3407,7 @@ was previously known as For further information on mdadm usage, MD and the various levels of RAID, see: .IP -.B http://raid.wiki.kernel.org/ +.B https://raid.wiki.kernel.org/ .PP (based upon Jakob \(/Ostergaard's Software\-RAID.HOWTO) .PP @@ -3415,7 +3415,7 @@ The latest version of .I mdadm should always be available from .IP -.B http://www.kernel.org/pub/linux/utils/raid/mdadm/ +.B https://www.kernel.org/pub/linux/utils/raid/mdadm/ .PP Related man pages: .PP diff --git a/mdadm.spec b/mdadm.spec index 1c66894..506ea33 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -2,8 +2,8 @@ Summary: mdadm is used for controlling Linux md devices (aka RAID arrays) Name: mdadm Version: 4.1 Release: 1 -Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.gz -URL: http://neil.brown.name/blog/mdadm +Source: https://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.gz +URL: https://neil.brown.name/blog/mdadm License: GPL Group: Utilities/System BuildRoot: %{_tmppath}/%{name}-root diff --git a/raid6check.8 b/raid6check.8 index 5003343..8999ca8 100644 --- a/raid6check.8 +++ b/raid6check.8 @@ -86,7 +86,7 @@ The latest version of .I raid6check should always be available from .IP -.B http://www.kernel.org/pub/linux/utils/raid/mdadm/ +.B https://www.kernel.org/pub/linux/utils/raid/mdadm/ .PP Related man pages: .PP diff --git a/restripe.c b/restripe.c index 86e1d00..a7a7229 100644 --- a/restripe.c +++ b/restripe.c @@ -333,7 +333,7 @@ void make_tables(void) /* Compute log and inverse log */ /* Modified code from: - * http://web.eecs.utk.edu/~plank/plank/papers/CS-96-332.html + * https://web.eecs.utk.edu/~plank/plank/papers/CS-96-332.html */ b = 1; raid6_gflog[0] = 0; diff --git a/udev-md-raid-safe-timeouts.rules b/udev-md-raid-safe-timeouts.rules index 13c23d8..12bdcaa 100644 --- a/udev-md-raid-safe-timeouts.rules +++ b/udev-md-raid-safe-timeouts.rules @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with mdraid-safe-timeouts. If not, see -# <http://www.gnu.org/licenses/>. +# <https://www.gnu.org/licenses/>. # This file causes block devices with Linux RAID (mdadm) signatures to # attempt to set safe timeouts for the drives involved -- 2.26.2 ++++++ 0090-Update-link-to-Intel-page-for-IMSM.patch ++++++ >From bcf40dbb5bf7db9d55a877b805ebb95c2008a132 Mon Sep 17 00:00:00 2001 From: Jes Sorensen <[email protected]> Date: Fri, 12 Jun 2020 10:49:11 -0400 Subject: [PATCH 85/89] Update link to Intel page for IMSM Commit: bcf40dbb5bf7db9d55a877b805ebb95c2008a132 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 The old design page is gone, so update to the current overview page. Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- mdadm.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mdadm.8.in b/mdadm.8.in index 7f32762..1474602 100644 --- a/mdadm.8.in +++ b/mdadm.8.in @@ -367,7 +367,7 @@ Use the Intel(R) Matrix Storage Manager metadata format. This creates a which is managed in a similar manner to DDF, and is supported by an option-rom on some platforms: .IP -.B https://www.intel.com/design/chipsets/matrixstorage_sb.htm +.B https://www.intel.com/content/www/us/en/support/products/122484/memory-and-storage/ssd-software/intel-virtual-raid-on-cpu-intel-vroc.html .PP .RE -- 2.26.2 ++++++ 0091-mdadm-Grow-prevent-md-s-fd-from-being-occupied-durin.patch ++++++ >From 77b72fa828132a35c8b2e08d3fb07eea80b11895 Mon Sep 17 00:00:00 2001 From: allenpeng <[email protected]> Date: Fri, 12 Jun 2020 17:00:39 +0800 Subject: [PATCH 86/89] mdadm/Grow: prevent md's fd from being occupied during delayed time Commit: 77b72fa828132a35c8b2e08d3fb07eea80b11895 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 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 <[email protected]> Reviewed-by: BingJing Chang <[email protected]> Reviewed-by: Danny Shih <[email protected]> Signed-off-by: ChangSyun Peng <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- 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.26.2 ++++++ 0092-Specify-nodes-number-when-updating-cluster-nodes.patch ++++++ >From 138a9e9bbe2622eafc90c976b82f3d84895dbebd Mon Sep 17 00:00:00 2001 From: Xiao Ni <[email protected]> Date: Mon, 27 Jul 2020 09:14:20 +0800 Subject: [PATCH 87/89] Specify nodes number when updating cluster nodes Commit: 138a9e9bbe2622eafc90c976b82f3d84895dbebd Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Now it allows updating cluster nodes without specify --nodes. It can write superblock with zero nodes. It can break the current cluster. Add this check to avoid this problem. v2: It needs check c.update first to avoid NULL pointer reference v3: Wol points the typo error Signed-off-by: Xiao Ni <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- mdadm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mdadm.c b/mdadm.c index 13dc24e..1b3467f 100644 --- a/mdadm.c +++ b/mdadm.c @@ -1433,6 +1433,11 @@ int main(int argc, char *argv[]) } } + if (c.update && strcmp(c.update, "nodes") == 0 && c.nodes == 0) { + pr_err("Please specify nodes number with --nodes\n"); + exit(1); + } + if (c.backup_file && data_offset != INVALID_SECTORS) { pr_err("--backup-file and --data-offset are incompatible\n"); exit(2); -- 2.26.2 ++++++ 0093-mdadm-md.4-update-path-to-in-kernel-tree-documentati.patch ++++++ >From 5e592e1ed809b94670872b7a4629317fc1c8a5c1 Mon Sep 17 00:00:00 2001 From: Winston Weinert <[email protected]> Date: Wed, 22 Jul 2020 08:33:22 -0500 Subject: [PATCH 88/89] mdadm/md.4: update path to in-kernel-tree documentation Commit: 5e592e1ed809b94670872b7a4629317fc1c8a5c1 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 Documentation/md.txt was renamed to Documentation/admin-guide/md.rst in linux commit 9d85025b0418163fae079c9ba8f8445212de8568 (Oct 26, 2016). Signed-off-by: Winston Weinert <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- md.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/md.4 b/md.4 index 0712af2..aecff38 100644 --- a/md.4 +++ b/md.4 @@ -1061,7 +1061,7 @@ which contains various files for providing access to information about the array. This interface is documented more fully in the file -.B Documentation/md.txt +.B Documentation/admin-guide/md.rst which is distributed with the kernel sources. That file should be consulted for full documentation. The following are just a selection of attribute files that are available. -- 2.26.2 ++++++ 0094-manual-update-examine-badblocks.patch ++++++ >From 5f4184557a98bb641a7889e280265109c73e2f43 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk <[email protected]> Date: Thu, 6 Aug 2020 13:57:50 +0200 Subject: [PATCH 89/89] manual: update --examine-badblocks Commit: 5f4184557a98bb641a7889e280265109c73e2f43 Patch-mainline: mdadm-4.1+ References: jsc#SLE-13700 IMSM also supports it. Signed-off-by: Mariusz Tkaczyk <[email protected]> Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Coly Li <[email protected]> --- mdadm.8.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mdadm.8.in b/mdadm.8.in index 1474602..ab832e8 100644 --- a/mdadm.8.in +++ b/mdadm.8.in @@ -1695,9 +1695,11 @@ does not report the bitmap for that array. .TP .B \-\-examine\-badblocks List the bad-blocks recorded for the device, if a bad-blocks list has -been configured. Currently only +been configured. Currently only .B 1.x -metadata supports bad-blocks lists. +and +.B IMSM +metadata support bad-blocks lists. .TP .BI \-\-dump= directory -- 2.26.2 ++++++ 1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch ++++++ >From 2361620a9d78a4e26ec438b5cc21fe796d411497 Mon Sep 17 00:00:00 2001 From: Coly Li <[email protected]> Date: Mon, 31 Aug 2020 00:02:10 +0800 Subject: [PATCH] mdadm: treat the Dell softraid array as local array Patch-mainline: N/A, in-house usage only as a workaround to Dell's softraid bug References: bsc#1175004 Dell softraid FW uses homehost in md raid superblock to store its virtual disk name e.g. "VirtualDisk01". The improper usage of md raid super block meta data from Dell softraid S150 utility makes mdadm takes such md raid (Dell softraid Virtual Disk) as foreign array and won't automatically assemble this array by default. Here if an array's homehost name starts with "VirtualDisk" then we take it as a Dell software raid and bypass the set_name checking. This workaround makes current Dell software raid array can be treated as local array and start automatically. This workaround patch will be withdrawn after Dell softraid FW fixes the improper usage problem on md raid superblock. Signed-off-by: Coly Li <[email protected]> --- super1.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/super1.c b/super1.c index 7664883..d15067a 100644 --- a/super1.c +++ b/super1.c @@ -954,8 +954,25 @@ static int examine_badblocks_super1(struct supertype *st, int fd, char *devname) static int match_home1(struct supertype *st, char *homehost) { struct mdp_superblock_1 *sb = st->sb; - int l = homehost ? strlen(homehost) : 0; + char *dell_softraid_header = "VirtualDisk"; + int l = strlen(dell_softraid_header); + + /* + * Dell softraid FW uses homehost in md raid superblock to store + * its virtual disk name e.g. "VirtualDisk01". The improper usage + * of md raid super block meta data from Dell softraid S150 utility + * makes mdadm takes such md raid (Dell softraid Virtual Disk) as + * foreign array and won't automatically assemble this array by + * default. Here if an array's homehost name starts with "VirtualDisk" + * then we take it as a Dell software raid and bypass the set_name + * checking. This workaround makes current Dell software raid array + * can be treated as local array and start automatically. + */ + if (strncmp(sb->set_name, dell_softraid_header, l) == 0) + return 1; + /* Normal cases handleing */ + l = homehost ? strlen(homehost) : 0; return (l > 0 && l < 32 && sb->set_name[l] == ':' && strncmp(sb->set_name, homehost, l) == 0); } -- 2.26.2
