From 0c526cb9ed4720380abaafd2a39554220e28291b Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Wed, 17 May 2023 15:20:57 +0300 Subject: [PATCH] import mdadm-4.2-8.el9 --- SOURCES/0001-Unify-error-message.patch | 4 +- SOURCES/0002-mdadm-Fix-double-free.patch | 4 +- ...-r0-grow-size-error-message-and-upda.patch | 4 +- ...004-udev-adapt-rules-to-systemd-v247.patch | 4 +- ...ce-error-prone-signal-with-sigaction.patch | 4 +- ...-Respect-config-file-location-in-man.patch | 4 +- SOURCES/0007-mdadm-Update-ReadMe.patch | 4 +- ...fig-man-regarding-default-files-and-.patch | 4 +- SOURCES/0009-mdadm-Update-config-manual.patch | 4 +- ...0010-Create-Build-use-default_layout.patch | 4 +- SOURCES/0011-mdadm-add-map_num_s.patch | 4 +- ...mdmon-Stop-parsing-duplicate-options.patch | 4 +- ...014-Grow-block-n-on-external-volumes.patch | 4 +- ...x-possible-memory-and-resource-leaks.patch | 4 +- SOURCES/0016-Mdmonitor-Fix-segfault.patch | 4 +- ...017-Mdmonitor-Improve-logging-method.patch | 4 +- ...LL-ptr-dereferences-and-memory-leaks.patch | 4 +- ...ibility-for-get_imsm_dev-to-return-N.patch | 4 +- ...dadm-fix-coredump-of-mdadm-monitor-r.patch | 4 +- ...util-replace-ioctl-use-with-function.patch | 4 +- ...tore-commit-45a87c2f31335-to-fix-clu.patch | 4 +- ...-imsm-introduce-get_disk_slot_in_dev.patch | 4 +- ...-imsm-use-same-slot-across-container.patch | 4 +- ...block-changing-slots-during-creation.patch | 4 +- ...ck-update-ppl-for-non-raid456-levels.patch | 4 +- ...m-Fix-array-size-mismatch-after-grow.patch | 4 +- ...-dead-code-in-imsm_fix_size_mismatch.patch | 4 +- ...ame-as-char-array-instead-of-pointer.patch | 4 +- ...tor-use-snprintf-to-fill-device-name.patch | 4 +- ...uild-static-build-with-everything-an.patch | 4 +- ...anup-validate_geometry_ddf_container.patch | 4 +- ...nter-dereference-in-validate_geometr.patch | 4 +- ...se-after-close-bug-by-closing-after-.patch | 4 +- ...gfault-when-calling-NULL-get_bad_blo.patch | 4 +- ...Fix-mdadm-r-remove-option-regression.patch | 4 +- ...-Fix-optional-write-behind-parameter.patch | 4 +- ...d-a-test-that-validates-raid0-with-l.patch | 4 +- ...ts-fix-raid0-tests-for-0.90-metadata.patch | 4 +- ...etadata-avoid-passing-chunk-size-to-.patch | 4 +- ...ow-clear-the-superblock-at-every-ite.patch | 4 +- ...Add-a-mode-to-repeat-specified-tests.patch | 4 +- ...Mark-and-ignore-broken-test-failures.patch | 4 +- ...dd-broken-files-for-all-broken-tests.patch | 4 +- ...place-obsolete-usleep-with-nanosleep.patch | 4 +- ...-Run-udevadm-settle-before-setting-r.patch | 4 +- SOURCES/0047-tests-add-test-for-names.patch | 4 +- .../0048-mdadm-remove-symlink-option.patch | 4 +- ...adm-move-data_offset-to-struct-shape.patch | 4 +- ...en-md-device-for-CREATE-and-ASSEMBLE.patch | 4 +- ...it-Grow_reshape-into-helper-function.patch | 4 +- ...f-device-is-container-before-schedul.patch | 4 +- .../0053-super1-report-truncated-device.patch | 112 ++++ ...typos-punctuation-and-grammar-in-man.patch | 616 ++++++++++++++++++ ...5-Manage-Block-unsafe-member-failing.patch | 91 +++ ...6-Monitor-Fix-statelist-memory-leaks.patch | 112 ++++ ...ort-for-Intel-Alderlake-RST-on-VMD-p.patch | 64 ++ ...entation-entries-to-systemd-services.patch | 111 ++++ .../0059-ReadMe-fix-command-line-help.patch | 32 + ...container-level-checking-with-inline.patch | 257 ++++++++ .../0061-Mdmonitor-Omit-non-md-devices.patch | 58 ++ ...-Split-alert-into-separate-functions.patch | 233 +++++++ ...-block-if-monitor-modes-are-combined.patch | 41 ++ .../0064-Update-mdadm-Monitor-manual.patch | 119 ++++ .../0065-Grow-fix-possible-memory-leak.patch | 38 ++ SOURCES/0066-mdadm-create-ident_init.patch | 148 +++++ ...ption-validation-for-update-subarray.patch | 287 ++++++++ ...Fix-update-subarray-on-active-volume.patch | 54 ++ ...code-specific-update-options-to-enum.patch | 77 +++ ...70-super-ddf-Remove-update_super_ddf.patch | 106 +++ ...71-super0-refactor-the-code-for-enum.patch | 212 ++++++ ...72-super1-refactor-the-code-for-enum.patch | 302 +++++++++ ...per-intel-refactor-the-code-for-enum.patch | 106 +++ ...-enum-in-update_super-and-update_sub.patch | 424 ++++++++++++ ...emental-code-refactor-string-to-enum.patch | 279 ++++++++ ...enum-in-context-update-refactor-code.patch | 289 ++++++++ SOURCES/0077-mdmon-fix-segfault.patch | 86 +++ ...emove-obsolete-code-from-get_md_name.patch | 116 ++++ ...t-handle-change-event-on-raw-devices.patch | 54 ++ ...eck-array-state-when-drive-is-remove.patch | 33 + ...nage-do-not-verify-if-remove-is-safe.patch | 59 ++ ...-freesize-not-required-for-chunk-siz.patch | 52 ++ ...ve-comment-with-function-description.patch | 105 +++ SOURCES/mdadm-3.3-udev.patch | 13 - SOURCES/mdadm-udev.patch | 26 + SOURCES/mdadm.rules | 69 -- SPECS/mdadm.spec | 179 +++-- 86 files changed, 4910 insertions(+), 254 deletions(-) create mode 100644 SOURCES/0053-super1-report-truncated-device.patch create mode 100644 SOURCES/0054-mdadm-Correct-typos-punctuation-and-grammar-in-man.patch create mode 100644 SOURCES/0055-Manage-Block-unsafe-member-failing.patch create mode 100644 SOURCES/0056-Monitor-Fix-statelist-memory-leaks.patch create mode 100644 SOURCES/0057-mdadm-added-support-for-Intel-Alderlake-RST-on-VMD-p.patch create mode 100644 SOURCES/0058-mdadm-Add-Documentation-entries-to-systemd-services.patch create mode 100644 SOURCES/0059-ReadMe-fix-command-line-help.patch create mode 100644 SOURCES/0060-mdadm-replace-container-level-checking-with-inline.patch create mode 100644 SOURCES/0061-Mdmonitor-Omit-non-md-devices.patch create mode 100644 SOURCES/0062-Mdmonitor-Split-alert-into-separate-functions.patch create mode 100644 SOURCES/0063-Monitor-block-if-monitor-modes-are-combined.patch create mode 100644 SOURCES/0064-Update-mdadm-Monitor-manual.patch create mode 100644 SOURCES/0065-Grow-fix-possible-memory-leak.patch create mode 100644 SOURCES/0066-mdadm-create-ident_init.patch create mode 100644 SOURCES/0067-mdadm-Add-option-validation-for-update-subarray.patch create mode 100644 SOURCES/0068-Fix-update-subarray-on-active-volume.patch create mode 100644 SOURCES/0069-Add-code-specific-update-options-to-enum.patch create mode 100644 SOURCES/0070-super-ddf-Remove-update_super_ddf.patch create mode 100644 SOURCES/0071-super0-refactor-the-code-for-enum.patch create mode 100644 SOURCES/0072-super1-refactor-the-code-for-enum.patch create mode 100644 SOURCES/0073-super-intel-refactor-the-code-for-enum.patch create mode 100644 SOURCES/0074-Change-update-to-enum-in-update_super-and-update_sub.patch create mode 100644 SOURCES/0075-Manage-Incremental-code-refactor-string-to-enum.patch create mode 100644 SOURCES/0076-Change-char-to-enum-in-context-update-refactor-code.patch create mode 100644 SOURCES/0077-mdmon-fix-segfault.patch create mode 100644 SOURCES/0078-util-remove-obsolete-code-from-get_md_name.patch create mode 100644 SOURCES/0079-mdadm-udev-Don-t-handle-change-event-on-raw-devices.patch create mode 100644 SOURCES/0080-Manage-do-not-check-array-state-when-drive-is-remove.patch create mode 100644 SOURCES/0081-incremental-manage-do-not-verify-if-remove-is-safe.patch create mode 100644 SOURCES/0082-super-intel-make-freesize-not-required-for-chunk-siz.patch create mode 100644 SOURCES/0083-manage-move-comment-with-function-description.patch delete mode 100644 SOURCES/mdadm-3.3-udev.patch create mode 100644 SOURCES/mdadm-udev.patch delete mode 100644 SOURCES/mdadm.rules diff --git a/SOURCES/0001-Unify-error-message.patch b/SOURCES/0001-Unify-error-message.patch index b4ceb95..14dc69c 100644 --- a/SOURCES/0001-Unify-error-message.patch +++ b/SOURCES/0001-Unify-error-message.patch @@ -1,7 +1,7 @@ From f1cc8ab9ab6a92c3cd94ab7590b46285e214681e Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Tue, 15 Mar 2022 09:30:30 +0100 -Subject: [PATCH 01/12] Unify error message. +Subject: [PATCH 01/83] Unify error message. Provide the same error message for the same error that can occur in Grow.c and super-intel.c. @@ -43,5 +43,5 @@ index d5fad102..5ffa7636 100644 } } -- -2.31.1 +2.38.1 diff --git a/SOURCES/0002-mdadm-Fix-double-free.patch b/SOURCES/0002-mdadm-Fix-double-free.patch index d3e1db1..e6b7d37 100644 --- a/SOURCES/0002-mdadm-Fix-double-free.patch +++ b/SOURCES/0002-mdadm-Fix-double-free.patch @@ -1,7 +1,7 @@ From 5ce5a15f0bf007e850e15259bba4f53736605fb2 Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Fri, 25 Mar 2022 12:48:59 +0100 -Subject: [PATCH 02/12] mdadm: Fix double free +Subject: [PATCH 02/83] mdadm: Fix double free If there was a size mismatch after creation it would get fixed on grow in imsm_fix_size_mismatch(), but due to double free "double free or corruption (fasttop)" @@ -29,5 +29,5 @@ index 5ffa7636..6ff336ee 100644 ret_val = 0; exit: -- -2.31.1 +2.38.1 diff --git a/SOURCES/0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch b/SOURCES/0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch index a36866b..e43cdaa 100644 --- a/SOURCES/0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch +++ b/SOURCES/0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch @@ -1,7 +1,7 @@ From fea026b4849182fc8413014c81456e7215af28d9 Mon Sep 17 00:00:00 2001 From: Mateusz Kusiak Date: Wed, 23 Mar 2022 15:05:19 +0100 -Subject: [PATCH 03/12] Grow_reshape: Add r0 grow size error message and update +Subject: [PATCH 03/83] Grow_reshape: Add r0 grow size error message and update man Grow size on r0 is not supported for imsm and native metadata. @@ -79,5 +79,5 @@ index be902dba..e2a42425 100644 .BR \-Z ", " \-\-array\-size= This is only meaningful with -- -2.31.1 +2.38.1 diff --git a/SOURCES/0004-udev-adapt-rules-to-systemd-v247.patch b/SOURCES/0004-udev-adapt-rules-to-systemd-v247.patch index c1bcb29..a755c53 100644 --- a/SOURCES/0004-udev-adapt-rules-to-systemd-v247.patch +++ b/SOURCES/0004-udev-adapt-rules-to-systemd-v247.patch @@ -1,7 +1,7 @@ From cf9a109209aad285372b67306d54118af6fc522b Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Fri, 14 Jan 2022 16:44:33 +0100 -Subject: [PATCH 04/12] udev: adapt rules to systemd v247 +Subject: [PATCH 04/83] udev: adapt rules to systemd v247 New events have been added in kernel 4.14 ("bind" and "unbind"). Systemd maintainer suggests to modify "add|change" branches. @@ -63,5 +63,5 @@ index 12bdcaa8..2e185cee 100644 ENV{MD_LEVEL}=="raid[1-9]*", \ TEST=="/sys/block/$parent/device/timeout", \ -- -2.31.1 +2.38.1 diff --git a/SOURCES/0005-Replace-error-prone-signal-with-sigaction.patch b/SOURCES/0005-Replace-error-prone-signal-with-sigaction.patch index 34552bb..dd04b8c 100644 --- a/SOURCES/0005-Replace-error-prone-signal-with-sigaction.patch +++ b/SOURCES/0005-Replace-error-prone-signal-with-sigaction.patch @@ -1,7 +1,7 @@ From 83a379cfbd283b387919fe05d44eb4c49e155ad6 Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Mon, 21 Feb 2022 13:05:20 +0100 -Subject: [PATCH 05/12] Replace error prone signal() with sigaction() +Subject: [PATCH 05/83] Replace error prone signal() with sigaction() Up to this date signal() was used which implementation could vary [1]. Sigaction() call is preferred. This commit introduces replacement @@ -248,5 +248,5 @@ index 3d05d074..cc94f96e 100644 -- -2.31.1 +2.38.1 diff --git a/SOURCES/0006-mdadm-Respect-config-file-location-in-man.patch b/SOURCES/0006-mdadm-Respect-config-file-location-in-man.patch index c5885b6..bee28ac 100644 --- a/SOURCES/0006-mdadm-Respect-config-file-location-in-man.patch +++ b/SOURCES/0006-mdadm-Respect-config-file-location-in-man.patch @@ -1,7 +1,7 @@ From e9dd5644843e2013a7dd1a8a5da2b9fa35837416 Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Fri, 18 Mar 2022 09:26:04 +0100 -Subject: [PATCH 06/12] mdadm: Respect config file location in man +Subject: [PATCH 06/83] mdadm: Respect config file location in man Default config file location could differ depending on OS (e.g. Debian family). This patch takes default config file into consideration when creating mdadm.man @@ -1529,5 +1529,5 @@ index 00000000..83edd008 +.BR mdadm (8), +.BR md (4). -- -2.31.1 +2.38.1 diff --git a/SOURCES/0007-mdadm-Update-ReadMe.patch b/SOURCES/0007-mdadm-Update-ReadMe.patch index 90ce556..a143a22 100644 --- a/SOURCES/0007-mdadm-Update-ReadMe.patch +++ b/SOURCES/0007-mdadm-Update-ReadMe.patch @@ -1,7 +1,7 @@ From c23400377bb3d8e98e810cd92dba478dac1dff82 Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Fri, 18 Mar 2022 09:26:05 +0100 -Subject: [PATCH 07/12] mdadm: Update ReadMe +Subject: [PATCH 07/83] mdadm: Update ReadMe Instead of hardcoded config file path give reference to config manual. @@ -44,5 +44,5 @@ index 81399765..8f873c48 100644 ; -- -2.31.1 +2.38.1 diff --git a/SOURCES/0008-mdadm-Update-config-man-regarding-default-files-and-.patch b/SOURCES/0008-mdadm-Update-config-man-regarding-default-files-and-.patch index 8375fd9..0109e9a 100644 --- a/SOURCES/0008-mdadm-Update-config-man-regarding-default-files-and-.patch +++ b/SOURCES/0008-mdadm-Update-config-man-regarding-default-files-and-.patch @@ -1,7 +1,7 @@ From 24e075c659d0a8718aabefe5af4c97195a188af7 Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Fri, 18 Mar 2022 09:26:06 +0100 -Subject: [PATCH 08/12] mdadm: Update config man regarding default files and +Subject: [PATCH 08/83] mdadm: Update config man regarding default files and multi-keyword behavior Simplify default and alternative config file and directory location references @@ -199,5 +199,5 @@ index 83edd008..dd331a6a 100644 .SH EXAMPLE DEVICE /dev/sd[bcdjkl]1 -- -2.31.1 +2.38.1 diff --git a/SOURCES/0009-mdadm-Update-config-manual.patch b/SOURCES/0009-mdadm-Update-config-manual.patch index 313b2c9..08599d5 100644 --- a/SOURCES/0009-mdadm-Update-config-manual.patch +++ b/SOURCES/0009-mdadm-Update-config-manual.patch @@ -1,7 +1,7 @@ From c33bbda5b0e127bb161fd4ad44bcfaa2a5daf153 Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Fri, 18 Mar 2022 09:26:07 +0100 -Subject: [PATCH 09/12] mdadm: Update config manual +Subject: [PATCH 09/83] mdadm: Update config manual Add missing HOMECLUSTER keyword description. @@ -41,5 +41,5 @@ index dd331a6a..cd4e6a9d 100644 .B AUTO A list of names of metadata format can be given, each preceded by a -- -2.31.1 +2.38.1 diff --git a/SOURCES/0010-Create-Build-use-default_layout.patch b/SOURCES/0010-Create-Build-use-default_layout.patch index a15ae3e..7f9791b 100644 --- a/SOURCES/0010-Create-Build-use-default_layout.patch +++ b/SOURCES/0010-Create-Build-use-default_layout.patch @@ -1,7 +1,7 @@ From 913f07d1db4a0078acc26d6ccabe1c315cf9273c Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Thu, 20 Jan 2022 13:18:32 +0100 -Subject: [PATCH 10/12] Create, Build: use default_layout() +Subject: [PATCH 10/83] Create, Build: use default_layout() This code is duplicated for Build mode so make default_layout() extern and use it. Simplify the function structure. @@ -149,5 +149,5 @@ index 26e7e5cd..cd72e711 100644 extern int parse_layout_10(char *layout); extern int parse_layout_faulty(char *layout); -- -2.31.1 +2.38.1 diff --git a/SOURCES/0011-mdadm-add-map_num_s.patch b/SOURCES/0011-mdadm-add-map_num_s.patch index 196d47d..ee2c755 100644 --- a/SOURCES/0011-mdadm-add-map_num_s.patch +++ b/SOURCES/0011-mdadm-add-map_num_s.patch @@ -1,7 +1,7 @@ From 5f21d67472ad08c1e96b4385254adba79aa1c467 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Thu, 20 Jan 2022 13:18:33 +0100 -Subject: [PATCH 11/12] mdadm: add map_num_s() +Subject: [PATCH 11/83] mdadm: add map_num_s() map_num() returns NULL if key is not defined. This patch adds alternative, non NULL version for cases where NULL is not expected. @@ -378,5 +378,5 @@ index 2995713d..0d98a65f 100644 info->consistency_policy = CONSISTENCY_POLICY_RESYNC; } -- -2.31.1 +2.38.1 diff --git a/SOURCES/0013-mdmon-Stop-parsing-duplicate-options.patch b/SOURCES/0013-mdmon-Stop-parsing-duplicate-options.patch index fed1740..77324cf 100644 --- a/SOURCES/0013-mdmon-Stop-parsing-duplicate-options.patch +++ b/SOURCES/0013-mdmon-Stop-parsing-duplicate-options.patch @@ -1,7 +1,7 @@ From 1066ab83dbe9a4cc20f7db44a40aa2cbb9d5eed6 Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Fri, 13 May 2022 09:19:42 +0200 -Subject: [PATCH 13/52] mdmon: Stop parsing duplicate options +Subject: [PATCH 13/83] mdmon: Stop parsing duplicate options Introduce new function is_duplicate_opt() to check if given option was already used and prevent setting it again along with an error @@ -118,5 +118,5 @@ index 5570574b..c057da63 100644 struct mdstat_ent *mdstat, *e; int container_len = strlen(container_name); -- -2.31.1 +2.38.1 diff --git a/SOURCES/0014-Grow-block-n-on-external-volumes.patch b/SOURCES/0014-Grow-block-n-on-external-volumes.patch index 25ffac1..4e6a874 100644 --- a/SOURCES/0014-Grow-block-n-on-external-volumes.patch +++ b/SOURCES/0014-Grow-block-n-on-external-volumes.patch @@ -1,7 +1,7 @@ From 20e114e334ed6ed3280c37a9a08fb95578393d1a Mon Sep 17 00:00:00 2001 From: Mateusz Kusiak Date: Thu, 19 May 2022 09:16:08 +0200 -Subject: [PATCH 14/52] Grow: block -n on external volumes. +Subject: [PATCH 14/83] Grow: block -n on external volumes. Performing --raid-devices on external metadata volume should be blocked as it causes unwanted behaviour. @@ -37,5 +37,5 @@ index 8a242b0f..f6efbc48 100644 return 1; } -- -2.31.1 +2.38.1 diff --git a/SOURCES/0015-Incremental-Fix-possible-memory-and-resource-leaks.patch b/SOURCES/0015-Incremental-Fix-possible-memory-and-resource-leaks.patch index 42fa773..51a9e0f 100644 --- a/SOURCES/0015-Incremental-Fix-possible-memory-and-resource-leaks.patch +++ b/SOURCES/0015-Incremental-Fix-possible-memory-and-resource-leaks.patch @@ -1,7 +1,7 @@ From de064c93e3819d72720e4fba6575265ba10e1553 Mon Sep 17 00:00:00 2001 From: Mateusz Grzonka Date: Mon, 13 Jun 2022 12:11:25 +0200 -Subject: [PATCH 15/52] Incremental: Fix possible memory and resource leaks +Subject: [PATCH 15/83] Incremental: Fix possible memory and resource leaks map allocated through map_by_uuid() is not freed if mdfd is invalid. In addition mdfd is not closed, and mdinfo list is not freed too. @@ -86,5 +86,5 @@ index a57fc323..4d0cd9d6 100644 static void run_udisks(char *arg1, char *arg2) -- -2.31.1 +2.38.1 diff --git a/SOURCES/0016-Mdmonitor-Fix-segfault.patch b/SOURCES/0016-Mdmonitor-Fix-segfault.patch index 05c7fb4..61c64ab 100644 --- a/SOURCES/0016-Mdmonitor-Fix-segfault.patch +++ b/SOURCES/0016-Mdmonitor-Fix-segfault.patch @@ -1,7 +1,7 @@ From e702f392959d1c2ad2089e595b52235ed97b4e18 Mon Sep 17 00:00:00 2001 From: Kinga Tanska Date: Mon, 6 Jun 2022 12:32:12 +0200 -Subject: [PATCH 16/52] Mdmonitor: Fix segfault +Subject: [PATCH 16/83] Mdmonitor: Fix segfault Mdadm with "--monitor" parameter requires md device as an argument to be monitored. If given argument is @@ -94,5 +94,5 @@ index 245be537..d18c9319 100644 { static char devnm[32]; -- -2.31.1 +2.38.1 diff --git a/SOURCES/0017-Mdmonitor-Improve-logging-method.patch b/SOURCES/0017-Mdmonitor-Improve-logging-method.patch index f00b8b3..3c7eed2 100644 --- a/SOURCES/0017-Mdmonitor-Improve-logging-method.patch +++ b/SOURCES/0017-Mdmonitor-Improve-logging-method.patch @@ -1,7 +1,7 @@ From f5ff2988761625b43eb15555993f2797af29f166 Mon Sep 17 00:00:00 2001 From: Kinga Tanska Date: Mon, 6 Jun 2022 12:32:13 +0200 -Subject: [PATCH 17/52] Mdmonitor: Improve logging method +Subject: [PATCH 17/83] Mdmonitor: Improve logging method Change logging, and as a result, mdmonitor in verbose mode will report its configuration. @@ -57,5 +57,5 @@ index 4e5802b5..6ca1ebe5 100644 info.mailaddr = mailaddr; info.mailfrom = mailfrom; -- -2.31.1 +2.38.1 diff --git a/SOURCES/0018-Fix-possible-NULL-ptr-dereferences-and-memory-leaks.patch b/SOURCES/0018-Fix-possible-NULL-ptr-dereferences-and-memory-leaks.patch index a5e9351..24db49f 100644 --- a/SOURCES/0018-Fix-possible-NULL-ptr-dereferences-and-memory-leaks.patch +++ b/SOURCES/0018-Fix-possible-NULL-ptr-dereferences-and-memory-leaks.patch @@ -1,7 +1,7 @@ From 626bc45396c4959f2c4685c2faa7c4f553f4efdf Mon Sep 17 00:00:00 2001 From: Mateusz Grzonka Date: Mon, 13 Jun 2022 11:59:34 +0200 -Subject: [PATCH 18/52] Fix possible NULL ptr dereferences and memory leaks +Subject: [PATCH 18/83] Fix possible NULL ptr dereferences and memory leaks In Assemble there was a NULL check for sra variable, which effectively didn't stop the execution in every case. @@ -69,5 +69,5 @@ index 8cda23a7..abbc8b09 100644 } vc->phys_refnum[i_prim] = ddf->phys->entries[dl->pdnum].refnum; -- -2.31.1 +2.38.1 diff --git a/SOURCES/0019-imsm-Remove-possibility-for-get_imsm_dev-to-return-N.patch b/SOURCES/0019-imsm-Remove-possibility-for-get_imsm_dev-to-return-N.patch index 87b6db6..12dd070 100644 --- a/SOURCES/0019-imsm-Remove-possibility-for-get_imsm_dev-to-return-N.patch +++ b/SOURCES/0019-imsm-Remove-possibility-for-get_imsm_dev-to-return-N.patch @@ -1,7 +1,7 @@ From 756a15f32338fdf0c562678694bc8991ad6afb90 Mon Sep 17 00:00:00 2001 From: Mateusz Grzonka Date: Mon, 13 Jun 2022 12:00:09 +0200 -Subject: [PATCH 19/52] imsm: Remove possibility for get_imsm_dev to return +Subject: [PATCH 19/83] imsm: Remove possibility for get_imsm_dev to return NULL Returning NULL from get_imsm_dev or __get_imsm_dev will cause segfault. @@ -297,5 +297,5 @@ index ba3bd41f..3788feb9 100644 } -- -2.31.1 +2.38.1 diff --git a/SOURCES/0020-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch b/SOURCES/0020-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch index 107ac28..f51c730 100644 --- a/SOURCES/0020-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch +++ b/SOURCES/0020-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch @@ -1,7 +1,7 @@ From 190dc029b141c423e724566cbed5d5afbb10b05a Mon Sep 17 00:00:00 2001 From: Nigel Croxon Date: Mon, 18 Apr 2022 13:44:23 -0400 -Subject: [PATCH 20/52] Revert "mdadm: fix coredump of mdadm --monitor -r" +Subject: [PATCH 20/83] Revert "mdadm: fix coredump of mdadm --monitor -r" This reverts commit 546047688e1c64638f462147c755b58119cabdc8. @@ -81,5 +81,5 @@ index 8f873c48..bec1be9a 100644 struct option long_options[] = { {"manage", 0, 0, ManageOpt}, -- -2.31.1 +2.38.1 diff --git a/SOURCES/0021-util-replace-ioctl-use-with-function.patch b/SOURCES/0021-util-replace-ioctl-use-with-function.patch index 3833674..56ee5e8 100644 --- a/SOURCES/0021-util-replace-ioctl-use-with-function.patch +++ b/SOURCES/0021-util-replace-ioctl-use-with-function.patch @@ -1,7 +1,7 @@ From 953cc7e5a485a91ddec7312c7a5d7779749fad5f Mon Sep 17 00:00:00 2001 From: Kinga Tanska Date: Tue, 21 Jun 2022 00:10:39 +0800 -Subject: [PATCH 21/52] util: replace ioctl use with function +Subject: [PATCH 21/83] util: replace ioctl use with function Replace using of ioctl calling to get md array info with special function prepared to it. @@ -27,5 +27,5 @@ index cc94f96e..38f0420e 100644 return !ret; -- -2.31.1 +2.38.1 diff --git a/SOURCES/0022-mdadm-super1-restore-commit-45a87c2f31335-to-fix-clu.patch b/SOURCES/0022-mdadm-super1-restore-commit-45a87c2f31335-to-fix-clu.patch index 360ec6e..88bba83 100644 --- a/SOURCES/0022-mdadm-super1-restore-commit-45a87c2f31335-to-fix-clu.patch +++ b/SOURCES/0022-mdadm-super1-restore-commit-45a87c2f31335-to-fix-clu.patch @@ -1,7 +1,7 @@ From 63902857b98c37c8ac4b837bb01d006b327a4532 Mon Sep 17 00:00:00 2001 From: Heming Zhao Date: Tue, 21 Jun 2022 00:10:40 +0800 -Subject: [PATCH 22/52] mdadm/super1: restore commit 45a87c2f31335 to fix +Subject: [PATCH 22/83] mdadm/super1: restore commit 45a87c2f31335 to fix clustered slot issue Commit 9d67f6496c71 ("mdadm:check the nodes when operate clustered @@ -106,5 +106,5 @@ index e3e2f954..3a0c69fd 100644 * Since the nodes num is not increased, no * need to check the space enough or not, -- -2.31.1 +2.38.1 diff --git a/SOURCES/0023-imsm-introduce-get_disk_slot_in_dev.patch b/SOURCES/0023-imsm-introduce-get_disk_slot_in_dev.patch index d979cc5..ca1d015 100644 --- a/SOURCES/0023-imsm-introduce-get_disk_slot_in_dev.patch +++ b/SOURCES/0023-imsm-introduce-get_disk_slot_in_dev.patch @@ -1,7 +1,7 @@ From 76c152ca9851e9fcdf52e8f6e7e6c09b936bdd14 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Tue, 21 Jun 2022 00:10:41 +0800 -Subject: [PATCH 23/52] imsm: introduce get_disk_slot_in_dev() +Subject: [PATCH 23/83] imsm: introduce get_disk_slot_in_dev() The routine was added to remove unnecessary get_imsm_dev() and get_imsm_map() calls, used only to determine disk slot. @@ -118,5 +118,5 @@ index 3788feb9..cd1f1e3d 100644 } -- -2.31.1 +2.38.1 diff --git a/SOURCES/0024-imsm-use-same-slot-across-container.patch b/SOURCES/0024-imsm-use-same-slot-across-container.patch index 31348e4..dc23b3c 100644 --- a/SOURCES/0024-imsm-use-same-slot-across-container.patch +++ b/SOURCES/0024-imsm-use-same-slot-across-container.patch @@ -1,7 +1,7 @@ From 6d4d9ab295de165e57b5c30e044028dbffb8f297 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Tue, 21 Jun 2022 00:10:42 +0800 -Subject: [PATCH 24/52] imsm: use same slot across container +Subject: [PATCH 24/83] imsm: use same slot across container Autolayout relies on drives order on super->disks list, but it is not quaranted by readdir() in sysfs_read(). As a result @@ -248,5 +248,5 @@ index cd1f1e3d..deef7c87 100644 */ max_size = 0; -- -2.31.1 +2.38.1 diff --git a/SOURCES/0025-imsm-block-changing-slots-during-creation.patch b/SOURCES/0025-imsm-block-changing-slots-during-creation.patch index 6de11e1..4c3b918 100644 --- a/SOURCES/0025-imsm-block-changing-slots-during-creation.patch +++ b/SOURCES/0025-imsm-block-changing-slots-during-creation.patch @@ -1,7 +1,7 @@ From 9a7df595bbe360132cb37c8b39aa1fd9ac24b43f Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Tue, 21 Jun 2022 00:10:43 +0800 -Subject: [PATCH 25/52] imsm: block changing slots during creation +Subject: [PATCH 25/83] imsm: block changing slots during creation If user specifies drives for array creation, then slot order across volumes is not preserved. @@ -118,5 +118,5 @@ index ff5d2093..00000000 -offset=$((offset+size+4096)) -imsm_check member $member4 $num_disks $level $size 1024 $offset -- -2.31.1 +2.38.1 diff --git a/SOURCES/0026-mdadm-block-update-ppl-for-non-raid456-levels.patch b/SOURCES/0026-mdadm-block-update-ppl-for-non-raid456-levels.patch index 5e9e87f..d593669 100644 --- a/SOURCES/0026-mdadm-block-update-ppl-for-non-raid456-levels.patch +++ b/SOURCES/0026-mdadm-block-update-ppl-for-non-raid456-levels.patch @@ -1,7 +1,7 @@ From 70f1ff4291b0388adca1f4c91918ce1175e8b360 Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Wed, 15 Jun 2022 14:28:39 +0200 -Subject: [PATCH 26/52] mdadm: block update=ppl for non raid456 levels +Subject: [PATCH 26/83] mdadm: block update=ppl for non raid456 levels Option ppl should be used only for raid levels 4, 5 and 6. Cancel update for other levels. @@ -173,5 +173,5 @@ index 3a0c69fd..71af860c 100644 __le64_to_cpu(sb->reshape_position); reshape_chunk = __le32_to_cpu(sb->new_chunk); -- -2.31.1 +2.38.1 diff --git a/SOURCES/0027-mdadm-Fix-array-size-mismatch-after-grow.patch b/SOURCES/0027-mdadm-Fix-array-size-mismatch-after-grow.patch index cd3e93a..02bdf9c 100644 --- a/SOURCES/0027-mdadm-Fix-array-size-mismatch-after-grow.patch +++ b/SOURCES/0027-mdadm-Fix-array-size-mismatch-after-grow.patch @@ -1,7 +1,7 @@ From 42e02e613fb0b4a2c0c0d984b9e6e2933875bb44 Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Fri, 22 Jul 2022 08:43:47 +0200 -Subject: [PATCH 27/52] mdadm: Fix array size mismatch after grow +Subject: [PATCH 27/83] mdadm: Fix array size mismatch after grow imsm_fix_size_mismatch() is invoked to fix the problem, but it couldn't proceed due to migration check. This patch allows for intended behavior. @@ -26,5 +26,5 @@ index 8ffe485c..76b947f5 100644 /* There is a difference, confirm that imsm_dev_size is -- -2.31.1 +2.38.1 diff --git a/SOURCES/0028-mdadm-Remove-dead-code-in-imsm_fix_size_mismatch.patch b/SOURCES/0028-mdadm-Remove-dead-code-in-imsm_fix_size_mismatch.patch index 4fde0c9..08688dd 100644 --- a/SOURCES/0028-mdadm-Remove-dead-code-in-imsm_fix_size_mismatch.patch +++ b/SOURCES/0028-mdadm-Remove-dead-code-in-imsm_fix_size_mismatch.patch @@ -1,7 +1,7 @@ From 751757620afb25a4c02746bf8368a7b5f22352ec Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Fri, 22 Jul 2022 08:43:48 +0200 -Subject: [PATCH 28/52] mdadm: Remove dead code in imsm_fix_size_mismatch +Subject: [PATCH 28/83] mdadm: Remove dead code in imsm_fix_size_mismatch imsm_create_metadata_update_for_size_change() that returns u_size value could return 0 in the past. As its behavior changed, and returned value @@ -30,5 +30,5 @@ index 76b947f5..4ddfcf94 100644 if (st->update_tail) { append_metadata_update(st, update, u_size); -- -2.31.1 +2.38.1 diff --git a/SOURCES/0029-Monitor-use-devname-as-char-array-instead-of-pointer.patch b/SOURCES/0029-Monitor-use-devname-as-char-array-instead-of-pointer.patch index c7d871d..f337ff0 100644 --- a/SOURCES/0029-Monitor-use-devname-as-char-array-instead-of-pointer.patch +++ b/SOURCES/0029-Monitor-use-devname-as-char-array-instead-of-pointer.patch @@ -1,7 +1,7 @@ From c8d1c398505b62d9129a4e711f17e4469f4327ff Mon Sep 17 00:00:00 2001 From: Kinga Tanska Date: Thu, 14 Jul 2022 09:02:10 +0200 -Subject: [PATCH 29/52] Monitor: use devname as char array instead of pointer +Subject: [PATCH 29/83] Monitor: use devname as char array instead of pointer Device name wasn't filled properly due to incorrect use of strcpy. Strcpy was used twice. Firstly to fill devname with "/dev/md/" @@ -36,5 +36,5 @@ index 6ca1ebe5..a5b11ae2 100644 if (!is_mddev(mdlist->devname)) return 1; -- -2.31.1 +2.38.1 diff --git a/SOURCES/0030-Monitor-use-snprintf-to-fill-device-name.patch b/SOURCES/0030-Monitor-use-snprintf-to-fill-device-name.patch index 83543cb..7d3b4bc 100644 --- a/SOURCES/0030-Monitor-use-snprintf-to-fill-device-name.patch +++ b/SOURCES/0030-Monitor-use-snprintf-to-fill-device-name.patch @@ -1,7 +1,7 @@ From 84d969be8f6d8a345b75f558fad26e4f62a558f6 Mon Sep 17 00:00:00 2001 From: Kinga Tanska Date: Thu, 14 Jul 2022 09:02:11 +0200 -Subject: [PATCH 30/52] Monitor: use snprintf to fill device name +Subject: [PATCH 30/83] Monitor: use snprintf to fill device name Safe string functions are propagated in Monitor.c. @@ -129,5 +129,5 @@ index a5b11ae2..93f36ac0 100644 *sl = 0; } else -- -2.31.1 +2.38.1 diff --git a/SOURCES/0031-Makefile-Don-t-build-static-build-with-everything-an.patch b/SOURCES/0031-Makefile-Don-t-build-static-build-with-everything-an.patch index 8922281..de5e49e 100644 --- a/SOURCES/0031-Makefile-Don-t-build-static-build-with-everything-an.patch +++ b/SOURCES/0031-Makefile-Don-t-build-static-build-with-everything-an.patch @@ -1,7 +1,7 @@ From 14ae4c37bce9a53da08d59d6c2d7e0946e9c9f47 Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 22 Jun 2022 14:25:06 -0600 -Subject: [PATCH 31/52] Makefile: Don't build static build with everything and +Subject: [PATCH 31/83] Makefile: Don't build static build with everything and everything-test Running the test suite requires building everything, but it seems to be @@ -38,5 +38,5 @@ index bf126033..ec1f99ed 100644 # mdadm.uclibc doesn't work on x86-64 # mdadm.tcc doesn't work.. -- -2.31.1 +2.38.1 diff --git a/SOURCES/0032-DDF-Cleanup-validate_geometry_ddf_container.patch b/SOURCES/0032-DDF-Cleanup-validate_geometry_ddf_container.patch index 99e2e6b..ec2954d 100644 --- a/SOURCES/0032-DDF-Cleanup-validate_geometry_ddf_container.patch +++ b/SOURCES/0032-DDF-Cleanup-validate_geometry_ddf_container.patch @@ -1,7 +1,7 @@ From 679bd9508a30b2a0a1baecc9a21dd6c7d8d8d7dc Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 22 Jun 2022 14:25:07 -0600 -Subject: [PATCH 32/52] DDF: Cleanup validate_geometry_ddf_container() +Subject: [PATCH 32/83] DDF: Cleanup validate_geometry_ddf_container() Move the function up so that the function declaration is not necessary and remove the unused arguments to the function. @@ -137,5 +137,5 @@ index abbc8b09..9d867f69 100644 int level, int layout, int raiddisks, int *chunk, unsigned long long size, -- -2.31.1 +2.38.1 diff --git a/SOURCES/0033-DDF-Fix-NULL-pointer-dereference-in-validate_geometr.patch b/SOURCES/0033-DDF-Fix-NULL-pointer-dereference-in-validate_geometr.patch index 3be71e7..3a53577 100644 --- a/SOURCES/0033-DDF-Fix-NULL-pointer-dereference-in-validate_geometr.patch +++ b/SOURCES/0033-DDF-Fix-NULL-pointer-dereference-in-validate_geometr.patch @@ -1,7 +1,7 @@ From 2b93288a5650bb811932836f67f30d63c5ddcfbd Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 22 Jun 2022 14:25:08 -0600 -Subject: [PATCH 33/52] DDF: Fix NULL pointer dereference in +Subject: [PATCH 33/83] DDF: Fix NULL pointer dereference in validate_geometry_ddf() A relatively recent patch added a call to validate_geometry() in @@ -45,5 +45,5 @@ index 9d867f69..949e7d15 100644 mdu_array_info_t array = { .level = level, -- -2.31.1 +2.38.1 diff --git a/SOURCES/0034-mdadm-Grow-Fix-use-after-close-bug-by-closing-after-.patch b/SOURCES/0034-mdadm-Grow-Fix-use-after-close-bug-by-closing-after-.patch index 849a475..2695f67 100644 --- a/SOURCES/0034-mdadm-Grow-Fix-use-after-close-bug-by-closing-after-.patch +++ b/SOURCES/0034-mdadm-Grow-Fix-use-after-close-bug-by-closing-after-.patch @@ -1,7 +1,7 @@ From 548e9b916f86c06e2cdb50d8f49633f9bec66c7e Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 22 Jun 2022 14:25:09 -0600 -Subject: [PATCH 34/52] mdadm/Grow: Fix use after close bug by closing after +Subject: [PATCH 34/83] mdadm/Grow: Fix use after close bug by closing after fork The test 07reshape-grow fails most of the time. But it succeeds around @@ -81,5 +81,5 @@ index 8c520d42..97f22c75 100644 * reshape will wait for them. This would mean that * the first section that we suspend will stay suspended -- -2.31.1 +2.38.1 diff --git a/SOURCES/0035-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch b/SOURCES/0035-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch index c19c1e4..ed09288 100644 --- a/SOURCES/0035-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch +++ b/SOURCES/0035-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch @@ -1,7 +1,7 @@ From 9ae62977b51dab0f4bb46b1c8ea5ebd1705b2f4d Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 22 Jun 2022 14:25:10 -0600 -Subject: [PATCH 35/52] monitor: Avoid segfault when calling NULL +Subject: [PATCH 35/83] monitor: Avoid segfault when calling NULL get_bad_blocks Not all struct superswitch implement a get_bad_blocks() function, @@ -32,5 +32,5 @@ index b877e595..820a93d0 100644 * Get a list of bad blocks for an array, then read list of * acknowledged bad blocks from kernel and compare it against metadata -- -2.31.1 +2.38.1 diff --git a/SOURCES/0036-mdadm-Fix-mdadm-r-remove-option-regression.patch b/SOURCES/0036-mdadm-Fix-mdadm-r-remove-option-regression.patch index 8bcf0c9..f091c64 100644 --- a/SOURCES/0036-mdadm-Fix-mdadm-r-remove-option-regression.patch +++ b/SOURCES/0036-mdadm-Fix-mdadm-r-remove-option-regression.patch @@ -1,7 +1,7 @@ From 6c9d9260633f2c8491985b0782cf0fbd7e51651b Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 22 Jun 2022 14:25:11 -0600 -Subject: [PATCH 36/52] mdadm: Fix mdadm -r remove option regression +Subject: [PATCH 36/83] mdadm: Fix mdadm -r remove option regression The commit noted below globally adds a parameter to the -r option but missed the fact that -r is used for another purpose: --remove. @@ -74,5 +74,5 @@ index 974415b9..163f4a49 100644 extern char short_bitmap_auto_options[]; extern struct option long_options[]; -- -2.31.1 +2.38.1 diff --git a/SOURCES/0037-mdadm-Fix-optional-write-behind-parameter.patch b/SOURCES/0037-mdadm-Fix-optional-write-behind-parameter.patch index c10712a..60cafdb 100644 --- a/SOURCES/0037-mdadm-Fix-optional-write-behind-parameter.patch +++ b/SOURCES/0037-mdadm-Fix-optional-write-behind-parameter.patch @@ -1,7 +1,7 @@ From 41edf6f45895193f4a523cb0a08d639c9ff9ccc9 Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 22 Jun 2022 14:25:12 -0600 -Subject: [PATCH 37/52] mdadm: Fix optional --write-behind parameter +Subject: [PATCH 37/83] mdadm: Fix optional --write-behind parameter The commit noted below changed the behaviour of --write-behind to require an argument. This broke the 06wrmostly test with the error: @@ -38,5 +38,5 @@ index d0c5e6de..56722ed9 100644 optarg); exit(2); -- -2.31.1 +2.38.1 diff --git a/SOURCES/0038-tests-00raid0-add-a-test-that-validates-raid0-with-l.patch b/SOURCES/0038-tests-00raid0-add-a-test-that-validates-raid0-with-l.patch index e934bed..7794e18 100644 --- a/SOURCES/0038-tests-00raid0-add-a-test-that-validates-raid0-with-l.patch +++ b/SOURCES/0038-tests-00raid0-add-a-test-that-validates-raid0-with-l.patch @@ -1,7 +1,7 @@ From 7539254342bc591717b0051734cc6c09c1b88640 Mon Sep 17 00:00:00 2001 From: Sudhakar Panneerselvam Date: Wed, 22 Jun 2022 14:25:13 -0600 -Subject: [PATCH 38/52] tests/00raid0: add a test that validates raid0 with +Subject: [PATCH 38/83] tests/00raid0: add a test that validates raid0 with layout fails for 0.9 329dfc28debb disallows the creation of raid0 with layouts for 0.9 @@ -34,5 +34,5 @@ index 8bc18985..e6b21cc4 100644 # now with no superblock mdadm -B $md0 -l0 -n5 $dev0 $dev1 $dev2 $dev3 $dev4 -- -2.31.1 +2.38.1 diff --git a/SOURCES/0039-tests-fix-raid0-tests-for-0.90-metadata.patch b/SOURCES/0039-tests-fix-raid0-tests-for-0.90-metadata.patch index ace5fbe..d897fb1 100644 --- a/SOURCES/0039-tests-fix-raid0-tests-for-0.90-metadata.patch +++ b/SOURCES/0039-tests-fix-raid0-tests-for-0.90-metadata.patch @@ -1,7 +1,7 @@ From 14c2161edb77d7294199e8aa7daa9f9d1d0ad5d7 Mon Sep 17 00:00:00 2001 From: Sudhakar Panneerselvam Date: Wed, 22 Jun 2022 14:25:14 -0600 -Subject: [PATCH 39/52] tests: fix raid0 tests for 0.90 metadata +Subject: [PATCH 39/83] tests: fix raid0 tests for 0.90 metadata Some of the test cases fail because raid0 creation fails with the error, "0.90 metadata does not support layouts for RAID0" added by commit, @@ -95,5 +95,5 @@ index 232fc1ff..08c14af7 100644 s=${ls#*/} l=${ls%/*} mdadm -CR --assume-clean -e 0.90 $md0 --level $l -n 4 -c 64 $dlist -- -2.31.1 +2.38.1 diff --git a/SOURCES/0040-tests-04update-metadata-avoid-passing-chunk-size-to-.patch b/SOURCES/0040-tests-04update-metadata-avoid-passing-chunk-size-to-.patch index 76a7586..12b291b 100644 --- a/SOURCES/0040-tests-04update-metadata-avoid-passing-chunk-size-to-.patch +++ b/SOURCES/0040-tests-04update-metadata-avoid-passing-chunk-size-to-.patch @@ -1,7 +1,7 @@ From de045db607b1ac4b70fc2a8878463e029c2ab1dc Mon Sep 17 00:00:00 2001 From: Sudhakar Panneerselvam Date: Wed, 22 Jun 2022 14:25:15 -0600 -Subject: [PATCH 40/52] tests/04update-metadata: avoid passing chunk size to +Subject: [PATCH 40/83] tests/04update-metadata: avoid passing chunk size to raid1 '04update-metadata' test fails with error, "specifying chunk size is @@ -35,5 +35,5 @@ index 08c14af7..2b72a303 100644 mdadm -S $md0 mdadm -A $md0 --update=metadata $dlist -- -2.31.1 +2.38.1 diff --git a/SOURCES/0041-tests-02lineargrow-clear-the-superblock-at-every-ite.patch b/SOURCES/0041-tests-02lineargrow-clear-the-superblock-at-every-ite.patch index 00c9367..e6b9bba 100644 --- a/SOURCES/0041-tests-02lineargrow-clear-the-superblock-at-every-ite.patch +++ b/SOURCES/0041-tests-02lineargrow-clear-the-superblock-at-every-ite.patch @@ -1,7 +1,7 @@ From a2c832465fc75202e244327b2081231dfa974617 Mon Sep 17 00:00:00 2001 From: Sudhakar Panneerselvam Date: Wed, 22 Jun 2022 14:25:16 -0600 -Subject: [PATCH 41/52] tests/02lineargrow: clear the superblock at every +Subject: [PATCH 41/83] tests/02lineargrow: clear the superblock at every iteration This fixes 02lineargrow test as prior metadata causes --add operation @@ -27,5 +27,5 @@ index e05c219d..595bf9f2 100644 + mdadm --zero /dev/loop3 done -- -2.31.1 +2.38.1 diff --git a/SOURCES/0042-mdadm-test-Add-a-mode-to-repeat-specified-tests.patch b/SOURCES/0042-mdadm-test-Add-a-mode-to-repeat-specified-tests.patch index 288ca2c..63f72dc 100644 --- a/SOURCES/0042-mdadm-test-Add-a-mode-to-repeat-specified-tests.patch +++ b/SOURCES/0042-mdadm-test-Add-a-mode-to-repeat-specified-tests.patch @@ -1,7 +1,7 @@ From a7bfcc716e235664dfb3b6c5a9590273e611ac72 Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 22 Jun 2022 14:25:17 -0600 -Subject: [PATCH 42/52] mdadm/test: Add a mode to repeat specified tests +Subject: [PATCH 42/83] mdadm/test: Add a mode to repeat specified tests Many tests fail infrequently or rarely. To help find these, add an option to run the tests multiple times by specifying --loop=N. @@ -84,5 +84,5 @@ index 711a3c7a..da6db5e0 100755 } -- -2.31.1 +2.38.1 diff --git a/SOURCES/0043-mdadm-test-Mark-and-ignore-broken-test-failures.patch b/SOURCES/0043-mdadm-test-Mark-and-ignore-broken-test-failures.patch index 5585173..52fd3e9 100644 --- a/SOURCES/0043-mdadm-test-Mark-and-ignore-broken-test-failures.patch +++ b/SOURCES/0043-mdadm-test-Mark-and-ignore-broken-test-failures.patch @@ -1,7 +1,7 @@ From 28520bf114b3b0515a48ff44fff4ecbe9ed6dfad Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 22 Jun 2022 14:25:18 -0600 -Subject: [PATCH 43/52] mdadm/test: Mark and ignore broken test failures +Subject: [PATCH 43/83] mdadm/test: Mark and ignore broken test failures Add functionality to continue if a test marked as broken fails. @@ -116,5 +116,5 @@ index da6db5e0..61d9ee83 100755 fi -- -2.31.1 +2.38.1 diff --git a/SOURCES/0044-tests-Add-broken-files-for-all-broken-tests.patch b/SOURCES/0044-tests-Add-broken-files-for-all-broken-tests.patch index 643bf3f..2484e1b 100644 --- a/SOURCES/0044-tests-Add-broken-files-for-all-broken-tests.patch +++ b/SOURCES/0044-tests-Add-broken-files-for-all-broken-tests.patch @@ -1,7 +1,7 @@ From daa86d6634761796ada1f535c13e47fdd3cc95eb Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 22 Jun 2022 14:25:19 -0600 -Subject: [PATCH 44/52] tests: Add broken files for all broken tests +Subject: [PATCH 44/83] tests: Add broken files for all broken tests Each broken file contains the rough frequency of brokeness as well as a brief explanation of what happens when it breaks. Estimates @@ -443,5 +443,5 @@ index 00000000..e91a1425 + + "should detect errors" -- -2.31.1 +2.38.1 diff --git a/SOURCES/0045-mdadm-Replace-obsolete-usleep-with-nanosleep.patch b/SOURCES/0045-mdadm-Replace-obsolete-usleep-with-nanosleep.patch index 44b6d7c..74bf834 100644 --- a/SOURCES/0045-mdadm-Replace-obsolete-usleep-with-nanosleep.patch +++ b/SOURCES/0045-mdadm-Replace-obsolete-usleep-with-nanosleep.patch @@ -1,7 +1,7 @@ From 239b3cc0b5da87e966746533b1873c439db54b16 Mon Sep 17 00:00:00 2001 From: Mateusz Grzonka Date: Fri, 12 Aug 2022 16:36:02 +0200 -Subject: [PATCH 45/52] mdadm: Replace obsolete usleep with nanosleep +Subject: [PATCH 45/83] mdadm: Replace obsolete usleep with nanosleep According to POSIX.1-2001, usleep is considered obsolete. Replace it with a wrapper that uses nanosleep, as recommended in man. @@ -312,5 +312,5 @@ index 38f0420e..ca48d976 100644 + } while (!wake_after_interrupt && errno == EINTR); +} -- -2.31.1 +2.38.1 diff --git a/SOURCES/0046-tests-00readonly-Run-udevadm-settle-before-setting-r.patch b/SOURCES/0046-tests-00readonly-Run-udevadm-settle-before-setting-r.patch index 34f81dd..5872416 100644 --- a/SOURCES/0046-tests-00readonly-Run-udevadm-settle-before-setting-r.patch +++ b/SOURCES/0046-tests-00readonly-Run-udevadm-settle-before-setting-r.patch @@ -1,7 +1,7 @@ From 39b381252c32275079344d30de18b76fda4bba26 Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 27 Jul 2022 15:52:45 -0600 -Subject: [PATCH 46/52] tests/00readonly: Run udevadm settle before setting ro +Subject: [PATCH 46/83] tests/00readonly: Run udevadm settle before setting ro In some recent kernel versions, 00readonly fails with: @@ -32,5 +32,5 @@ index 39202487..afe243b3 100644 check readonly state=$(cat /sys/block/md0/md/array_state) -- -2.31.1 +2.38.1 diff --git a/SOURCES/0047-tests-add-test-for-names.patch b/SOURCES/0047-tests-add-test-for-names.patch index b1dee23..03aee00 100644 --- a/SOURCES/0047-tests-add-test-for-names.patch +++ b/SOURCES/0047-tests-add-test-for-names.patch @@ -1,7 +1,7 @@ From b7671c82010ffc04dfaecff2dd19ef8b2283e2b6 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Tue, 19 Jul 2022 14:48:21 +0200 -Subject: [PATCH 47/52] tests: add test for names +Subject: [PATCH 47/83] tests: add test for names Current behavior is not documented and tested. This test is a base for future improvements. It is enough to test it only with native metadata, @@ -115,5 +115,5 @@ index 00000000..64b81b92 +_verify "/dev/md0" "empty" "name" +mdadm -S "/dev/md0" -- -2.31.1 +2.38.1 diff --git a/SOURCES/0048-mdadm-remove-symlink-option.patch b/SOURCES/0048-mdadm-remove-symlink-option.patch index 13f67ad..1956e2b 100644 --- a/SOURCES/0048-mdadm-remove-symlink-option.patch +++ b/SOURCES/0048-mdadm-remove-symlink-option.patch @@ -1,7 +1,7 @@ From e4a030a0d3a953b8e74c118200e58dc83c2fc608 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Tue, 19 Jul 2022 14:48:22 +0200 -Subject: [PATCH 48/52] mdadm: remove symlink option +Subject: [PATCH 48/83] mdadm: remove symlink option The option is not used. Remove it from code. @@ -172,5 +172,5 @@ index add9c0b6..93e72786 100644 Waitclean, DetailPlatform, -- -2.31.1 +2.38.1 diff --git a/SOURCES/0049-mdadm-move-data_offset-to-struct-shape.patch b/SOURCES/0049-mdadm-move-data_offset-to-struct-shape.patch index 9613654..5dca508 100644 --- a/SOURCES/0049-mdadm-move-data_offset-to-struct-shape.patch +++ b/SOURCES/0049-mdadm-move-data_offset-to-struct-shape.patch @@ -1,7 +1,7 @@ From ae5dfc56b7a96805d5a0b50eaf93b9fec8604298 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Tue, 19 Jul 2022 14:48:23 +0200 -Subject: [PATCH 49/52] mdadm: move data_offset to struct shape +Subject: [PATCH 49/83] mdadm: move data_offset to struct shape Data offset is a shape property so move it there to remove additional parameter from some functions. @@ -228,5 +228,5 @@ index 93e72786..adb7cdaa 100644 extern int Detail(char *dev, struct context *c); extern int Detail_Platform(struct superswitch *ss, int scan, int verbose, int export, char *controller_path); -- -2.31.1 +2.38.1 diff --git a/SOURCES/0050-mdadm-Don-t-open-md-device-for-CREATE-and-ASSEMBLE.patch b/SOURCES/0050-mdadm-Don-t-open-md-device-for-CREATE-and-ASSEMBLE.patch index a28efa4..c319da2 100644 --- a/SOURCES/0050-mdadm-Don-t-open-md-device-for-CREATE-and-ASSEMBLE.patch +++ b/SOURCES/0050-mdadm-Don-t-open-md-device-for-CREATE-and-ASSEMBLE.patch @@ -1,7 +1,7 @@ From 27ad4900501c615b7c6b266bf23948e5606dba53 Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe Date: Wed, 27 Jul 2022 15:52:46 -0600 -Subject: [PATCH 50/52] mdadm: Don't open md device for CREATE and ASSEMBLE +Subject: [PATCH 50/83] mdadm: Don't open md device for CREATE and ASSEMBLE The mdadm command tries to open the md device for most modes, first thing, no matter what. When running to create or assemble an array, @@ -158,5 +158,5 @@ index adb7cdaa..8208b81e 100644 extern void udev_block(char *devnm); extern void udev_unblock(void); -- -2.31.1 +2.38.1 diff --git a/SOURCES/0051-Grow-Split-Grow_reshape-into-helper-function.patch b/SOURCES/0051-Grow-Split-Grow_reshape-into-helper-function.patch index 2b5aaaf..8fe5894 100644 --- a/SOURCES/0051-Grow-Split-Grow_reshape-into-helper-function.patch +++ b/SOURCES/0051-Grow-Split-Grow_reshape-into-helper-function.patch @@ -1,7 +1,7 @@ From 7211116c295ba1f9e1fcbdc2dd2d3762855062e1 Mon Sep 17 00:00:00 2001 From: Mateusz Kusiak Date: Thu, 28 Jul 2022 20:20:53 +0800 -Subject: [PATCH 51/52] Grow: Split Grow_reshape into helper function +Subject: [PATCH 51/83] Grow: Split Grow_reshape into helper function Grow_reshape should be split into helper functions given its size. - Add helper function for preparing reshape on external metadata. @@ -227,5 +227,5 @@ index ca48d976..26ffdcea 100644 { /* like 'open', but if 'dev' matches %d:%d, create a temp -- -2.31.1 +2.38.1 diff --git a/SOURCES/0052-Assemble-check-if-device-is-container-before-schedul.patch b/SOURCES/0052-Assemble-check-if-device-is-container-before-schedul.patch index 4c4c323..52d08b8 100644 --- a/SOURCES/0052-Assemble-check-if-device-is-container-before-schedul.patch +++ b/SOURCES/0052-Assemble-check-if-device-is-container-before-schedul.patch @@ -1,7 +1,7 @@ From 5c3c3df646dd3b7e8df81152f08e9ac4ddccc671 Mon Sep 17 00:00:00 2001 From: Kinga Tanska Date: Fri, 19 Aug 2022 02:55:46 +0200 -Subject: [PATCH 52/52] Assemble: check if device is container before +Subject: [PATCH 52/83] Assemble: check if device is container before scheduling force-clean update Up to now using assemble with force flag making each array as clean. @@ -32,5 +32,5 @@ index be2160b4..1dd82a8c 100644 devices[chosen_drive].devname, c->verbose, 0, NULL); -- -2.31.1 +2.38.1 diff --git a/SOURCES/0053-super1-report-truncated-device.patch b/SOURCES/0053-super1-report-truncated-device.patch new file mode 100644 index 0000000..35cbd4b --- /dev/null +++ b/SOURCES/0053-super1-report-truncated-device.patch @@ -0,0 +1,112 @@ +From 171e9743881edf2dfb163ddff483566fbf913ccd Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Fri, 26 Aug 2022 08:55:56 +1000 +Subject: [PATCH 53/83] super1: report truncated device + +When the metadata is at the start of the device, it is possible that it +describes a device large than the one it is actually stored on. When +this happens, report it loudly in --examine. + +.... + Unused Space : before=1968 sectors, after=-2047 sectors DEVICE TOO SMALL + State : clean TRUNCATED DEVICE +.... + +Also report in --assemble so that the failure which the kernel will +report will be explained. + +mdadm: Device /dev/sdb is not large enough for data described in superblock +mdadm: no RAID superblock on /dev/sdb +mdadm: /dev/sdb has no superblock - assembly aborted + +Scenario can be demonstrated as follows: + +mdadm: Note: this array has metadata at the start and + may not be suitable as a boot device. If you plan to + store '/boot' on this device please ensure that + your boot-loader understands md/v1.x metadata, or use + --metadata=0.90 +mdadm: Defaulting to version 1.2 metadata +mdadm: array /dev/md/test started. +mdadm: stopped /dev/md/test + Unused Space : before=1968 sectors, after=-2047 sectors DEVICE TOO SMALL + State : clean TRUNCATED DEVICE + Unused Space : before=1968 sectors, after=-2047 sectors DEVICE TOO SMALL + State : clean TRUNCATED DEVICE + +Signed-off-by: NeilBrown +Signed-off-by: Jes Sorensen +--- + super1.c | 35 ++++++++++++++++++++++++++++------- + 1 file changed, 28 insertions(+), 7 deletions(-) + +diff --git a/super1.c b/super1.c +index 71af860c..58345e68 100644 +--- a/super1.c ++++ b/super1.c +@@ -406,12 +406,18 @@ static void examine_super1(struct supertype *st, char *homehost) + + st->ss->getinfo_super(st, &info, NULL); + if (info.space_after != 1 && +- !(__le32_to_cpu(sb->feature_map) & MD_FEATURE_NEW_OFFSET)) +- printf(" Unused Space : before=%llu sectors, after=%llu sectors\n", +- info.space_before, info.space_after); +- +- printf(" State : %s\n", +- (__le64_to_cpu(sb->resync_offset)+1)? "active":"clean"); ++ !(__le32_to_cpu(sb->feature_map) & MD_FEATURE_NEW_OFFSET)) { ++ printf(" Unused Space : before=%llu sectors, ", ++ info.space_before); ++ if (info.space_after < INT64_MAX) ++ printf("after=%llu sectors\n", info.space_after); ++ else ++ printf("after=-%llu sectors DEVICE TOO SMALL\n", ++ UINT64_MAX - info.space_after); ++ } ++ printf(" State : %s%s\n", ++ (__le64_to_cpu(sb->resync_offset)+1) ? "active":"clean", ++ (info.space_after > INT64_MAX) ? " TRUNCATED DEVICE" : ""); + printf(" Device UUID : "); + for (i=0; i<16; i++) { + if ((i&3)==0 && i != 0) +@@ -2206,6 +2212,7 @@ static int load_super1(struct supertype *st, int fd, char *devname) + tst.ss = &super1; + for (tst.minor_version = 0; tst.minor_version <= 2; + tst.minor_version++) { ++ tst.ignore_hw_compat = st->ignore_hw_compat; + switch(load_super1(&tst, fd, devname)) { + case 0: super = tst.sb; + if (bestvers == -1 || +@@ -2312,7 +2319,6 @@ static int load_super1(struct supertype *st, int fd, char *devname) + free(super); + return 2; + } +- st->sb = super; + + bsb = (struct bitmap_super_s *)(((char*)super)+MAX_SB_SIZE); + +@@ -2322,6 +2328,21 @@ static int load_super1(struct supertype *st, int fd, char *devname) + if (st->data_offset == INVALID_SECTORS) + st->data_offset = __le64_to_cpu(super->data_offset); + ++ if (st->minor_version >= 1 && ++ st->ignore_hw_compat == 0 && ++ (dsize < (__le64_to_cpu(super->data_offset) + ++ __le64_to_cpu(super->size)) ++ || ++ dsize < (__le64_to_cpu(super->data_offset) + ++ __le64_to_cpu(super->data_size)))) { ++ if (devname) ++ pr_err("Device %s is not large enough for data described in superblock\n", ++ devname); ++ free(super); ++ return 2; ++ } ++ st->sb = super; ++ + /* Now check on the bitmap superblock */ + if ((__le32_to_cpu(super->feature_map)&MD_FEATURE_BITMAP_OFFSET) == 0) + return 0; +-- +2.38.1 + diff --git a/SOURCES/0054-mdadm-Correct-typos-punctuation-and-grammar-in-man.patch b/SOURCES/0054-mdadm-Correct-typos-punctuation-and-grammar-in-man.patch new file mode 100644 index 0000000..c37276f --- /dev/null +++ b/SOURCES/0054-mdadm-Correct-typos-punctuation-and-grammar-in-man.patch @@ -0,0 +1,616 @@ +From 1a386f804d8392b849b3362da6b0157b0db83091 Mon Sep 17 00:00:00 2001 +From: Mateusz Grzonka +Date: Fri, 12 Aug 2022 16:52:12 +0200 +Subject: [PATCH 54/83] mdadm: Correct typos, punctuation and grammar in man + +Signed-off-by: Mateusz Grzonka +Reviewed-by: Wol +Signed-off-by: Jes Sorensen +--- + mdadm.8.in | 178 ++++++++++++++++++++++++++--------------------------- + 1 file changed, 88 insertions(+), 90 deletions(-) + +diff --git a/mdadm.8.in b/mdadm.8.in +index f2736226..70c79d1e 100644 +--- a/mdadm.8.in ++++ b/mdadm.8.in +@@ -158,7 +158,7 @@ adding new spares and removing faulty devices. + .B Misc + This is an 'everything else' mode that supports operations on active + arrays, operations on component devices such as erasing old superblocks, and +-information gathering operations. ++information-gathering operations. + .\"This mode allows operations on independent devices such as examine MD + .\"superblocks, erasing old superblocks and stopping active arrays. + +@@ -231,12 +231,12 @@ mode to be assumed. + + .TP + .BR \-h ", " \-\-help +-Display general help message or, after one of the above options, a ++Display a general help message or, after one of the above options, a + mode-specific help message. + + .TP + .B \-\-help\-options +-Display more detailed help about command line parsing and some commonly ++Display more detailed help about command-line parsing and some commonly + used options. + + .TP +@@ -266,7 +266,7 @@ the exact meaning of this option in different contexts. + + .TP + .BR \-c ", " \-\-config= +-Specify the config file or directory. If not specified, default config file ++Specify the config file or directory. If not specified, the default config file + and default conf.d directory will be used. See + .BR mdadm.conf (5) + for more details. +@@ -379,7 +379,7 @@ When creating an array, the + .B homehost + will be recorded in the metadata. For version-1 superblocks, it will + be prefixed to the array name. For version-0.90 superblocks, part of +-the SHA1 hash of the hostname will be stored in the later half of the ++the SHA1 hash of the hostname will be stored in the latter half of the + UUID. + + When reporting information about an array, any array which is tagged +@@ -388,7 +388,7 @@ for the given homehost will be reported as such. + When using Auto-Assemble, only arrays tagged for the given homehost + will be allowed to use 'local' names (i.e. not ending in '_' followed + by a digit string). See below under +-.BR "Auto Assembly" . ++.BR "Auto-Assembly" . + + The special name "\fBany\fP" can be used as a wild card. If an array + is created with +@@ -403,7 +403,7 @@ When + .I mdadm + needs to print the name for a device it normally finds the name in + .B /dev +-which refers to the device and is shortest. When a path component is ++which refers to the device and is the shortest. When a path component is + given with + .B \-\-prefer + .I mdadm +@@ -478,9 +478,9 @@ still be larger than any replacement. + + This option can be used with + .B \-\-create +-for determining initial size of an array. For external metadata, ++for determining the initial size of an array. For external metadata, + it can be used on a volume, but not on a container itself. +-Setting initial size of ++Setting the initial size of + .B RAID 0 + array is only valid for external metadata. + +@@ -545,20 +545,20 @@ Clustered arrays do not support this parameter yet. + + .TP + .BR \-c ", " \-\-chunk= +-Specify chunk size of kilobytes. The default when creating an ++Specify chunk size in kilobytes. The default when creating an + array is 512KB. To ensure compatibility with earlier versions, the + default when building an array with no persistent metadata is 64KB. + This is only meaningful for RAID0, RAID4, RAID5, RAID6, and RAID10. + + RAID4, RAID5, RAID6, and RAID10 require the chunk size to be a power +-of 2. In any case it must be a multiple of 4KB. ++of 2, with minimal chunk size being 4KB. + + A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, + Megabytes, Gigabytes or Terabytes respectively. + + .TP + .BR \-\-rounding= +-Specify rounding factor for a Linear array. The size of each ++Specify the rounding factor for a Linear array. The size of each + component will be rounded down to a multiple of this size. + This is a synonym for + .B \-\-chunk +@@ -655,7 +655,8 @@ option to set subsequent failure modes. + and "flush" will clear any persistent faults. + + The layout options for RAID10 are one of 'n', 'o' or 'f' followed +-by a small number. The default is 'n2'. The supported options are: ++by a small number signifying the number of copies of each datablock. ++The default is 'n2'. The supported options are: + + .I 'n' + signals 'near' copies. Multiple copies of one data block are at +@@ -673,7 +674,7 @@ signals 'far' copies + (multiple copies have very different offsets). + See md(4) for more detail about 'near', 'offset', and 'far'. + +-The number is the number of copies of each datablock. 2 is normal, 3 ++As for the number of copies of each data block, 2 is normal, 3 + can be useful. This number can be at most equal to the number of + devices in the array. It does not need to divide evenly into that + number (e.g. it is perfectly legal to have an 'n2' layout for an array +@@ -684,7 +685,7 @@ A bug introduced in Linux 3.14 means that RAID0 arrays + started using a different layout. This could lead to + data corruption. Since Linux 5.4 (and various stable releases that received + backports), the kernel will not accept such an array unless +-a layout is explictly set. It can be set to ++a layout is explicitly set. It can be set to + .RB ' original ' + or + .RB ' alternate '. +@@ -760,13 +761,13 @@ or by selecting a different consistency policy with + + .TP + .BR \-\-bitmap\-chunk= +-Set the chunksize of the bitmap. Each bit corresponds to that many ++Set the chunk size of the bitmap. Each bit corresponds to that many + Kilobytes of storage. +-When using a file based bitmap, the default is to use the smallest +-size that is at-least 4 and requires no more than 2^21 chunks. ++When using a file-based bitmap, the default is to use the smallest ++size that is at least 4 and requires no more than 2^21 chunks. + When using an + .B internal +-bitmap, the chunksize defaults to 64Meg, or larger if necessary to ++bitmap, the chunk size defaults to 64Meg, or larger if necessary to + fit the bitmap into the available space. + + A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, +@@ -840,7 +841,7 @@ can be used with that command to avoid the automatic resync. + .BR \-\-backup\-file= + This is needed when + .B \-\-grow +-is used to increase the number of raid-devices in a RAID5 or RAID6 if ++is used to increase the number of raid devices in a RAID5 or RAID6 if + there are no spare devices available, or to shrink, change RAID level + or layout. See the GROW MODE section below on RAID\-DEVICES CHANGES. + The file must be stored on a separate device, not on the RAID array +@@ -879,7 +880,7 @@ When creating an array, + .B \-\-data\-offset + can be specified as + .BR variable . +-In the case each member device is expected to have a offset appended ++In the case each member device is expected to have an offset appended + to the name, separated by a colon. This makes it possible to recreate + exactly an array which has varying data offsets (as can happen when + different versions of +@@ -943,7 +944,7 @@ Insist that + .I mdadm + accept the geometry and layout specified without question. Normally + .I mdadm +-will not allow creation of an array with only one device, and will try ++will not allow the creation of an array with only one device, and will try + to create a RAID5 array with one missing drive (as this makes the + initial resync work faster). With + .BR \-\-force , +@@ -1004,7 +1005,7 @@ number added, e.g. + If the md device name is in a 'standard' format as described in DEVICE + NAMES, then it will be created, if necessary, with the appropriate + device number based on that name. If the device name is not in one of these +-formats, then a unused device number will be allocated. The device ++formats, then an unused device number will be allocated. The device + number will be considered unused if there is no active array for that + number, and there is no entry in /dev for that number and with a + non-standard name. Names that are not in 'standard' format are only +@@ -1032,25 +1033,25 @@ then + .B \-\-add + can be used to add some extra devices to be included in the array. + In most cases this is not needed as the extra devices can be added as +-spares first, and then the number of raid-disks can be changed. +-However for RAID0, it is not possible to add spares. So to increase ++spares first, and then the number of raid disks can be changed. ++However, for RAID0 it is not possible to add spares. So to increase + the number of devices in a RAID0, it is necessary to set the new + number of devices, and to add the new devices, in the same command. + + .TP + .BR \-\-nodes +-Only works when the array is for clustered environment. It specifies ++Only works when the array is created for a clustered environment. It specifies + the maximum number of nodes in the cluster that will use this device + simultaneously. If not specified, this defaults to 4. + + .TP + .BR \-\-write-journal + Specify journal device for the RAID-4/5/6 array. The journal device +-should be a SSD with reasonable lifetime. ++should be an SSD with a reasonable lifetime. + + .TP + .BR \-k ", " \-\-consistency\-policy= +-Specify how the array maintains consistency in case of unexpected shutdown. ++Specify how the array maintains consistency in the case of an unexpected shutdown. + Only relevant for RAID levels with redundancy. + Currently supported options are: + .RS +@@ -1058,7 +1059,7 @@ Currently supported options are: + .TP + .B resync + Full resync is performed and all redundancy is regenerated when the array is +-started after unclean shutdown. ++started after an unclean shutdown. + + .TP + .B bitmap +@@ -1067,8 +1068,8 @@ Resync assisted by a write-intent bitmap. Implicitly selected when using + + .TP + .B journal +-For RAID levels 4/5/6, journal device is used to log transactions and replay +-after unclean shutdown. Implicitly selected when using ++For RAID levels 4/5/6, the journal device is used to log transactions and replay ++after an unclean shutdown. Implicitly selected when using + .BR \-\-write\-journal . + + .TP +@@ -1237,7 +1238,7 @@ This can be useful if + reports a different "Preferred Minor" to + .BR \-\-detail . + In some cases this update will be performed automatically +-by the kernel driver. In particular the update happens automatically ++by the kernel driver. In particular, the update happens automatically + at the first write to an array with redundancy (RAID level 1 or + greater) on a 2.6 (or later) kernel. + +@@ -1277,7 +1278,7 @@ For version-1 superblocks, this involves updating the name. + The + .B home\-cluster + option will change the cluster name as recorded in the superblock and +-bitmap. This option only works for clustered environment. ++bitmap. This option only works for a clustered environment. + + The + .B resync +@@ -1390,10 +1391,10 @@ This option should be used with great caution. + + .TP + .BR \-\-freeze\-reshape +-Option is intended to be used in start-up scripts during initrd boot phase. +-When array under reshape is assembled during initrd phase, this option +-stops reshape after reshape critical section is being restored. This happens +-before file system pivot operation and avoids loss of file system context. ++This option is intended to be used in start-up scripts during the initrd boot phase. ++When the array under reshape is assembled during the initrd phase, this option ++stops the reshape after the reshape-critical section has been restored. This happens ++before the file system pivot operation and avoids loss of filesystem context. + Losing file system context would cause reshape to be broken. + + Reshape can be continued later using the +@@ -1437,9 +1438,9 @@ re\-add a device that was previously removed from an array. + If the metadata on the device reports that it is a member of the + array, and the slot that it used is still vacant, then the device will + be added back to the array in the same position. This will normally +-cause the data for that device to be recovered. However based on the ++cause the data for that device to be recovered. However, based on the + event count on the device, the recovery may only require sections that +-are flagged a write-intent bitmap to be recovered or may not require ++are flagged by a write-intent bitmap to be recovered or may not require + any recovery at all. + + When used on an array that has no metadata (i.e. it was built with +@@ -1447,13 +1448,12 @@ When used on an array that has no metadata (i.e. it was built with + it will be assumed that bitmap-based recovery is enough to make the + device fully consistent with the array. + +-When used with v1.x metadata, + .B \-\-re\-add +-can be accompanied by ++can also be accompanied by + .BR \-\-update=devicesize , + .BR \-\-update=bbl ", or" + .BR \-\-update=no\-bbl . +-See the description of these option when used in Assemble mode for an ++See descriptions of these options when used in Assemble mode for an + explanation of their use. + + If the device name given is +@@ -1480,7 +1480,7 @@ Add a device as a spare. This is similar to + except that it does not attempt + .B \-\-re\-add + first. The device will be added as a spare even if it looks like it +-could be an recent member of the array. ++could be a recent member of the array. + + .TP + .BR \-r ", " \-\-remove +@@ -1497,12 +1497,12 @@ and names like + .B set-A + can be given to + .BR \-\-remove . +-The first causes all failed device to be removed. The second causes ++The first causes all failed devices to be removed. The second causes + any device which is no longer connected to the system (i.e an 'open' + returns + .BR ENXIO ) + to be removed. +-The third will remove a set as describe below under ++The third will remove a set as described below under + .BR \-\-fail . + + .TP +@@ -1519,7 +1519,7 @@ For RAID10 arrays where the number of copies evenly divides the number + of devices, the devices can be conceptually divided into sets where + each set contains a single complete copy of the data on the array. + Sometimes a RAID10 array will be configured so that these sets are on +-separate controllers. In this case all the devices in one set can be ++separate controllers. In this case, all the devices in one set can be + failed by giving a name like + .B set\-A + or +@@ -1549,9 +1549,9 @@ This can follow a list of + .B \-\-replace + devices. The devices listed after + .B \-\-with +-will be preferentially used to replace the devices listed after ++will preferentially be used to replace the devices listed after + .BR \-\-replace . +-These device must already be spare devices in the array. ++These devices must already be spare devices in the array. + + .TP + .BR \-\-write\-mostly +@@ -1574,8 +1574,8 @@ the device is found or :missing in case the device is not found. + + .TP + .BR \-\-add-journal +-Add journal to an existing array, or recreate journal for RAID-4/5/6 array +-that lost a journal device. To avoid interrupting on-going write opertions, ++Add a journal to an existing array, or recreate journal for a RAID-4/5/6 array ++that lost a journal device. To avoid interrupting ongoing write operations, + .B \-\-add-journal + only works for array in Read-Only state. + +@@ -1631,9 +1631,9 @@ Print details of one or more md devices. + .TP + .BR \-\-detail\-platform + Print details of the platform's RAID capabilities (firmware / hardware +-topology) for a given metadata format. If used without argument, mdadm ++topology) for a given metadata format. If used without an argument, mdadm + will scan all controllers looking for their capabilities. Otherwise, mdadm +-will only look at the controller specified by the argument in form of an ++will only look at the controller specified by the argument in the form of an + absolute filepath or a link, e.g. + .IR /sys/devices/pci0000:00/0000:00:1f.2 . + +@@ -1742,8 +1742,8 @@ the block where the superblock would be is overwritten even if it + doesn't appear to be valid. + + .B Note: +-Be careful to call \-\-zero\-superblock with clustered raid, make sure +-array isn't used or assembled in other cluster node before execute it. ++Be careful when calling \-\-zero\-superblock with clustered raid. Make sure ++the array isn't used or assembled in another cluster node before executing it. + + .TP + .B \-\-kill\-subarray= +@@ -1790,7 +1790,7 @@ For each md device given, or each device in /proc/mdstat if + is given, arrange for the array to be marked clean as soon as possible. + .I mdadm + will return with success if the array uses external metadata and we +-successfully waited. For native arrays this returns immediately as the ++successfully waited. For native arrays, this returns immediately as the + kernel handles dirty-clean transitions at shutdown. No action is taken + if safe-mode handling is disabled. + +@@ -1830,7 +1830,7 @@ uses to help track which arrays are currently being assembled. + + .TP + .BR \-\-run ", " \-R +-Run any array assembled as soon as a minimal number of devices are ++Run any array assembled as soon as a minimal number of devices is + available, rather than waiting until all expected devices are present. + + .TP +@@ -1860,7 +1860,7 @@ Only used with \-\-fail. The 'path' given will be recorded so that if + a new device appears at the same location it can be automatically + added to the same array. This allows the failed device to be + automatically replaced by a new device without metadata if it appears +-at specified path. This option is normally only set by a ++at specified path. This option is normally only set by an + .I udev + script. + +@@ -1961,7 +1961,7 @@ Usage: + .PP + This usage assembles one or more RAID arrays from pre-existing components. + For each array, mdadm needs to know the md device, the identity of the +-array, and a number of component-devices. These can be found in a number of ways. ++array, and the number of component devices. These can be found in a number of ways. + + In the first usage example (without the + .BR \-\-scan ) +@@ -2001,7 +2001,7 @@ The config file is only used if explicitly named with + .B \-\-config + or requested with (a possibly implicit) + .BR \-\-scan . +-In the later case, default config file is used. See ++In the latter case, the default config file is used. See + .BR mdadm.conf (5) + for more details. + +@@ -2039,14 +2039,14 @@ detects that udev is not configured, it will create the devices in + .B /dev + itself. + +-In Linux kernels prior to version 2.6.28 there were two distinctly +-different types of md devices that could be created: one that could be ++In Linux kernels prior to version 2.6.28 there were two distinct ++types of md devices that could be created: one that could be + partitioned using standard partitioning tools and one that could not. +-Since 2.6.28 that distinction is no longer relevant as both type of ++Since 2.6.28 that distinction is no longer relevant as both types of + devices can be partitioned. + .I mdadm + will normally create the type that originally could not be partitioned +-as it has a well defined major number (9). ++as it has a well-defined major number (9). + + Prior to 2.6.28, it is important that mdadm chooses the correct type + of array device to use. This can be controlled with the +@@ -2066,7 +2066,7 @@ can also be given in the configuration file as a word starting + .B auto= + on the ARRAY line for the relevant array. + +-.SS Auto Assembly ++.SS Auto-Assembly + When + .B \-\-assemble + is used with +@@ -2122,11 +2122,11 @@ See + .IR mdadm.conf (5) + for further details. + +-Note: Auto assembly cannot be used for assembling and activating some ++Note: Auto-assembly cannot be used for assembling and activating some + arrays which are undergoing reshape. In particular as the + .B backup\-file +-cannot be given, any reshape which requires a backup-file to continue +-cannot be started by auto assembly. An array which is growing to more ++cannot be given, any reshape which requires a backup file to continue ++cannot be started by auto-assembly. An array which is growing to more + devices and has passed the critical section can be assembled using + auto-assembly. + +@@ -2233,7 +2233,7 @@ When creating a partition based array, using + .I mdadm + with version-1.x metadata, the partition type should be set to + .B 0xDA +-(non fs-data). This type selection allows for greater precision since ++(non fs-data). This type of selection allows for greater precision since + using any other [RAID auto-detect (0xFD) or a GNU/Linux partition (0x83)], + might create problems in the event of array recovery through a live cdrom. + +@@ -2249,7 +2249,7 @@ when creating a v0.90 array will silently override any + setting. + .\"If the + .\".B \-\-size +-.\"option is given, it is not necessary to list any component-devices in this command. ++.\"option is given, it is not necessary to list any component devices in this command. + .\"They can be added later, before a + .\".B \-\-run. + .\"If no +@@ -2263,7 +2263,7 @@ requested with the + .B \-\-bitmap + option or a different consistency policy is selected with the + .B \-\-consistency\-policy +-option. In any case space for a bitmap will be reserved so that one ++option. In any case, space for a bitmap will be reserved so that one + can be added later with + .BR "\-\-grow \-\-bitmap=internal" . + +@@ -2313,7 +2313,7 @@ will firstly mark + as faulty in + .B /dev/md0 + and will then remove it from the array and finally add it back +-in as a spare. However only one md array can be affected by a single ++in as a spare. However, only one md array can be affected by a single + command. + + When a device is added to an active array, mdadm checks to see if it +@@ -2458,14 +2458,14 @@ config file to be examined. + If the device contains RAID metadata, a file will be created in the + .I directory + and the metadata will be written to it. The file will be the same +-size as the device and have the metadata written in the file at the +-same locate that it exists in the device. However the file will be "sparse" so ++size as the device and will have the metadata written at the ++same location as it exists in the device. However, the file will be "sparse" so + that only those blocks containing metadata will be allocated. The + total space used will be small. + +-The file name used in the ++The filename used in the + .I directory +-will be the base name of the device. Further if any links appear in ++will be the base name of the device. Further, if any links appear in + .I /dev/disk/by-id + which point to the device, then hard links to the file will be created + in +@@ -2567,7 +2567,7 @@ and if the destination array has a failed drive but no spares. + + If any devices are listed on the command line, + .I mdadm +-will only monitor those devices. Otherwise all arrays listed in the ++will only monitor those devices, otherwise, all arrays listed in the + configuration file will be monitored. Further, if + .B \-\-scan + is given, then any other md devices that appear in +@@ -2624,10 +2624,10 @@ check, repair). (syslog priority: Warning) + .BI Rebuild NN + Where + .I NN +-is a two-digit number (ie. 05, 48). This indicates that rebuild +-has passed that many percent of the total. The events are generated +-with fixed increment since 0. Increment size may be specified with +-a commandline option (default is 20). (syslog priority: Warning) ++is a two-digit number (eg. 05, 48). This indicates that the rebuild ++has reached that percentage of the total. The events are generated ++at a fixed increment from 0. The increment size may be specified with ++a command-line option (the default is 20). (syslog priority: Warning) + + .TP + .B RebuildFinished +@@ -2735,8 +2735,8 @@ When + detects that an array in a spare group has fewer active + devices than necessary for the complete array, and has no spare + devices, it will look for another array in the same spare group that +-has a full complement of working drive and a spare. It will then +-attempt to remove the spare from the second drive and add it to the ++has a full complement of working drives and a spare. It will then ++attempt to remove the spare from the second array and add it to the + first. + If the removal succeeds but the adding fails, then it is added back to + the original array. +@@ -2750,10 +2750,8 @@ and then follow similar steps as above if a matching spare is found. + .SH GROW MODE + The GROW mode is used for changing the size or shape of an active + array. +-For this to work, the kernel must support the necessary change. +-Various types of growth are being added during 2.6 development. + +-Currently the supported changes include ++During the kernel 2.6 era the following changes were added: + .IP \(bu 4 + change the "size" attribute for RAID1, RAID4, RAID5 and RAID6. + .IP \(bu 4 +@@ -2796,8 +2794,8 @@ use more than half of a spare device for backup space. + + .SS SIZE CHANGES + Normally when an array is built the "size" is taken from the smallest +-of the drives. If all the small drives in an arrays are, one at a +-time, removed and replaced with larger drives, then you could have an ++of the drives. If all the small drives in an arrays are, over time, ++removed and replaced with larger drives, then you could have an + array of large drives with only a small amount used. In this + situation, changing the "size" with "GROW" mode will allow the extra + space to start being used. If the size is increased in this way, a +@@ -2812,7 +2810,7 @@ after growing, or to reduce its size + .B prior + to shrinking the array. + +-Also the size of an array cannot be changed while it has an active ++Also, the size of an array cannot be changed while it has an active + bitmap. If an array has a bitmap, it must be removed before the size + can be changed. Once the change is complete a new bitmap can be created. + +@@ -2892,7 +2890,7 @@ long time. A + is required. If the array is not simultaneously being grown or + shrunk, so that the array size will remain the same - for example, + reshaping a 3-drive RAID5 into a 4-drive RAID6 - the backup file will +-be used not just for a "cricital section" but throughout the reshape ++be used not just for a "critical section" but throughout the reshape + operation, as described below under LAYOUT CHANGES. + + .SS CHUNK-SIZE AND LAYOUT CHANGES +@@ -2910,7 +2908,7 @@ slowly. + If the reshape is interrupted for any reason, this backup file must be + made available to + .B "mdadm --assemble" +-so the array can be reassembled. Consequently the file cannot be ++so the array can be reassembled. Consequently, the file cannot be + stored on the device being reshaped. + + +-- +2.38.1 + diff --git a/SOURCES/0055-Manage-Block-unsafe-member-failing.patch b/SOURCES/0055-Manage-Block-unsafe-member-failing.patch new file mode 100644 index 0000000..290c56f --- /dev/null +++ b/SOURCES/0055-Manage-Block-unsafe-member-failing.patch @@ -0,0 +1,91 @@ +From fc6fd4063769f4194c3fb8f77b32b2819e140fb9 Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Thu, 18 Aug 2022 11:47:21 +0200 +Subject: [PATCH 55/83] Manage: Block unsafe member failing + +Kernel may or may not block mdadm from removing member device if it +will cause arrays failed state. It depends on raid personality +implementation in kernel. +Add verification on requested removal path (#mdadm --set-faulty +command). + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + Manage.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 52 insertions(+), 1 deletion(-) + +diff --git a/Manage.c b/Manage.c +index a142f8bd..b1d0e630 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -1285,6 +1285,50 @@ int Manage_with(struct supertype *tst, int fd, struct mddev_dev *dv, + return -1; + } + ++/** ++ * is_remove_safe() - Check if remove is safe. ++ * @array: Array info. ++ * @fd: Array file descriptor. ++ * @devname: Name of device to remove. ++ * @verbose: Verbose. ++ * ++ * The function determines if array will be operational ++ * after removing &devname. ++ * ++ * Return: True if array will be operational, false otherwise. ++ */ ++bool is_remove_safe(mdu_array_info_t *array, const int fd, char *devname, const int verbose) ++{ ++ dev_t devid = devnm2devid(devname + 5); ++ struct mdinfo *mdi = sysfs_read(fd, NULL, GET_DEVS | GET_DISKS | GET_STATE); ++ ++ if (!mdi) { ++ if (verbose) ++ pr_err("Failed to read sysfs attributes for %s\n", devname); ++ return false; ++ } ++ ++ char *avail = xcalloc(array->raid_disks, sizeof(char)); ++ ++ for (mdi = mdi->devs; mdi; mdi = mdi->next) { ++ if (mdi->disk.raid_disk < 0) ++ continue; ++ if (!(mdi->disk.state & (1 << MD_DISK_SYNC))) ++ continue; ++ if (makedev(mdi->disk.major, mdi->disk.minor) == devid) ++ continue; ++ avail[mdi->disk.raid_disk] = 1; ++ } ++ sysfs_free(mdi); ++ ++ bool is_enough = enough(array->level, array->raid_disks, ++ array->layout, (array->state & 1), ++ avail); ++ ++ free(avail); ++ return is_enough; ++} ++ + int Manage_subdevs(char *devname, int fd, + struct mddev_dev *devlist, int verbose, int test, + char *update, int force) +@@ -1598,7 +1642,14 @@ int Manage_subdevs(char *devname, int fd, + break; + + case 'f': /* set faulty */ +- /* FIXME check current member */ ++ if (!is_remove_safe(&array, fd, dv->devname, verbose)) { ++ pr_err("Cannot remove %s from %s, array will be failed.\n", ++ dv->devname, devname); ++ if (sysfd >= 0) ++ close(sysfd); ++ goto abort; ++ } ++ + if ((sysfd >= 0 && write(sysfd, "faulty", 6) != 6) || + (sysfd < 0 && ioctl(fd, SET_DISK_FAULTY, + rdev))) { +-- +2.38.1 + diff --git a/SOURCES/0056-Monitor-Fix-statelist-memory-leaks.patch b/SOURCES/0056-Monitor-Fix-statelist-memory-leaks.patch new file mode 100644 index 0000000..ad36a25 --- /dev/null +++ b/SOURCES/0056-Monitor-Fix-statelist-memory-leaks.patch @@ -0,0 +1,112 @@ +From 55c10e4de13abe3e6934895e1fff7d2d20d0b2c2 Mon Sep 17 00:00:00 2001 +From: Pawel Baldysiak +Date: Thu, 1 Sep 2022 11:20:31 +0200 +Subject: [PATCH 56/83] Monitor: Fix statelist memory leaks + +Free statelist in error path in Monitor initialization. + +Signed-off-by: Pawel Baldysiak +Signed-off-by: Jes Sorensen +--- + Monitor.c | 40 +++++++++++++++++++++++++++++++--------- + 1 file changed, 31 insertions(+), 9 deletions(-) + +diff --git a/Monitor.c b/Monitor.c +index 93f36ac0..b4e954c6 100644 +--- a/Monitor.c ++++ b/Monitor.c +@@ -74,6 +74,7 @@ static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist, + int test, struct alert_info *info); + static void try_spare_migration(struct state *statelist, struct alert_info *info); + static void link_containers_with_subarrays(struct state *list); ++static void free_statelist(struct state *statelist); + #ifndef NO_LIBUDEV + static int check_udev_activity(void); + #endif +@@ -128,7 +129,6 @@ int Monitor(struct mddev_dev *devlist, + */ + + struct state *statelist = NULL; +- struct state *st2; + int finished = 0; + struct mdstat_ent *mdstat = NULL; + char *mailfrom; +@@ -185,12 +185,14 @@ int Monitor(struct mddev_dev *devlist, + continue; + if (strcasecmp(mdlist->devname, "") == 0) + continue; ++ if (!is_mddev(mdlist->devname)) { ++ free_statelist(statelist); ++ return 1; ++ } + + st = xcalloc(1, sizeof *st); + snprintf(st->devname, MD_NAME_MAX + sizeof("/dev/md/"), + "/dev/md/%s", basename(mdlist->devname)); +- if (!is_mddev(mdlist->devname)) +- return 1; + st->next = statelist; + st->devnm[0] = 0; + st->percent = RESYNC_UNKNOWN; +@@ -206,8 +208,10 @@ int Monitor(struct mddev_dev *devlist, + for (dv = devlist; dv; dv = dv->next) { + struct state *st; + +- if (!is_mddev(dv->devname)) ++ if (!is_mddev(dv->devname)) { ++ free_statelist(statelist); + return 1; ++ } + + st = xcalloc(1, sizeof *st); + mdlist = conf_get_ident(dv->devname); +@@ -294,16 +298,16 @@ int Monitor(struct mddev_dev *devlist, + for (stp = &statelist; (st = *stp) != NULL; ) { + if (st->from_auto && st->err > 5) { + *stp = st->next; +- free(st->spare_group); ++ if (st->spare_group) ++ free(st->spare_group); ++ + free(st); + } else + stp = &st->next; + } + } +- for (st2 = statelist; st2; st2 = statelist) { +- statelist = st2->next; +- free(st2); +- } ++ ++ free_statelist(statelist); + + if (pidfile) + unlink(pidfile); +@@ -1056,6 +1060,24 @@ static void link_containers_with_subarrays(struct state *list) + } + } + ++/** ++ * free_statelist() - Frees statelist. ++ * @statelist: statelist to free ++ */ ++static void free_statelist(struct state *statelist) ++{ ++ struct state *tmp = NULL; ++ ++ while (statelist) { ++ if (statelist->spare_group) ++ free(statelist->spare_group); ++ ++ tmp = statelist; ++ statelist = statelist->next; ++ free(tmp); ++ } ++} ++ + #ifndef NO_LIBUDEV + /* function: check_udev_activity + * Description: Function waits for udev to finish +-- +2.38.1 + diff --git a/SOURCES/0057-mdadm-added-support-for-Intel-Alderlake-RST-on-VMD-p.patch b/SOURCES/0057-mdadm-added-support-for-Intel-Alderlake-RST-on-VMD-p.patch new file mode 100644 index 0000000..79a3262 --- /dev/null +++ b/SOURCES/0057-mdadm-added-support-for-Intel-Alderlake-RST-on-VMD-p.patch @@ -0,0 +1,64 @@ +From ea7a02a3294aae223e1329aed5da7f4aa3ac05c5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Old=C5=99ich=20Jedli=C4=8Dka?= +Date: Wed, 31 Aug 2022 19:57:29 +0200 +Subject: [PATCH 57/83] mdadm: added support for Intel Alderlake RST on VMD + platform +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Alderlake RST on VMD uses RstVmdV UEFI variable name, so detect it. + +Signed-off-by: Oldřich Jedlička +Reviewed-by: Kinga Tanska +Signed-off-by: Jes Sorensen +--- + platform-intel.c | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/platform-intel.c b/platform-intel.c +index 5a8729e7..757f0b1b 100644 +--- a/platform-intel.c ++++ b/platform-intel.c +@@ -512,7 +512,8 @@ static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba) + #define AHCI_PROP "RstSataV" + #define AHCI_SSATA_PROP "RstsSatV" + #define AHCI_TSATA_PROP "RsttSatV" +-#define VMD_PROP "RstUefiV" ++#define VROC_VMD_PROP "RstUefiV" ++#define RST_VMD_PROP "RstVmdV" + + #define VENDOR_GUID \ + EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, 0x1a, 0x04, 0xc6) +@@ -605,6 +606,7 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) + struct orom_entry *ret; + static const char * const sata_efivars[] = {AHCI_PROP, AHCI_SSATA_PROP, + AHCI_TSATA_PROP}; ++ static const char * const vmd_efivars[] = {VROC_VMD_PROP, RST_VMD_PROP}; + unsigned long i; + + if (check_env("IMSM_TEST_AHCI_EFI") || check_env("IMSM_TEST_SCU_EFI")) +@@ -636,10 +638,16 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) + + break; + case SYS_DEV_VMD: +- if (!read_efi_variable(&orom, sizeof(orom), VMD_PROP, +- VENDOR_GUID)) +- break; +- return NULL; ++ for (i = 0; i < ARRAY_SIZE(vmd_efivars); i++) { ++ if (!read_efi_variable(&orom, sizeof(orom), ++ vmd_efivars[i], VENDOR_GUID)) ++ break; ++ } ++ ++ if (i == ARRAY_SIZE(vmd_efivars)) ++ return NULL; ++ ++ break; + default: + return NULL; + } +-- +2.38.1 + diff --git a/SOURCES/0058-mdadm-Add-Documentation-entries-to-systemd-services.patch b/SOURCES/0058-mdadm-Add-Documentation-entries-to-systemd-services.patch new file mode 100644 index 0000000..6e1a179 --- /dev/null +++ b/SOURCES/0058-mdadm-Add-Documentation-entries-to-systemd-services.patch @@ -0,0 +1,111 @@ +From ea109700563d93704ebdc540c7770d874369f667 Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +Date: Fri, 9 Sep 2022 15:50:33 +0200 +Subject: [PATCH 58/83] mdadm: Add Documentation entries to systemd services + +Add documentation section. +Copied from Debian. + +Cc: Felix Lechner +Signed-off-by: Mariusz Tkaczyk +Acked-by: Coly Li +Signed-off-by: Jes Sorensen +--- + systemd/mdadm-grow-continue@.service | 1 + + systemd/mdadm-last-resort@.service | 1 + + systemd/mdcheck_continue.service | 3 ++- + systemd/mdcheck_start.service | 1 + + systemd/mdmon@.service | 1 + + systemd/mdmonitor-oneshot.service | 1 + + systemd/mdmonitor.service | 1 + + 7 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/systemd/mdadm-grow-continue@.service b/systemd/mdadm-grow-continue@.service +index 9fdc8ec7..64b8254a 100644 +--- a/systemd/mdadm-grow-continue@.service ++++ b/systemd/mdadm-grow-continue@.service +@@ -8,6 +8,7 @@ + [Unit] + Description=Manage MD Reshape on /dev/%I + DefaultDependencies=no ++Documentation=man:mdadm(8) + + [Service] + ExecStart=BINDIR/mdadm --grow --continue /dev/%I +diff --git a/systemd/mdadm-last-resort@.service b/systemd/mdadm-last-resort@.service +index efeb3f63..e9381125 100644 +--- a/systemd/mdadm-last-resort@.service ++++ b/systemd/mdadm-last-resort@.service +@@ -2,6 +2,7 @@ + Description=Activate md array %I even though degraded + DefaultDependencies=no + ConditionPathExists=!/sys/devices/virtual/block/%i/md/sync_action ++Documentation=man:mdadm(8) + + [Service] + Type=oneshot +diff --git a/systemd/mdcheck_continue.service b/systemd/mdcheck_continue.service +index 854317f1..f5324905 100644 +--- a/systemd/mdcheck_continue.service ++++ b/systemd/mdcheck_continue.service +@@ -7,7 +7,8 @@ + + [Unit] + Description=MD array scrubbing - continuation +-ConditionPathExistsGlob = /var/lib/mdcheck/MD_UUID_* ++ConditionPathExistsGlob=/var/lib/mdcheck/MD_UUID_* ++Documentation=man:mdadm(8) + + [Service] + Type=oneshot +diff --git a/systemd/mdcheck_start.service b/systemd/mdcheck_start.service +index 3bb3d130..703a6583 100644 +--- a/systemd/mdcheck_start.service ++++ b/systemd/mdcheck_start.service +@@ -8,6 +8,7 @@ + [Unit] + Description=MD array scrubbing + Wants=mdcheck_continue.timer ++Documentation=man:mdadm(8) + + [Service] + Type=oneshot +diff --git a/systemd/mdmon@.service b/systemd/mdmon@.service +index 77533958..97a1acd9 100644 +--- a/systemd/mdmon@.service ++++ b/systemd/mdmon@.service +@@ -9,6 +9,7 @@ + Description=MD Metadata Monitor on /dev/%I + DefaultDependencies=no + Before=initrd-switch-root.target ++Documentation=man:mdmon(8) + + [Service] + # mdmon should never complain due to lack of a platform, +diff --git a/systemd/mdmonitor-oneshot.service b/systemd/mdmonitor-oneshot.service +index 373955a2..ba86b44e 100644 +--- a/systemd/mdmonitor-oneshot.service ++++ b/systemd/mdmonitor-oneshot.service +@@ -7,6 +7,7 @@ + + [Unit] + Description=Reminder for degraded MD arrays ++Documentation=man:mdadm(8) + + [Service] + Environment=MDADM_MONITOR_ARGS=--scan +diff --git a/systemd/mdmonitor.service b/systemd/mdmonitor.service +index 46f7b880..9c364785 100644 +--- a/systemd/mdmonitor.service ++++ b/systemd/mdmonitor.service +@@ -8,6 +8,7 @@ + [Unit] + Description=MD array monitor + DefaultDependencies=no ++Documentation=man:mdadm(8) + + [Service] + Environment= MDADM_MONITOR_ARGS=--scan +-- +2.38.1 + diff --git a/SOURCES/0059-ReadMe-fix-command-line-help.patch b/SOURCES/0059-ReadMe-fix-command-line-help.patch new file mode 100644 index 0000000..837a339 --- /dev/null +++ b/SOURCES/0059-ReadMe-fix-command-line-help.patch @@ -0,0 +1,32 @@ +From f7cbd810b639eb946ba1b3bddb1faefb9696de42 Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +Date: Fri, 9 Sep 2022 15:50:34 +0200 +Subject: [PATCH 59/83] ReadMe: fix command-line help + +Make command-line help consistent with manual page. +Copied from Debian. + +Cc: Felix Lechner +Signed-off-by: Mariusz Tkaczyk +Acked-by: Coly Li +Signed-off-by: Jes Sorensen +--- + ReadMe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ReadMe.c b/ReadMe.c +index 7f94847e..50a5e36d 100644 +--- a/ReadMe.c ++++ b/ReadMe.c +@@ -477,7 +477,7 @@ char Help_assemble[] = + ; + + char Help_manage[] = +-"Usage: mdadm arraydevice options component devices...\n" ++"Usage: mdadm [mode] arraydevice [options] \n" + "\n" + "This usage is for managing the component devices within an array.\n" + "The --manage option is not needed and is assumed if the first argument\n" +-- +2.38.1 + diff --git a/SOURCES/0060-mdadm-replace-container-level-checking-with-inline.patch b/SOURCES/0060-mdadm-replace-container-level-checking-with-inline.patch new file mode 100644 index 0000000..7b2b6b2 --- /dev/null +++ b/SOURCES/0060-mdadm-replace-container-level-checking-with-inline.patch @@ -0,0 +1,257 @@ +From 6f2af6a48c541f207cb727a31fb86de2cd04fc21 Mon Sep 17 00:00:00 2001 +From: Kinga Tanska +Date: Fri, 2 Sep 2022 08:49:23 +0200 +Subject: [PATCH 60/83] mdadm: replace container level checking with inline + +To unify all containers checks in code, is_container() function is +added and propagated. + +Signed-off-by: Kinga Tanska +Acked-by: Coly Li +Signed-off-by: Jes Sorensen +--- + Assemble.c | 7 +++---- + Create.c | 6 +++--- + Grow.c | 6 +++--- + Incremental.c | 4 ++-- + mdadm.h | 14 ++++++++++++++ + super-ddf.c | 6 +++--- + super-intel.c | 4 ++-- + super0.c | 2 +- + super1.c | 2 +- + sysfs.c | 2 +- + 10 files changed, 33 insertions(+), 20 deletions(-) + +diff --git a/Assemble.c b/Assemble.c +index 1dd82a8c..8b0af0c9 100644 +--- a/Assemble.c ++++ b/Assemble.c +@@ -1120,7 +1120,7 @@ static int start_array(int mdfd, + i/2, mddev); + } + +- if (content->array.level == LEVEL_CONTAINER) { ++ if (is_container(content->array.level)) { + sysfs_rules_apply(mddev, content); + if (c->verbose >= 0) { + pr_err("Container %s has been assembled with %d drive%s", +@@ -1549,8 +1549,7 @@ try_again: + */ + trustworthy = LOCAL; + +- if (name[0] == 0 && +- content->array.level == LEVEL_CONTAINER) { ++ if (!name[0] && is_container(content->array.level)) { + name = content->text_version; + trustworthy = METADATA; + } +@@ -1809,7 +1808,7 @@ try_again: + } + #endif + } +- if (c->force && !clean && content->array.level != LEVEL_CONTAINER && ++ if (c->force && !clean && !is_container(content->array.level) && + !enough(content->array.level, content->array.raid_disks, + content->array.layout, clean, avail)) { + change += st->ss->update_super(st, content, "force-array", +diff --git a/Create.c b/Create.c +index e06ec2ae..953e7372 100644 +--- a/Create.c ++++ b/Create.c +@@ -487,7 +487,7 @@ int Create(struct supertype *st, char *mddev, + st->minor_version >= 1) + /* metadata at front */ + warn |= check_partitions(fd, dname, 0, 0); +- else if (s->level == 1 || s->level == LEVEL_CONTAINER || ++ else if (s->level == 1 || is_container(s->level) || + (s->level == 0 && s->raiddisks == 1)) + /* partitions could be meaningful */ + warn |= check_partitions(fd, dname, freesize*2, s->size*2); +@@ -997,7 +997,7 @@ int Create(struct supertype *st, char *mddev, + * again returns container info. + */ + st->ss->getinfo_super(st, &info_new, NULL); +- if (st->ss->external && s->level != LEVEL_CONTAINER && ++ if (st->ss->external && !is_container(s->level) && + !same_uuid(info_new.uuid, info.uuid, 0)) { + map_update(&map, fd2devnm(mdfd), + info_new.text_version, +@@ -1040,7 +1040,7 @@ int Create(struct supertype *st, char *mddev, + map_unlock(&map); + free(infos); + +- if (s->level == LEVEL_CONTAINER) { ++ if (is_container(s->level)) { + /* No need to start. But we should signal udev to + * create links */ + sysfs_uevent(&info, "change"); +diff --git a/Grow.c b/Grow.c +index 0f07a894..e362403a 100644 +--- a/Grow.c ++++ b/Grow.c +@@ -2175,7 +2175,7 @@ size_change_error: + devname, s->size); + } + changed = 1; +- } else if (array.level != LEVEL_CONTAINER) { ++ } else if (!is_container(array.level)) { + s->size = get_component_size(fd)/2; + if (s->size == 0) + s->size = array.size; +@@ -2231,7 +2231,7 @@ size_change_error: + info.component_size = s->size*2; + info.new_level = s->level; + info.new_chunk = s->chunk * 1024; +- if (info.array.level == LEVEL_CONTAINER) { ++ if (is_container(info.array.level)) { + info.delta_disks = UnSet; + info.array.raid_disks = s->raiddisks; + } else if (s->raiddisks) +@@ -2344,7 +2344,7 @@ size_change_error: + printf("layout for %s set to %d\n", + devname, array.layout); + } +- } else if (array.level == LEVEL_CONTAINER) { ++ } else if (is_container(array.level)) { + /* This change is to be applied to every array in the + * container. This is only needed when the metadata imposes + * restraints of the various arrays in the container. +diff --git a/Incremental.c b/Incremental.c +index 4d0cd9d6..5a5f4c4c 100644 +--- a/Incremental.c ++++ b/Incremental.c +@@ -244,7 +244,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c, + c->autof = ci->autof; + + name_to_use = info.name; +- if (name_to_use[0] == 0 && info.array.level == LEVEL_CONTAINER) { ++ if (name_to_use[0] == 0 && is_container(info.array.level)) { + name_to_use = info.text_version; + trustworthy = METADATA; + } +@@ -472,7 +472,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c, + + /* 7/ Is there enough devices to possibly start the array? */ + /* 7a/ if not, finish with success. */ +- if (info.array.level == LEVEL_CONTAINER) { ++ if (is_container(info.array.level)) { + char devnm[32]; + /* Try to assemble within the container */ + sysfs_uevent(sra, "change"); +diff --git a/mdadm.h b/mdadm.h +index 941a5f38..3673494e 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -1924,3 +1924,17 @@ enum r0layout { + * This is true for native and DDF, IMSM allows 16. + */ + #define MD_NAME_MAX 32 ++ ++/** ++ * is_container() - check if @level is &LEVEL_CONTAINER ++ * @level: level value ++ * ++ * return: ++ * 1 if level is equal to &LEVEL_CONTAINER, 0 otherwise. ++ */ ++static inline int is_container(const int level) ++{ ++ if (level == LEVEL_CONTAINER) ++ return 1; ++ return 0; ++} +diff --git a/super-ddf.c b/super-ddf.c +index 949e7d15..9d1e3b94 100644 +--- a/super-ddf.c ++++ b/super-ddf.c +@@ -3325,7 +3325,7 @@ validate_geometry_ddf_container(struct supertype *st, + int fd; + unsigned long long ldsize; + +- if (level != LEVEL_CONTAINER) ++ if (!is_container(level)) + return 0; + if (!dev) + return 1; +@@ -3371,7 +3371,7 @@ static int validate_geometry_ddf(struct supertype *st, + + if (level == LEVEL_NONE) + level = LEVEL_CONTAINER; +- if (level == LEVEL_CONTAINER) { ++ if (is_container(level)) { + /* Must be a fresh device to add to a container */ + return validate_geometry_ddf_container(st, level, raiddisks, + data_offset, dev, +@@ -3488,7 +3488,7 @@ static int validate_geometry_ddf_bvd(struct supertype *st, + struct dl *dl; + unsigned long long maxsize; + /* ddf/bvd supports lots of things, but not containers */ +- if (level == LEVEL_CONTAINER) { ++ if (is_container(level)) { + if (verbose) + pr_err("DDF cannot create a container within an container\n"); + return 0; +diff --git a/super-intel.c b/super-intel.c +index 4d82af3d..b0565610 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -6727,7 +6727,7 @@ static int validate_geometry_imsm_container(struct supertype *st, int level, + struct intel_super *super = NULL; + int rv = 0; + +- if (level != LEVEL_CONTAINER) ++ if (!is_container(level)) + return 0; + if (!dev) + return 1; +@@ -7692,7 +7692,7 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout, + * if given unused devices create a container + * if given given devices in a container create a member volume + */ +- if (level == LEVEL_CONTAINER) ++ if (is_container(level)) + /* Must be a fresh device to add to a container */ + return validate_geometry_imsm_container(st, level, raiddisks, + data_offset, dev, +diff --git a/super0.c b/super0.c +index 37f595ed..93876e2e 100644 +--- a/super0.c ++++ b/super0.c +@@ -1273,7 +1273,7 @@ static int validate_geometry0(struct supertype *st, int level, + if (get_linux_version() < 3001000) + tbmax = 2; + +- if (level == LEVEL_CONTAINER) { ++ if (is_container(level)) { + if (verbose) + pr_err("0.90 metadata does not support containers\n"); + return 0; +diff --git a/super1.c b/super1.c +index 58345e68..0b505a7e 100644 +--- a/super1.c ++++ b/super1.c +@@ -2830,7 +2830,7 @@ static int validate_geometry1(struct supertype *st, int level, + unsigned long long overhead; + int fd; + +- if (level == LEVEL_CONTAINER) { ++ if (is_container(level)) { + if (verbose) + pr_err("1.x metadata does not support containers\n"); + return 0; +diff --git a/sysfs.c b/sysfs.c +index 0d98a65f..ca1d888f 100644 +--- a/sysfs.c ++++ b/sysfs.c +@@ -763,7 +763,7 @@ int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd, int resume) + + rv = sysfs_set_num(sra, sd, "offset", sd->data_offset); + rv |= sysfs_set_num(sra, sd, "size", (sd->component_size+1) / 2); +- if (sra->array.level != LEVEL_CONTAINER) { ++ if (!is_container(sra->array.level)) { + if (sra->consistency_policy == CONSISTENCY_POLICY_PPL) { + rv |= sysfs_set_num(sra, sd, "ppl_sector", sd->ppl_sector); + rv |= sysfs_set_num(sra, sd, "ppl_size", sd->ppl_size); +-- +2.38.1 + diff --git a/SOURCES/0061-Mdmonitor-Omit-non-md-devices.patch b/SOURCES/0061-Mdmonitor-Omit-non-md-devices.patch new file mode 100644 index 0000000..062ecdf --- /dev/null +++ b/SOURCES/0061-Mdmonitor-Omit-non-md-devices.patch @@ -0,0 +1,58 @@ +From 8b668d4aa3305af5963162b7499b128bd71f8f29 Mon Sep 17 00:00:00 2001 +From: Lukasz Florczak +Date: Thu, 22 Sep 2022 08:29:50 +0200 +Subject: [PATCH 61/83] Mdmonitor: Omit non-md devices + +Fix segfault commit [1] introduced check whether given device is +mddevice, but it happend to terminate Mdmonitor if at least one of given +devices didn't fulfill that condition. In result Mdmonitor service was +no longer started on boot (with --scan option) when config contained some +non-existent array entry. + +This commit introduces ommiting non-md devices so scan option can still +be used when config is wrong and allow Mdmonitor service to run on boot. + +Giving a list of devices to monitor containing non-existing or +non-md devices will result in monitoring only confirmed mddevices. + +[1] https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=e702f392959d1c2ad2089e595b52235ed97b4e18 + +Signed-off-by: Lukasz Florczak +Signed-off-by: Jes Sorensen +--- + Monitor.c | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/Monitor.c b/Monitor.c +index b4e954c6..7d7dc4d2 100644 +--- a/Monitor.c ++++ b/Monitor.c +@@ -185,10 +185,8 @@ int Monitor(struct mddev_dev *devlist, + continue; + if (strcasecmp(mdlist->devname, "") == 0) + continue; +- if (!is_mddev(mdlist->devname)) { +- free_statelist(statelist); +- return 1; +- } ++ if (!is_mddev(mdlist->devname)) ++ continue; + + st = xcalloc(1, sizeof *st); + snprintf(st->devname, MD_NAME_MAX + sizeof("/dev/md/"), +@@ -208,10 +206,8 @@ int Monitor(struct mddev_dev *devlist, + for (dv = devlist; dv; dv = dv->next) { + struct state *st; + +- if (!is_mddev(dv->devname)) { +- free_statelist(statelist); +- return 1; +- } ++ if (!is_mddev(dv->devname)) ++ continue; + + st = xcalloc(1, sizeof *st); + mdlist = conf_get_ident(dv->devname); +-- +2.38.1 + diff --git a/SOURCES/0062-Mdmonitor-Split-alert-into-separate-functions.patch b/SOURCES/0062-Mdmonitor-Split-alert-into-separate-functions.patch new file mode 100644 index 0000000..c7562e7 --- /dev/null +++ b/SOURCES/0062-Mdmonitor-Split-alert-into-separate-functions.patch @@ -0,0 +1,233 @@ +From 3698867194f27fdd7824b8bdd172d619a2c087cc Mon Sep 17 00:00:00 2001 +From: Mateusz Grzonka +Date: Wed, 7 Sep 2022 14:56:49 +0200 +Subject: [PATCH 62/83] Mdmonitor: Split alert() into separate functions + +Signed-off-by: Mateusz Grzonka +Signed-off-by: Jes Sorensen +--- + Monitor.c | 186 ++++++++++++++++++++++++++++-------------------------- + 1 file changed, 95 insertions(+), 91 deletions(-) + +diff --git a/Monitor.c b/Monitor.c +index 7d7dc4d2..0036e8cd 100644 +--- a/Monitor.c ++++ b/Monitor.c +@@ -66,7 +66,7 @@ struct alert_info { + static int make_daemon(char *pidfile); + static int check_one_sharer(int scan); + static void write_autorebuild_pid(void); +-static void alert(char *event, char *dev, char *disc, struct alert_info *info); ++static void alert(const char *event, const char *dev, const char *disc, struct alert_info *info); + static int check_array(struct state *st, struct mdstat_ent *mdstat, + int test, struct alert_info *info, + int increments, char *prefer); +@@ -407,111 +407,115 @@ static void write_autorebuild_pid() + } + } + +-static void alert(char *event, char *dev, char *disc, struct alert_info *info) ++static void execute_alert_cmd(const char *event, const char *dev, const char *disc, struct alert_info *info) ++{ ++ int pid = fork(); ++ ++ switch (pid) { ++ default: ++ waitpid(pid, NULL, 0); ++ break; ++ case -1: ++ pr_err("Cannot fork to execute alert command"); ++ break; ++ case 0: ++ execl(info->alert_cmd, info->alert_cmd, event, dev, disc, NULL); ++ exit(2); ++ } ++} ++ ++static void send_event_email(const char *event, const char *dev, const char *disc, struct alert_info *info) ++{ ++ FILE *mp, *mdstat; ++ char hname[256]; ++ char buf[BUFSIZ]; ++ int n; ++ ++ mp = popen(Sendmail, "w"); ++ if (!mp) { ++ pr_err("Cannot open pipe stream for sendmail.\n"); ++ return; ++ } ++ ++ gethostname(hname, sizeof(hname)); ++ signal(SIGPIPE, SIG_IGN); ++ if (info->mailfrom) ++ fprintf(mp, "From: %s\n", info->mailfrom); ++ else ++ fprintf(mp, "From: %s monitoring \n", Name); ++ fprintf(mp, "To: %s\n", info->mailaddr); ++ fprintf(mp, "Subject: %s event on %s:%s\n\n", event, dev, hname); ++ fprintf(mp, "This is an automatically generated mail message. \n"); ++ fprintf(mp, "A %s event had been detected on md device %s.\n\n", event, dev); ++ ++ if (disc && disc[0] != ' ') ++ fprintf(mp, ++ "It could be related to component device %s.\n\n", disc); ++ if (disc && disc[0] == ' ') ++ fprintf(mp, "Extra information:%s.\n\n", disc); ++ ++ mdstat = fopen("/proc/mdstat", "r"); ++ if (!mdstat) { ++ pr_err("Cannot open /proc/mdstat\n"); ++ pclose(mp); ++ return; ++ } ++ ++ fprintf(mp, "The /proc/mdstat file currently contains the following:\n\n"); ++ while ((n = fread(buf, 1, sizeof(buf), mdstat)) > 0) ++ n = fwrite(buf, 1, n, mp); ++ fclose(mdstat); ++ pclose(mp); ++} ++ ++static void log_event_to_syslog(const char *event, const char *dev, const char *disc) + { + int priority; ++ /* Log at a different severity depending on the event. ++ * ++ * These are the critical events: */ ++ if (strncmp(event, "Fail", 4) == 0 || ++ strncmp(event, "Degrade", 7) == 0 || ++ strncmp(event, "DeviceDisappeared", 17) == 0) ++ priority = LOG_CRIT; ++ /* Good to know about, but are not failures: */ ++ else if (strncmp(event, "Rebuild", 7) == 0 || ++ strncmp(event, "MoveSpare", 9) == 0 || ++ strncmp(event, "Spares", 6) != 0) ++ priority = LOG_WARNING; ++ /* Everything else: */ ++ else ++ priority = LOG_INFO; + ++ if (disc && disc[0] != ' ') ++ syslog(priority, ++ "%s event detected on md device %s, component device %s", event, dev, disc); ++ else if (disc) ++ syslog(priority, "%s event detected on md device %s: %s", event, dev, disc); ++ else ++ syslog(priority, "%s event detected on md device %s", event, dev); ++} ++ ++static void alert(const char *event, const char *dev, const char *disc, struct alert_info *info) ++{ + if (!info->alert_cmd && !info->mailaddr && !info->dosyslog) { + time_t now = time(0); + + printf("%1.15s: %s on %s %s\n", ctime(&now) + 4, + event, dev, disc?disc:"unknown device"); + } +- if (info->alert_cmd) { +- int pid = fork(); +- switch(pid) { +- default: +- waitpid(pid, NULL, 0); +- break; +- case -1: +- break; +- case 0: +- execl(info->alert_cmd, info->alert_cmd, +- event, dev, disc, NULL); +- exit(2); +- } +- } ++ if (info->alert_cmd) ++ execute_alert_cmd(event, dev, disc, info); ++ + if (info->mailaddr && (strncmp(event, "Fail", 4) == 0 || + strncmp(event, "Test", 4) == 0 || + strncmp(event, "Spares", 6) == 0 || + strncmp(event, "Degrade", 7) == 0)) { +- FILE *mp = popen(Sendmail, "w"); +- if (mp) { +- FILE *mdstat; +- char hname[256]; +- +- gethostname(hname, sizeof(hname)); +- signal_s(SIGPIPE, SIG_IGN); +- +- if (info->mailfrom) +- fprintf(mp, "From: %s\n", info->mailfrom); +- else +- fprintf(mp, "From: %s monitoring \n", +- Name); +- fprintf(mp, "To: %s\n", info->mailaddr); +- fprintf(mp, "Subject: %s event on %s:%s\n\n", +- event, dev, hname); +- +- fprintf(mp, +- "This is an automatically generated mail message from %s\n", Name); +- fprintf(mp, "running on %s\n\n", hname); +- +- fprintf(mp, +- "A %s event had been detected on md device %s.\n\n", event, dev); +- +- if (disc && disc[0] != ' ') +- fprintf(mp, +- "It could be related to component device %s.\n\n", disc); +- if (disc && disc[0] == ' ') +- fprintf(mp, "Extra information:%s.\n\n", disc); +- +- fprintf(mp, "Faithfully yours, etc.\n"); +- +- mdstat = fopen("/proc/mdstat", "r"); +- if (mdstat) { +- char buf[8192]; +- int n; +- fprintf(mp, +- "\nP.S. The /proc/mdstat file currently contains the following:\n\n"); +- while ((n = fread(buf, 1, sizeof(buf), +- mdstat)) > 0) +- n = fwrite(buf, 1, n, mp); +- fclose(mdstat); +- } +- pclose(mp); +- } ++ send_event_email(event, dev, disc, info); + } + +- /* log the event to syslog maybe */ +- if (info->dosyslog) { +- /* Log at a different severity depending on the event. +- * +- * These are the critical events: */ +- if (strncmp(event, "Fail", 4) == 0 || +- strncmp(event, "Degrade", 7) == 0 || +- strncmp(event, "DeviceDisappeared", 17) == 0) +- priority = LOG_CRIT; +- /* Good to know about, but are not failures: */ +- else if (strncmp(event, "Rebuild", 7) == 0 || +- strncmp(event, "MoveSpare", 9) == 0 || +- strncmp(event, "Spares", 6) != 0) +- priority = LOG_WARNING; +- /* Everything else: */ +- else +- priority = LOG_INFO; +- +- if (disc && disc[0] != ' ') +- syslog(priority, +- "%s event detected on md device %s, component device %s", event, dev, disc); +- else if (disc) +- syslog(priority, +- "%s event detected on md device %s: %s", +- event, dev, disc); +- else +- syslog(priority, +- "%s event detected on md device %s", +- event, dev); +- } ++ if (info->dosyslog) ++ log_event_to_syslog(event, dev, disc); + } + + static int check_array(struct state *st, struct mdstat_ent *mdstat, +-- +2.38.1 + diff --git a/SOURCES/0063-Monitor-block-if-monitor-modes-are-combined.patch b/SOURCES/0063-Monitor-block-if-monitor-modes-are-combined.patch new file mode 100644 index 0000000..d993d9d --- /dev/null +++ b/SOURCES/0063-Monitor-block-if-monitor-modes-are-combined.patch @@ -0,0 +1,41 @@ +From f40ac0e7e6043361ad12e9db97c07e56c3977cf6 Mon Sep 17 00:00:00 2001 +From: Blazej Kucman +Date: Mon, 19 Dec 2022 11:21:57 +0100 +Subject: [PATCH 63/83] Monitor: block if monitor modes are combined. + +Block monitoring start if --scan mode and MD devices list are combined. + +Signed-off-by: Blazej Kucman +Signed-off-by: Jes Sorensen +--- + Monitor.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/Monitor.c b/Monitor.c +index 0036e8cd..188cb8be 100644 +--- a/Monitor.c ++++ b/Monitor.c +@@ -123,7 +123,7 @@ int Monitor(struct mddev_dev *devlist, + * and if we can get_disk_info and find a name + * Then we hot-remove and hot-add to the other array + * +- * If devlist is NULL, then we can monitor everything because --scan ++ * If devlist is NULL, then we can monitor everything if --scan + * was given. We get an initial list from config file and add anything + * that appears in /proc/mdstat + */ +@@ -136,6 +136,11 @@ int Monitor(struct mddev_dev *devlist, + struct mddev_ident *mdlist; + int delay_for_event = c->delay; + ++ if (devlist && c->scan) { ++ pr_err("Devices list and --scan option cannot be combined - not monitoring.\n"); ++ return 1; ++ } ++ + if (!mailaddr) + mailaddr = conf_get_mailaddr(); + +-- +2.38.1 + diff --git a/SOURCES/0064-Update-mdadm-Monitor-manual.patch b/SOURCES/0064-Update-mdadm-Monitor-manual.patch new file mode 100644 index 0000000..15f52e1 --- /dev/null +++ b/SOURCES/0064-Update-mdadm-Monitor-manual.patch @@ -0,0 +1,119 @@ +From 725e37cd14866906ba28c970394b9f7a4cd97413 Mon Sep 17 00:00:00 2001 +From: Blazej Kucman +Date: Mon, 19 Dec 2022 11:21:58 +0100 +Subject: [PATCH 64/83] Update mdadm Monitor manual. + +- describe monitor work modes, +- clarify the turning off condition, +- describe the mdmonitor.service as a prefered management way. + +Signed-off-by: Blazej Kucman +Signed-off-by: Jes Sorensen +--- + mdadm.8.in | 71 ++++++++++++++++++++++++++++++++++++++---------------- + 1 file changed, 50 insertions(+), 21 deletions(-) + +diff --git a/mdadm.8.in b/mdadm.8.in +index 70c79d1e..64f71ed1 100644 +--- a/mdadm.8.in ++++ b/mdadm.8.in +@@ -2548,13 +2548,33 @@ Usage: + .I options... devices... + + .PP +-This usage causes ++Monitor option can work in two modes: ++.IP \(bu 4 ++system wide mode, follow all md devices based on ++.B /proc/mdstat, ++.IP \(bu 4 ++follow only specified MD devices in command line. ++.PP ++ ++.B \-\-scan - ++indicates system wide mode. Option causes the ++.I monitor ++to track all md devices that appear in ++.B /proc/mdstat. ++If it is not set, then at least one ++.B device ++must be specified. ++ ++Monitor usage causes + .I mdadm + to periodically poll a number of md arrays and to report on any events + noticed. +-.I mdadm +-will never exit once it decides that there are arrays to be checked, +-so it should normally be run in the background. ++ ++In both modes, ++.I monitor ++will work as long as there is an active array with redundancy and it is defined to follow (for ++.B \-\-scan ++every array is followed). + + As well as reporting events, + .I mdadm +@@ -2565,15 +2585,6 @@ or + .B domain + and if the destination array has a failed drive but no spares. + +-If any devices are listed on the command line, +-.I mdadm +-will only monitor those devices, otherwise, all arrays listed in the +-configuration file will be monitored. Further, if +-.B \-\-scan +-is given, then any other md devices that appear in +-.B /proc/mdstat +-will also be monitored. +- + The result of monitoring the arrays is the generation of events. + These events are passed to a separate program (if specified) and may + be mailed to a given E-mail address. +@@ -2586,16 +2597,34 @@ device if relevant (such as a component device that has failed). + + If + .B \-\-scan +-is given, then a program or an E-mail address must be specified on the +-command line or in the config file. If neither are available, then ++is given, then a ++.B program ++or an ++.B e-mail ++address must be specified on the ++command line or in the config file. If neither are available, then + .I mdadm + will not monitor anything. +-Without +-.B \-\-scan, +-.I mdadm +-will continue monitoring as long as something was found to monitor. If +-no program or email is given, then each event is reported to +-.BR stdout . ++For devices given directly in command line, without ++.B program ++or ++.B email ++specified, each event is reported to ++.BR stdout. ++ ++Note: For systems where ++.If mdadm monitor ++is configured via systemd, ++.B mdmonitor(mdmonitor.service) ++should be configured. The service is designed to be primary solution for array monitoring, ++it is configured to work in system wide mode. ++It is automatically started and stopped according to current state and types of MD arrays in system. ++The service may require additional configuration, like ++.B e-mail ++or ++.B delay. ++That should be done in ++.B mdadm.conf. + + The different events are: + +-- +2.38.1 + diff --git a/SOURCES/0065-Grow-fix-possible-memory-leak.patch b/SOURCES/0065-Grow-fix-possible-memory-leak.patch new file mode 100644 index 0000000..07d9fb6 --- /dev/null +++ b/SOURCES/0065-Grow-fix-possible-memory-leak.patch @@ -0,0 +1,38 @@ +From 434b3b9bb96a76dc12f693b64cf23b581781e20b Mon Sep 17 00:00:00 2001 +From: Blazej Kucman +Date: Tue, 20 Dec 2022 12:07:51 +0100 +Subject: [PATCH 65/83] Grow: fix possible memory leak. + +Signed-off-by: Blazej Kucman +Signed-off-by: Jes Sorensen +--- + Grow.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/Grow.c b/Grow.c +index e362403a..b73ec2ae 100644 +--- a/Grow.c ++++ b/Grow.c +@@ -432,6 +432,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) + if (((disk.state & (1 << MD_DISK_WRITEMOSTLY)) == 0) && + (strcmp(s->bitmap_file, "clustered") == 0)) { + pr_err("%s disks marked write-mostly are not supported with clustered bitmap\n",devname); ++ free(mdi); + return 1; + } + fd2 = dev_open(dv, O_RDWR); +@@ -453,8 +454,10 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) + pr_err("failed to load super-block.\n"); + } + close(fd2); +- if (rv) ++ if (rv) { ++ free(mdi); + return 1; ++ } + } + if (offset_setable) { + st->ss->getinfo_super(st, mdi, NULL); +-- +2.38.1 + diff --git a/SOURCES/0066-mdadm-create-ident_init.patch b/SOURCES/0066-mdadm-create-ident_init.patch new file mode 100644 index 0000000..32d374b --- /dev/null +++ b/SOURCES/0066-mdadm-create-ident_init.patch @@ -0,0 +1,148 @@ +From 7fcbfd7c620e2dcd3b539d18e93cb503ee3a8a62 Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +Date: Wed, 21 Dec 2022 12:50:17 +0100 +Subject: [PATCH 66/83] mdadm: create ident_init() + +Add a wrapper for repeated initializations in mdadm.c and config.c. +Move includes up. + +Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Jes Sorensen +--- + config.c | 45 +++++++++++++++++++++++++++++---------------- + mdadm.c | 16 ++-------------- + mdadm.h | 7 +++++-- + 3 files changed, 36 insertions(+), 32 deletions(-) + +diff --git a/config.c b/config.c +index dc1620c1..eeedd0c6 100644 +--- a/config.c ++++ b/config.c +@@ -119,6 +119,34 @@ int match_keyword(char *word) + return -1; + } + ++/** ++ * ident_init() - Set defaults. ++ * @ident: ident pointer, not NULL. ++ */ ++inline void ident_init(struct mddev_ident *ident) ++{ ++ assert(ident); ++ ++ ident->assembled = false; ++ ident->autof = 0; ++ ident->bitmap_fd = -1; ++ ident->bitmap_file = NULL; ++ ident->container = NULL; ++ ident->devices = NULL; ++ ident->devname = NULL; ++ ident->level = UnSet; ++ ident->member = NULL; ++ ident->name[0] = 0; ++ ident->next = NULL; ++ ident->raid_disks = UnSet; ++ ident->spare_group = NULL; ++ ident->spare_disks = 0; ++ ident->st = NULL; ++ ident->super_minor = UnSet; ++ ident->uuid[0] = 0; ++ ident->uuid_set = 0; ++} ++ + struct conf_dev { + struct conf_dev *next; + char *name; +@@ -363,22 +391,7 @@ void arrayline(char *line) + struct mddev_ident mis; + struct mddev_ident *mi; + +- mis.uuid_set = 0; +- mis.super_minor = UnSet; +- mis.level = UnSet; +- mis.raid_disks = UnSet; +- mis.spare_disks = 0; +- mis.devices = NULL; +- mis.devname = NULL; +- mis.spare_group = NULL; +- mis.autof = 0; +- mis.next = NULL; +- mis.st = NULL; +- mis.bitmap_fd = -1; +- mis.bitmap_file = NULL; +- mis.name[0] = 0; +- mis.container = NULL; +- mis.member = NULL; ++ ident_init(&mis); + + for (w = dl_next(line); w != line; w = dl_next(w)) { + if (w[0] == '/' || strchr(w, '=') == NULL) { +diff --git a/mdadm.c b/mdadm.c +index 972adb52..74fdec31 100644 +--- a/mdadm.c ++++ b/mdadm.c +@@ -107,25 +107,13 @@ int main(int argc, char *argv[]) + + srandom(time(0) ^ getpid()); + +- ident.uuid_set = 0; +- ident.level = UnSet; +- ident.raid_disks = UnSet; +- ident.super_minor = UnSet; +- ident.devices = 0; +- ident.spare_group = NULL; +- ident.autof = 0; +- ident.st = NULL; +- ident.bitmap_fd = -1; +- ident.bitmap_file = NULL; +- ident.name[0] = 0; +- ident.container = NULL; +- ident.member = NULL; +- + if (get_linux_version() < 2006015) { + pr_err("This version of mdadm does not support kernels older than 2.6.15\n"); + exit(1); + } + ++ ident_init(&ident); ++ + while ((option_index = -1), + (opt = getopt_long(argc, argv, shortopt, long_options, + &option_index)) != -1) { +diff --git a/mdadm.h b/mdadm.h +index 3673494e..23ffe977 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -33,8 +33,10 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence)); + # endif + #endif + ++#include + #include + #include ++#include + #include + #include + #include +@@ -1552,6 +1554,8 @@ extern void enable_fds(int devices); + extern void manage_fork_fds(int close_all); + extern int continue_via_systemd(char *devnm, char *service_name); + ++extern void ident_init(struct mddev_ident *ident); ++ + extern int parse_auto(char *str, char *msg, int config); + extern struct mddev_ident *conf_get_ident(char *dev); + extern struct mddev_dev *conf_get_devs(void); +@@ -1779,8 +1783,7 @@ static inline sighandler_t signal_s(int sig, sighandler_t handler) + #define dprintf_cont(fmt, arg...) \ + ({ if (0) fprintf(stderr, fmt, ##arg); 0; }) + #endif +-#include +-#include ++ + static inline int xasprintf(char **strp, const char *fmt, ...) { + va_list ap; + int ret; +-- +2.38.1 + diff --git a/SOURCES/0067-mdadm-Add-option-validation-for-update-subarray.patch b/SOURCES/0067-mdadm-Add-option-validation-for-update-subarray.patch new file mode 100644 index 0000000..faa7113 --- /dev/null +++ b/SOURCES/0067-mdadm-Add-option-validation-for-update-subarray.patch @@ -0,0 +1,287 @@ +From 2568ce89ea5c26225e8984733adc2ea7559d853a Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:35:15 +0100 +Subject: [PATCH 67/83] mdadm: Add option validation for --update-subarray + +Subset of options available for "--update" is not same as for "--update-subarray". +Define maps and enum for update options and use them instead of direct comparisons. +Add proper error message. + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + ReadMe.c | 31 +++++++++++++++++ + maps.c | 31 +++++++++++++++++ + mdadm.c | 104 +++++++++++++++++-------------------------------------- + mdadm.h | 32 ++++++++++++++++- + 4 files changed, 124 insertions(+), 74 deletions(-) + +diff --git a/ReadMe.c b/ReadMe.c +index 50a5e36d..bd8d50d2 100644 +--- a/ReadMe.c ++++ b/ReadMe.c +@@ -655,3 +655,34 @@ char *mode_help[mode_count] = { + [GROW] = Help_grow, + [INCREMENTAL] = Help_incr, + }; ++ ++/** ++ * fprint_update_options() - Print valid update options depending on the mode. ++ * @outf: File (output stream) ++ * @update_mode: Used to distinguish update and update_subarray ++ */ ++void fprint_update_options(FILE *outf, enum update_opt update_mode) ++{ ++ int counter = UOPT_NAME, breakpoint = UOPT_HELP; ++ mapping_t *map = update_options; ++ ++ if (!outf) ++ return; ++ if (update_mode == UOPT_SUBARRAY_ONLY) { ++ breakpoint = UOPT_SUBARRAY_ONLY; ++ fprintf(outf, "Valid --update options for update-subarray are:\n\t"); ++ } else ++ fprintf(outf, "Valid --update options are:\n\t"); ++ while (map->num) { ++ if (map->num >= breakpoint) ++ break; ++ fprintf(outf, "'%s', ", map->name); ++ if (counter % 5 == 0) ++ fprintf(outf, "\n\t"); ++ counter++; ++ map++; ++ } ++ if ((counter - 1) % 5) ++ fprintf(outf, "\n"); ++ fprintf(outf, "\r"); ++} +diff --git a/maps.c b/maps.c +index 20fcf719..b586679a 100644 +--- a/maps.c ++++ b/maps.c +@@ -165,6 +165,37 @@ mapping_t sysfs_array_states[] = { + { "broken", ARRAY_BROKEN }, + { NULL, ARRAY_UNKNOWN_STATE } + }; ++/** ++ * mapping_t update_options - stores supported update options. ++ */ ++mapping_t update_options[] = { ++ { "name", UOPT_NAME }, ++ { "ppl", UOPT_PPL }, ++ { "no-ppl", UOPT_NO_PPL }, ++ { "bitmap", UOPT_BITMAP }, ++ { "no-bitmap", UOPT_NO_BITMAP }, ++ { "sparc2.2", UOPT_SPARC22 }, ++ { "super-minor", UOPT_SUPER_MINOR }, ++ { "summaries", UOPT_SUMMARIES }, ++ { "resync", UOPT_RESYNC }, ++ { "uuid", UOPT_UUID }, ++ { "homehost", UOPT_HOMEHOST }, ++ { "home-cluster", UOPT_HOME_CLUSTER }, ++ { "nodes", UOPT_NODES }, ++ { "devicesize", UOPT_DEVICESIZE }, ++ { "bbl", UOPT_BBL }, ++ { "no-bbl", UOPT_NO_BBL }, ++ { "force-no-bbl", UOPT_FORCE_NO_BBL }, ++ { "metadata", UOPT_METADATA }, ++ { "revert-reshape", UOPT_REVERT_RESHAPE }, ++ { "layout-original", UOPT_LAYOUT_ORIGINAL }, ++ { "layout-alternate", UOPT_LAYOUT_ALTERNATE }, ++ { "layout-unspecified", UOPT_LAYOUT_UNSPECIFIED }, ++ { "byteorder", UOPT_BYTEORDER }, ++ { "help", UOPT_HELP }, ++ { "?", UOPT_HELP }, ++ { NULL, UOPT_UNDEFINED} ++}; + + /** + * map_num_s() - Safer alternative of map_num() function. +diff --git a/mdadm.c b/mdadm.c +index 74fdec31..f5f505fe 100644 +--- a/mdadm.c ++++ b/mdadm.c +@@ -100,7 +100,7 @@ int main(int argc, char *argv[]) + char *dump_directory = NULL; + + int print_help = 0; +- FILE *outf; ++ FILE *outf = NULL; + + int mdfd = -1; + int locked = 0; +@@ -723,7 +723,11 @@ int main(int argc, char *argv[]) + continue; + + case O(ASSEMBLE,'U'): /* update the superblock */ +- case O(MISC,'U'): ++ case O(MISC,'U'): { ++ enum update_opt updateopt = map_name(update_options, c.update); ++ enum update_opt print_mode = UOPT_HELP; ++ const char *error_addon = "update option"; ++ + if (c.update) { + pr_err("Can only update one aspect of superblock, both %s and %s given.\n", + c.update, optarg); +@@ -733,83 +737,37 @@ int main(int argc, char *argv[]) + pr_err("Only subarrays can be updated in misc mode\n"); + exit(2); + } ++ + c.update = optarg; +- if (strcmp(c.update, "sparc2.2") == 0) +- continue; +- if (strcmp(c.update, "super-minor") == 0) +- continue; +- if (strcmp(c.update, "summaries") == 0) +- continue; +- if (strcmp(c.update, "resync") == 0) +- continue; +- if (strcmp(c.update, "uuid") == 0) +- continue; +- if (strcmp(c.update, "name") == 0) +- continue; +- if (strcmp(c.update, "homehost") == 0) +- continue; +- if (strcmp(c.update, "home-cluster") == 0) +- continue; +- if (strcmp(c.update, "nodes") == 0) +- continue; +- if (strcmp(c.update, "devicesize") == 0) +- continue; +- if (strcmp(c.update, "bitmap") == 0) +- continue; +- if (strcmp(c.update, "no-bitmap") == 0) +- continue; +- if (strcmp(c.update, "bbl") == 0) +- continue; +- if (strcmp(c.update, "no-bbl") == 0) +- continue; +- if (strcmp(c.update, "force-no-bbl") == 0) +- continue; +- if (strcmp(c.update, "ppl") == 0) +- continue; +- if (strcmp(c.update, "no-ppl") == 0) +- continue; +- if (strcmp(c.update, "metadata") == 0) +- continue; +- if (strcmp(c.update, "revert-reshape") == 0) +- continue; +- if (strcmp(c.update, "layout-original") == 0 || +- strcmp(c.update, "layout-alternate") == 0 || +- strcmp(c.update, "layout-unspecified") == 0) +- continue; +- if (strcmp(c.update, "byteorder") == 0) { ++ ++ if (devmode == UpdateSubarray) { ++ print_mode = UOPT_SUBARRAY_ONLY; ++ error_addon = "update-subarray option"; ++ ++ if (updateopt > UOPT_SUBARRAY_ONLY && updateopt < UOPT_HELP) ++ updateopt = UOPT_UNDEFINED; ++ } ++ ++ switch (updateopt) { ++ case UOPT_UNDEFINED: ++ pr_err("'--update=%s' is invalid %s. ", ++ c.update, error_addon); ++ outf = stderr; ++ case UOPT_HELP: ++ if (!outf) ++ outf = stdout; ++ fprint_update_options(outf, print_mode); ++ exit(outf == stdout ? 0 : 2); ++ case UOPT_BYTEORDER: + if (ss) { + pr_err("must not set metadata type with --update=byteorder.\n"); + exit(2); + } +- for(i = 0; !ss && superlist[i]; i++) +- ss = superlist[i]->match_metadata_desc( +- "0.swap"); +- if (!ss) { +- pr_err("INTERNAL ERROR cannot find 0.swap\n"); +- exit(2); +- } +- +- continue; ++ default: ++ break; + } +- if (strcmp(c.update,"?") == 0 || +- strcmp(c.update, "help") == 0) { +- outf = stdout; +- fprintf(outf, "%s: ", Name); +- } else { +- outf = stderr; +- fprintf(outf, +- "%s: '--update=%s' is invalid. ", +- Name, c.update); +- } +- fprintf(outf, "Valid --update options are:\n" +- " 'sparc2.2', 'super-minor', 'uuid', 'name', 'nodes', 'resync',\n" +- " 'summaries', 'homehost', 'home-cluster', 'byteorder', 'devicesize',\n" +- " 'bitmap', 'no-bitmap', 'metadata', 'revert-reshape'\n" +- " 'bbl', 'no-bbl', 'force-no-bbl', 'ppl', 'no-ppl'\n" +- " 'layout-original', 'layout-alternate', 'layout-unspecified'\n" +- ); +- exit(outf == stdout ? 0 : 2); +- ++ continue; ++ } + case O(MANAGE,'U'): + /* update=devicesize is allowed with --re-add */ + if (devmode != 'A') { +diff --git a/mdadm.h b/mdadm.h +index 23ffe977..51f1db2d 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -497,6 +497,36 @@ enum special_options { + ConsistencyPolicy, + }; + ++enum update_opt { ++ UOPT_NAME = 1, ++ UOPT_PPL, ++ UOPT_NO_PPL, ++ UOPT_BITMAP, ++ UOPT_NO_BITMAP, ++ UOPT_SUBARRAY_ONLY, ++ UOPT_SPARC22, ++ UOPT_SUPER_MINOR, ++ UOPT_SUMMARIES, ++ UOPT_RESYNC, ++ UOPT_UUID, ++ UOPT_HOMEHOST, ++ UOPT_HOME_CLUSTER, ++ UOPT_NODES, ++ UOPT_DEVICESIZE, ++ UOPT_BBL, ++ UOPT_NO_BBL, ++ UOPT_FORCE_NO_BBL, ++ UOPT_METADATA, ++ UOPT_REVERT_RESHAPE, ++ UOPT_LAYOUT_ORIGINAL, ++ UOPT_LAYOUT_ALTERNATE, ++ UOPT_LAYOUT_UNSPECIFIED, ++ UOPT_BYTEORDER, ++ UOPT_HELP, ++ UOPT_UNDEFINED ++}; ++extern void fprint_update_options(FILE *outf, enum update_opt update_mode); ++ + enum prefix_standard { + JEDEC, + IEC +@@ -777,7 +807,7 @@ extern char *map_num(mapping_t *map, int num); + extern int map_name(mapping_t *map, char *name); + extern mapping_t r0layout[], r5layout[], r6layout[], + pers[], modes[], faultylayout[]; +-extern mapping_t consistency_policies[], sysfs_array_states[]; ++extern mapping_t consistency_policies[], sysfs_array_states[], update_options[]; + + extern char *map_dev_preferred(int major, int minor, int create, + char *prefer); +-- +2.38.1 + diff --git a/SOURCES/0068-Fix-update-subarray-on-active-volume.patch b/SOURCES/0068-Fix-update-subarray-on-active-volume.patch new file mode 100644 index 0000000..7c1c4bc --- /dev/null +++ b/SOURCES/0068-Fix-update-subarray-on-active-volume.patch @@ -0,0 +1,54 @@ +From db10eab68e652f141169b7240e057d110d626c3d Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:35:16 +0100 +Subject: [PATCH 68/83] Fix --update-subarray on active volume + +Options: bitmap, ppl and name should not be updated when array is active. +Those features are mutually exclusive and share the same data area in IMSM (danger of overwriting by kernel). +Remove check for active subarrays from super-intel. +Since ddf is not supported, apply it globally for all options. + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + Manage.c | 7 +++++++ + super-intel.c | 5 ----- + 2 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/Manage.c b/Manage.c +index b1d0e630..5a9ea316 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -1745,6 +1745,13 @@ int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident + goto free_super; + } + ++ if (is_subarray_active(subarray, st->devnm)) { ++ if (verbose >= 0) ++ pr_err("Subarray %s in %s is active, cannot update %s\n", ++ subarray, dev, update); ++ goto free_super; ++ } ++ + if (mdmon_running(st->devnm)) + st->update_tail = &st->updates; + +diff --git a/super-intel.c b/super-intel.c +index b0565610..5f93f3d3 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -7914,11 +7914,6 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, + char *ep; + int vol; + +- if (is_subarray_active(subarray, st->devnm)) { +- pr_err("Unable to update name of active subarray\n"); +- return 2; +- } +- + if (!check_name(super, name, 0)) + return 2; + +-- +2.38.1 + diff --git a/SOURCES/0069-Add-code-specific-update-options-to-enum.patch b/SOURCES/0069-Add-code-specific-update-options-to-enum.patch new file mode 100644 index 0000000..57386f5 --- /dev/null +++ b/SOURCES/0069-Add-code-specific-update-options-to-enum.patch @@ -0,0 +1,77 @@ +From 2257de106cbf17a7f1df33a10cfd2be0d5a064cb Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:35:17 +0100 +Subject: [PATCH 69/83] Add code specific update options to enum. + +Some of update options aren't taken from user input, but are hard-coded +as strings. +Include those options in enum. + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + maps.c | 21 +++++++++++++++++++++ + mdadm.h | 15 +++++++++++++++ + 2 files changed, 36 insertions(+) + +diff --git a/maps.c b/maps.c +index b586679a..c59036f1 100644 +--- a/maps.c ++++ b/maps.c +@@ -194,6 +194,27 @@ mapping_t update_options[] = { + { "byteorder", UOPT_BYTEORDER }, + { "help", UOPT_HELP }, + { "?", UOPT_HELP }, ++ /* ++ * Those enries are temporary and will be removed in this patchset. ++ * ++ * Before update_super:update can be changed to enum, ++ * all update_super sub-functions must be adapted first. ++ * Update options will be passed as string (as it is for now), ++ * and then mapped, so all options must be handled temporarily. ++ * ++ * Those options code specific and should not be accessible for user. ++ */ ++ { "force-one", UOPT_SPEC_FORCE_ONE }, ++ { "force-array", UOPT_SPEC_FORCE_ARRAY }, ++ { "assemble", UOPT_SPEC_ASSEMBLE }, ++ { "linear-grow-new", UOPT_SPEC_LINEAR_GROW_NEW }, ++ { "linear-grow-update", UOPT_SPEC_LINEAR_GROW_UPDATE }, ++ { "_reshape_progress", UOPT_SPEC__RESHAPE_PROGRESS }, ++ { "writemostly", UOPT_SPEC_WRITEMOSTLY }, ++ { "readwrite", UOPT_SPEC_READWRITE }, ++ { "failfast", UOPT_SPEC_FAILFAST }, ++ { "nofailfast", UOPT_SPEC_NOFAILFAST }, ++ { "revert-reshape-nobackup", UOPT_SPEC_REVERT_RESHAPE_NOBACKUP }, + { NULL, UOPT_UNDEFINED} + }; + +diff --git a/mdadm.h b/mdadm.h +index 51f1db2d..31db25f5 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -523,6 +523,21 @@ enum update_opt { + UOPT_LAYOUT_UNSPECIFIED, + UOPT_BYTEORDER, + UOPT_HELP, ++ UOPT_USER_ONLY, ++ /* ++ * Code specific options, cannot be set by the user ++ */ ++ UOPT_SPEC_FORCE_ONE, ++ UOPT_SPEC_FORCE_ARRAY, ++ UOPT_SPEC_ASSEMBLE, ++ UOPT_SPEC_LINEAR_GROW_NEW, ++ UOPT_SPEC_LINEAR_GROW_UPDATE, ++ UOPT_SPEC__RESHAPE_PROGRESS, ++ UOPT_SPEC_WRITEMOSTLY, ++ UOPT_SPEC_READWRITE, ++ UOPT_SPEC_FAILFAST, ++ UOPT_SPEC_NOFAILFAST, ++ UOPT_SPEC_REVERT_RESHAPE_NOBACKUP, + UOPT_UNDEFINED + }; + extern void fprint_update_options(FILE *outf, enum update_opt update_mode); +-- +2.38.1 + diff --git a/SOURCES/0070-super-ddf-Remove-update_super_ddf.patch b/SOURCES/0070-super-ddf-Remove-update_super_ddf.patch new file mode 100644 index 0000000..7a6d213 --- /dev/null +++ b/SOURCES/0070-super-ddf-Remove-update_super_ddf.patch @@ -0,0 +1,106 @@ +From 35aa44c549290e22f285896684c704acb53b7717 Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:35:18 +0100 +Subject: [PATCH 70/83] super-ddf: Remove update_super_ddf. + +This is not supported by ddf. +It hides errors by returning success status for some updates. +Remove update_super_dff(). + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + super-ddf.c | 70 ----------------------------------------------------- + 1 file changed, 70 deletions(-) + +diff --git a/super-ddf.c b/super-ddf.c +index 9d1e3b94..309812df 100644 +--- a/super-ddf.c ++++ b/super-ddf.c +@@ -2139,75 +2139,6 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info, cha + } + } + +-static int update_super_ddf(struct supertype *st, struct mdinfo *info, +- char *update, +- char *devname, int verbose, +- int uuid_set, char *homehost) +-{ +- /* For 'assemble' and 'force' we need to return non-zero if any +- * change was made. For others, the return value is ignored. +- * Update options are: +- * force-one : This device looks a bit old but needs to be included, +- * update age info appropriately. +- * assemble: clear any 'faulty' flag to allow this device to +- * be assembled. +- * force-array: Array is degraded but being forced, mark it clean +- * if that will be needed to assemble it. +- * +- * newdev: not used ???? +- * grow: Array has gained a new device - this is currently for +- * linear only +- * resync: mark as dirty so a resync will happen. +- * uuid: Change the uuid of the array to match what is given +- * homehost: update the recorded homehost +- * name: update the name - preserving the homehost +- * _reshape_progress: record new reshape_progress position. +- * +- * Following are not relevant for this version: +- * sparc2.2 : update from old dodgey metadata +- * super-minor: change the preferred_minor number +- * summaries: update redundant counters. +- */ +- int rv = 0; +-// struct ddf_super *ddf = st->sb; +-// struct vd_config *vd = find_vdcr(ddf, info->container_member); +-// struct virtual_entry *ve = find_ve(ddf); +- +- /* we don't need to handle "force-*" or "assemble" as +- * there is no need to 'trick' the kernel. When the metadata is +- * first updated to activate the array, all the implied modifications +- * will just happen. +- */ +- +- if (strcmp(update, "grow") == 0) { +- /* FIXME */ +- } else if (strcmp(update, "resync") == 0) { +-// info->resync_checkpoint = 0; +- } else if (strcmp(update, "homehost") == 0) { +- /* homehost is stored in controller->vendor_data, +- * or it is when we are the vendor +- */ +-// if (info->vendor_is_local) +-// strcpy(ddf->controller.vendor_data, homehost); +- rv = -1; +- } else if (strcmp(update, "name") == 0) { +- /* name is stored in virtual_entry->name */ +-// memset(ve->name, ' ', 16); +-// strncpy(ve->name, info->name, 16); +- rv = -1; +- } else if (strcmp(update, "_reshape_progress") == 0) { +- /* We don't support reshape yet */ +- } else if (strcmp(update, "assemble") == 0 ) { +- /* Do nothing, just succeed */ +- rv = 0; +- } else +- rv = -1; +- +-// update_all_csum(ddf); +- +- return rv; +-} +- + static void make_header_guid(char *guid) + { + be32 stamp; +@@ -5211,7 +5142,6 @@ struct superswitch super_ddf = { + .match_home = match_home_ddf, + .uuid_from_super= uuid_from_super_ddf, + .getinfo_super = getinfo_super_ddf, +- .update_super = update_super_ddf, + + .avail_size = avail_size_ddf, + +-- +2.38.1 + diff --git a/SOURCES/0071-super0-refactor-the-code-for-enum.patch b/SOURCES/0071-super0-refactor-the-code-for-enum.patch new file mode 100644 index 0000000..f01c534 --- /dev/null +++ b/SOURCES/0071-super0-refactor-the-code-for-enum.patch @@ -0,0 +1,212 @@ +From 0a9e39383d3bf63e1f5cf10f64200083a1af8091 Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:35:19 +0100 +Subject: [PATCH 71/83] super0: refactor the code for enum + +It prepares update_super0 for change context->update to enum. +Change if else statements to switch. + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + super0.c | 102 ++++++++++++++++++++++++++++++++++--------------------- + 1 file changed, 63 insertions(+), 39 deletions(-) + +diff --git a/super0.c b/super0.c +index 93876e2e..d9f5bff4 100644 +--- a/super0.c ++++ b/super0.c +@@ -502,19 +502,39 @@ static int update_super0(struct supertype *st, struct mdinfo *info, + int rv = 0; + int uuid[4]; + mdp_super_t *sb = st->sb; ++ enum update_opt update_enum = map_name(update_options, update); + +- if (strcmp(update, "homehost") == 0 && +- homehost) { +- /* note that 'homehost' is special as it is really ++ if (update_enum == UOPT_HOMEHOST && homehost) { ++ /* ++ * note that 'homehost' is special as it is really + * a "uuid" update. + */ + uuid_set = 0; +- update = "uuid"; ++ update_enum = UOPT_UUID; + info->uuid[0] = sb->set_uuid0; + info->uuid[1] = sb->set_uuid1; + } + +- if (strcmp(update, "sparc2.2")==0 ) { ++ switch (update_enum) { ++ case UOPT_UUID: ++ if (!uuid_set && homehost) { ++ char buf[20]; ++ memcpy(info->uuid+2, ++ sha1_buffer(homehost, strlen(homehost), buf), ++ 8); ++ } ++ sb->set_uuid0 = info->uuid[0]; ++ sb->set_uuid1 = info->uuid[1]; ++ sb->set_uuid2 = info->uuid[2]; ++ sb->set_uuid3 = info->uuid[3]; ++ if (sb->state & (1<uuid, uuid, 16); ++ } ++ break; ++ case UOPT_SPARC22: { + /* 2.2 sparc put the events in the wrong place + * So we copy the tail of the superblock + * up 4 bytes before continuing +@@ -527,12 +547,15 @@ static int update_super0(struct supertype *st, struct mdinfo *info, + if (verbose >= 0) + pr_err("adjusting superblock of %s for 2.2/sparc compatibility.\n", + devname); +- } else if (strcmp(update, "super-minor") ==0) { ++ break; ++ } ++ case UOPT_SUPER_MINOR: + sb->md_minor = info->array.md_minor; + if (verbose > 0) + pr_err("updating superblock of %s with minor number %d\n", + devname, info->array.md_minor); +- } else if (strcmp(update, "summaries") == 0) { ++ break; ++ case UOPT_SUMMARIES: { + unsigned int i; + /* set nr_disks, active_disks, working_disks, + * failed_disks, spare_disks based on disks[] +@@ -559,7 +582,9 @@ static int update_super0(struct supertype *st, struct mdinfo *info, + sb->spare_disks++; + } else if (i >= sb->raid_disks && sb->disks[i].number == 0) + sb->disks[i].state = 0; +- } else if (strcmp(update, "force-one")==0) { ++ break; ++ } ++ case UOPT_SPEC_FORCE_ONE: { + /* Not enough devices for a working array, so + * bring this one up-to-date. + */ +@@ -569,7 +594,9 @@ static int update_super0(struct supertype *st, struct mdinfo *info, + if (sb->events_hi != ehi || + sb->events_lo != elo) + rv = 1; +- } else if (strcmp(update, "force-array")==0) { ++ break; ++ } ++ case UOPT_SPEC_FORCE_ARRAY: + /* degraded array and 'force' requested, so + * maybe need to mark it 'clean' + */ +@@ -579,7 +606,8 @@ static int update_super0(struct supertype *st, struct mdinfo *info, + sb->state |= (1 << MD_SB_CLEAN); + rv = 1; + } +- } else if (strcmp(update, "assemble")==0) { ++ break; ++ case UOPT_SPEC_ASSEMBLE: { + int d = info->disk.number; + int wonly = sb->disks[d].state & (1<disks[d].state & (1<reshape_position = info->reshape_progress; + rv = 1; + } +- } else if (strcmp(update, "linear-grow-new") == 0) { ++ break; ++ } ++ case UOPT_SPEC_LINEAR_GROW_NEW: + memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0])); + sb->disks[info->disk.number].number = info->disk.number; + sb->disks[info->disk.number].major = info->disk.major; +@@ -617,7 +647,8 @@ static int update_super0(struct supertype *st, struct mdinfo *info, + sb->disks[info->disk.number].raid_disk = info->disk.raid_disk; + sb->disks[info->disk.number].state = info->disk.state; + sb->this_disk = sb->disks[info->disk.number]; +- } else if (strcmp(update, "linear-grow-update") == 0) { ++ break; ++ case UOPT_SPEC_LINEAR_GROW_UPDATE: + sb->raid_disks = info->array.raid_disks; + sb->nr_disks = info->array.nr_disks; + sb->active_disks = info->array.active_disks; +@@ -628,29 +659,15 @@ static int update_super0(struct supertype *st, struct mdinfo *info, + sb->disks[info->disk.number].minor = info->disk.minor; + sb->disks[info->disk.number].raid_disk = info->disk.raid_disk; + sb->disks[info->disk.number].state = info->disk.state; +- } else if (strcmp(update, "resync") == 0) { +- /* make sure resync happens */ ++ break; ++ case UOPT_RESYNC: ++ /* ++ * make sure resync happens ++ */ + sb->state &= ~(1<recovery_cp = 0; +- } else if (strcmp(update, "uuid") == 0) { +- if (!uuid_set && homehost) { +- char buf[20]; +- char *hash = sha1_buffer(homehost, +- strlen(homehost), +- buf); +- memcpy(info->uuid+2, hash, 8); +- } +- sb->set_uuid0 = info->uuid[0]; +- sb->set_uuid1 = info->uuid[1]; +- sb->set_uuid2 = info->uuid[2]; +- sb->set_uuid3 = info->uuid[3]; +- if (sb->state & (1<uuid, uuid, 16); +- } +- } else if (strcmp(update, "metadata") == 0) { ++ break; ++ case UOPT_METADATA: + /* Create some v1.0 metadata to match ours but make the + * ctime bigger. Also update info->array.*_version. + * We need to arrange that store_super writes out +@@ -670,7 +687,8 @@ static int update_super0(struct supertype *st, struct mdinfo *info, + uuid_from_super0(st, info->uuid); + st->other = super1_make_v0(st, info, st->sb); + } +- } else if (strcmp(update, "revert-reshape") == 0) { ++ break; ++ case UOPT_REVERT_RESHAPE: + rv = -2; + if (sb->minor_version <= 90) + pr_err("No active reshape to revert on %s\n", +@@ -702,16 +720,22 @@ static int update_super0(struct supertype *st, struct mdinfo *info, + sb->new_chunk = sb->chunk_size; + sb->chunk_size = tmp; + } +- } else if (strcmp(update, "no-bitmap") == 0) { ++ break; ++ case UOPT_NO_BITMAP: + sb->state &= ~(1<reshape_position = info->reshape_progress; +- else if (strcmp(update, "writemostly")==0) ++ break; ++ case UOPT_SPEC_WRITEMOSTLY: + sb->state |= (1<state &= ~(1<sb_csum = calc_sb0_csum(sb); + return rv; +-- +2.38.1 + diff --git a/SOURCES/0072-super1-refactor-the-code-for-enum.patch b/SOURCES/0072-super1-refactor-the-code-for-enum.patch new file mode 100644 index 0000000..bd164b8 --- /dev/null +++ b/SOURCES/0072-super1-refactor-the-code-for-enum.patch @@ -0,0 +1,302 @@ +From 7e8daba8b7937716dce8ea28298a4e2e72cb829e Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:35:20 +0100 +Subject: [PATCH 72/83] super1: refactor the code for enum + +It prepares update_super1 for change context->update to enum. +Change if else statements into switch. + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + super1.c | 152 +++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 91 insertions(+), 61 deletions(-) + +diff --git a/super1.c b/super1.c +index 0b505a7e..b0a97016 100644 +--- a/super1.c ++++ b/super1.c +@@ -1218,30 +1218,55 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + int rv = 0; + struct mdp_superblock_1 *sb = st->sb; + bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE); ++ enum update_opt update_enum = map_name(update_options, update); + +- if (strcmp(update, "homehost") == 0 && +- homehost) { +- /* Note that 'homehost' is special as it is really ++ if (update_enum == UOPT_HOMEHOST && homehost) { ++ /* ++ * Note that 'homehost' is special as it is really + * a "name" update. + */ + char *c; +- update = "name"; ++ update_enum = UOPT_NAME; + c = strchr(sb->set_name, ':'); + if (c) +- strncpy(info->name, c+1, 31 - (c-sb->set_name)); ++ snprintf(info->name, sizeof(info->name), "%s", c+1); + else +- strncpy(info->name, sb->set_name, 32); +- info->name[32] = 0; ++ snprintf(info->name, sizeof(info->name), "%s", sb->set_name); + } + +- if (strcmp(update, "force-one")==0) { ++ switch (update_enum) { ++ case UOPT_NAME: { ++ int namelen; ++ ++ if (!info->name[0]) ++ snprintf(info->name, sizeof(info->name), "%d", info->array.md_minor); ++ memset(sb->set_name, 0, sizeof(sb->set_name)); ++ ++ namelen = strnlen(homehost, MD_NAME_MAX) + 1 + strnlen(info->name, MD_NAME_MAX); ++ if (homehost && ++ strchr(info->name, ':') == NULL && ++ namelen < MD_NAME_MAX) { ++ strcpy(sb->set_name, homehost); ++ strcat(sb->set_name, ":"); ++ strcat(sb->set_name, info->name); ++ } else { ++ namelen = min((int)strnlen(info->name, MD_NAME_MAX), ++ (int)sizeof(sb->set_name) - 1); ++ memcpy(sb->set_name, info->name, namelen); ++ memset(&sb->set_name[namelen], '\0', ++ sizeof(sb->set_name) - namelen); ++ } ++ break; ++ } ++ case UOPT_SPEC_FORCE_ONE: + /* Not enough devices for a working array, + * so bring this one up-to-date + */ + if (sb->events != __cpu_to_le64(info->events)) + rv = 1; + sb->events = __cpu_to_le64(info->events); +- } else if (strcmp(update, "force-array")==0) { ++ break; ++ case UOPT_SPEC_FORCE_ARRAY: + /* Degraded array and 'force' requests to + * maybe need to mark it 'clean'. + */ +@@ -1254,7 +1279,8 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + rv = 1; + sb->resync_offset = MaxSector; + } +- } else if (strcmp(update, "assemble")==0) { ++ break; ++ case UOPT_SPEC_ASSEMBLE: { + int d = info->disk.number; + int want; + if (info->disk.state & (1<reshape_progress); + rv = 1; + } +- } else if (strcmp(update, "linear-grow-new") == 0) { ++ break; ++ } ++ case UOPT_SPEC_LINEAR_GROW_NEW: { + int i; + int fd; + int max = __le32_to_cpu(sb->max_dev); +@@ -1330,7 +1358,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + ds - __le64_to_cpu(sb->data_offset)); + } + } +- } else if (strcmp(update, "linear-grow-update") == 0) { ++ break; ++ } ++ case UOPT_SPEC_LINEAR_GROW_UPDATE: { + int max = __le32_to_cpu(sb->max_dev); + int i = info->disk.number; + if (max > MAX_DEVS || i > MAX_DEVS) +@@ -1342,19 +1372,20 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + sb->raid_disks = __cpu_to_le32(info->array.raid_disks); + sb->dev_roles[info->disk.number] = + __cpu_to_le16(info->disk.raid_disk); +- } else if (strcmp(update, "resync") == 0) { +- /* make sure resync happens */ +- sb->resync_offset = 0ULL; +- } else if (strcmp(update, "uuid") == 0) { ++ break; ++ } ++ case UOPT_UUID: + copy_uuid(sb->set_uuid, info->uuid, super1.swapuuid); + + if (__le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET) + memcpy(bms->uuid, sb->set_uuid, 16); +- } else if (strcmp(update, "no-bitmap") == 0) { ++ break; ++ case UOPT_NO_BITMAP: + sb->feature_map &= ~__cpu_to_le32(MD_FEATURE_BITMAP_OFFSET); + if (bms->version == BITMAP_MAJOR_CLUSTERED && !IsBitmapDirty(devname)) + sb->resync_offset = MaxSector; +- } else if (strcmp(update, "bbl") == 0) { ++ break; ++ case UOPT_BBL: { + /* only possible if there is room after the bitmap, or if + * there is no bitmap + */ +@@ -1383,14 +1414,12 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + bb_offset = bitmap_offset + bm_sectors; + while (bb_offset < (long)sb_offset + 8 + 32*2 && + bb_offset + 8+8 <= (long)data_offset) +- /* too close to bitmap, and room to grow */ + bb_offset += 8; + if (bb_offset + 8 <= (long)data_offset) { + sb->bblog_size = __cpu_to_le16(8); + sb->bblog_offset = __cpu_to_le32(bb_offset); + } + } else { +- /* 1.0 - Put bbl just before super block */ + if (bm_sectors && bitmap_offset < 0) + space = -bitmap_offset - bm_sectors; + else +@@ -1401,7 +1430,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + sb->bblog_offset = __cpu_to_le32((unsigned)-8); + } + } +- } else if (strcmp(update, "no-bbl") == 0) { ++ break; ++ } ++ case UOPT_NO_BBL: + if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BAD_BLOCKS)) + pr_err("Cannot remove active bbl from %s\n",devname); + else { +@@ -1409,12 +1440,14 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + sb->bblog_shift = 0; + sb->bblog_offset = 0; + } +- } else if (strcmp(update, "force-no-bbl") == 0) { ++ break; ++ case UOPT_FORCE_NO_BBL: + sb->feature_map &= ~ __cpu_to_le32(MD_FEATURE_BAD_BLOCKS); + sb->bblog_size = 0; + sb->bblog_shift = 0; + sb->bblog_offset = 0; +- } else if (strcmp(update, "ppl") == 0) { ++ break; ++ case UOPT_PPL: { + unsigned long long sb_offset = __le64_to_cpu(sb->super_offset); + unsigned long long data_offset = __le64_to_cpu(sb->data_offset); + unsigned long long data_size = __le64_to_cpu(sb->data_size); +@@ -1464,37 +1497,26 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + sb->ppl.offset = __cpu_to_le16(offset); + sb->ppl.size = __cpu_to_le16(space); + sb->feature_map |= __cpu_to_le32(MD_FEATURE_PPL); +- } else if (strcmp(update, "no-ppl") == 0) { ++ break; ++ } ++ case UOPT_NO_PPL: + sb->feature_map &= ~__cpu_to_le32(MD_FEATURE_PPL | + MD_FEATURE_MUTLIPLE_PPLS); +- } else if (strcmp(update, "name") == 0) { +- if (info->name[0] == 0) +- sprintf(info->name, "%d", info->array.md_minor); +- memset(sb->set_name, 0, sizeof(sb->set_name)); +- if (homehost && +- strchr(info->name, ':') == NULL && +- strlen(homehost)+1+strlen(info->name) < 32) { +- strcpy(sb->set_name, homehost); +- strcat(sb->set_name, ":"); +- strcat(sb->set_name, info->name); +- } else { +- int namelen; +- +- namelen = min((int)strlen(info->name), +- (int)sizeof(sb->set_name) - 1); +- memcpy(sb->set_name, info->name, namelen); +- memset(&sb->set_name[namelen], '\0', +- sizeof(sb->set_name) - namelen); +- } +- } else if (strcmp(update, "devicesize") == 0 && +- __le64_to_cpu(sb->super_offset) < +- __le64_to_cpu(sb->data_offset)) { +- /* set data_size to device size less data_offset */ ++ break; ++ case UOPT_DEVICESIZE: ++ if (__le64_to_cpu(sb->super_offset) >= ++ __le64_to_cpu(sb->data_offset)) ++ break; ++ /* ++ * set data_size to device size less data_offset ++ */ + struct misc_dev_info *misc = (struct misc_dev_info*) + (st->sb + MAX_SB_SIZE + BM_SUPER_SIZE); + sb->data_size = __cpu_to_le64( + misc->device_size - __le64_to_cpu(sb->data_offset)); +- } else if (strncmp(update, "revert-reshape", 14) == 0) { ++ break; ++ case UOPT_SPEC_REVERT_RESHAPE_NOBACKUP: ++ case UOPT_REVERT_RESHAPE: + rv = -2; + if (!(sb->feature_map & + __cpu_to_le32(MD_FEATURE_RESHAPE_ACTIVE))) +@@ -1512,7 +1534,7 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + * If that couldn't happen, the "-nobackup" version + * will be used. + */ +- if (strcmp(update, "revert-reshape-nobackup") == 0 && ++ if (update_enum == UOPT_SPEC_REVERT_RESHAPE_NOBACKUP && + sb->reshape_position == 0 && + (__le32_to_cpu(sb->delta_disks) > 0 || + (__le32_to_cpu(sb->delta_disks) == 0 && +@@ -1575,32 +1597,40 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + } + done:; + } +- } else if (strcmp(update, "_reshape_progress") == 0) ++ break; ++ case UOPT_SPEC__RESHAPE_PROGRESS: + sb->reshape_position = __cpu_to_le64(info->reshape_progress); +- else if (strcmp(update, "writemostly") == 0) ++ break; ++ case UOPT_SPEC_WRITEMOSTLY: + sb->devflags |= WriteMostly1; +- else if (strcmp(update, "readwrite") == 0) ++ break; ++ case UOPT_SPEC_READWRITE: + sb->devflags &= ~WriteMostly1; +- else if (strcmp(update, "failfast") == 0) ++ break; ++ case UOPT_SPEC_FAILFAST: + sb->devflags |= FailFast1; +- else if (strcmp(update, "nofailfast") == 0) ++ break; ++ case UOPT_SPEC_NOFAILFAST: + sb->devflags &= ~FailFast1; +- else if (strcmp(update, "layout-original") == 0 || +- strcmp(update, "layout-alternate") == 0 || +- strcmp(update, "layout-unspecified") == 0) { ++ break; ++ case UOPT_LAYOUT_ORIGINAL: ++ case UOPT_LAYOUT_ALTERNATE: ++ case UOPT_LAYOUT_UNSPECIFIED: + if (__le32_to_cpu(sb->level) != 0) { + pr_err("%s: %s only supported for RAID0\n", +- devname?:"", update); ++ devname ?: "", map_num(update_options, update_enum)); + rv = -1; +- } else if (strcmp(update, "layout-unspecified") == 0) { ++ } else if (update_enum == UOPT_LAYOUT_UNSPECIFIED) { + sb->feature_map &= ~__cpu_to_le32(MD_FEATURE_RAID0_LAYOUT); + sb->layout = 0; + } else { + sb->feature_map |= __cpu_to_le32(MD_FEATURE_RAID0_LAYOUT); +- sb->layout = __cpu_to_le32(update[7] == 'o' ? 1 : 2); ++ sb->layout = __cpu_to_le32(update_enum == UOPT_LAYOUT_ORIGINAL ? 1 : 2); + } +- } else ++ break; ++ default: + rv = -1; ++ } + + sb->sb_csum = calc_sb_1_csum(sb); + +-- +2.38.1 + diff --git a/SOURCES/0073-super-intel-refactor-the-code-for-enum.patch b/SOURCES/0073-super-intel-refactor-the-code-for-enum.patch new file mode 100644 index 0000000..6756297 --- /dev/null +++ b/SOURCES/0073-super-intel-refactor-the-code-for-enum.patch @@ -0,0 +1,106 @@ +From 4345e135c4c7dd04bb15bad140dfc4747f677738 Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:35:21 +0100 +Subject: [PATCH 73/83] super-intel: refactor the code for enum + +It prepares super-intel for change context->update to enum. + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + super-intel.c | 37 +++++++++++++++++++++++++------------ + 1 file changed, 25 insertions(+), 12 deletions(-) + +diff --git a/super-intel.c b/super-intel.c +index 5f93f3d3..85fb7f17 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -3930,7 +3930,8 @@ static int update_super_imsm(struct supertype *st, struct mdinfo *info, + + mpb = super->anchor; + +- if (strcmp(update, "uuid") == 0) { ++ switch (map_name(update_options, update)) { ++ case UOPT_UUID: + /* We take this to mean that the family_num should be updated. + * However that is much smaller than the uuid so we cannot really + * allow an explicit uuid to be given. And it is hard to reliably +@@ -3954,10 +3955,14 @@ static int update_super_imsm(struct supertype *st, struct mdinfo *info, + } + if (rv == 0) + mpb->orig_family_num = info->uuid[0]; +- } else if (strcmp(update, "assemble") == 0) ++ break; ++ case UOPT_SPEC_ASSEMBLE: + rv = 0; +- else ++ break; ++ default: + rv = -1; ++ break; ++ } + + /* successful update? recompute checksum */ + if (rv == 0) +@@ -7889,17 +7894,25 @@ static int kill_subarray_imsm(struct supertype *st, char *subarray_id) + return 0; + } + +-static int get_rwh_policy_from_update(char *update) ++/** ++ * get_rwh_policy_from_update() - Get the rwh policy for update option. ++ * @update: Update option. ++ */ ++static int get_rwh_policy_from_update(enum update_opt update) + { +- if (strcmp(update, "ppl") == 0) ++ switch (update) { ++ case UOPT_PPL: + return RWH_MULTIPLE_DISTRIBUTED; +- else if (strcmp(update, "no-ppl") == 0) ++ case UOPT_NO_PPL: + return RWH_MULTIPLE_OFF; +- else if (strcmp(update, "bitmap") == 0) ++ case UOPT_BITMAP: + return RWH_BITMAP; +- else if (strcmp(update, "no-bitmap") == 0) ++ case UOPT_NO_BITMAP: + return RWH_OFF; +- return -1; ++ default: ++ break; ++ } ++ return UOPT_UNDEFINED; + } + + static int update_subarray_imsm(struct supertype *st, char *subarray, +@@ -7909,7 +7922,7 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, + struct intel_super *super = st->sb; + struct imsm_super *mpb = super->anchor; + +- if (strcmp(update, "name") == 0) { ++ if (map_name(update_options, update) == UOPT_NAME) { + char *name = ident->name; + char *ep; + int vol; +@@ -7943,7 +7956,7 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, + } + super->updates_pending++; + } +- } else if (get_rwh_policy_from_update(update) != -1) { ++ } else if (get_rwh_policy_from_update(map_name(update_options, update)) != UOPT_UNDEFINED) { + int new_policy; + char *ep; + int vol = strtoul(subarray, &ep, 10); +@@ -7951,7 +7964,7 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, + if (*ep != '\0' || vol >= super->anchor->num_raid_devs) + return 2; + +- new_policy = get_rwh_policy_from_update(update); ++ new_policy = get_rwh_policy_from_update(map_name(update_options, update)); + + if (st->update_tail) { + struct imsm_update_rwh_policy *u = xmalloc(sizeof(*u)); +-- +2.38.1 + diff --git a/SOURCES/0074-Change-update-to-enum-in-update_super-and-update_sub.patch b/SOURCES/0074-Change-update-to-enum-in-update_super-and-update_sub.patch new file mode 100644 index 0000000..c9e186e --- /dev/null +++ b/SOURCES/0074-Change-update-to-enum-in-update_super-and-update_sub.patch @@ -0,0 +1,424 @@ +From 03312b5240438ffc3b63114bdc87e911222f01e5 Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:35:22 +0100 +Subject: [PATCH 74/83] Change update to enum in update_super and + update_subarray + +Use already existing enum, change update_super and update_subarray +update to enum globally. +Refactor function references also. +Remove code specific options from update_options. + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + Assemble.c | 14 +++++++++----- + Examine.c | 2 +- + Grow.c | 9 +++++---- + Manage.c | 14 ++++++++------ + maps.c | 21 --------------------- + mdadm.h | 12 +++++++++--- + super-intel.c | 16 ++++++++-------- + super0.c | 9 ++++----- + super1.c | 17 ++++++++--------- + 9 files changed, 52 insertions(+), 62 deletions(-) + +diff --git a/Assemble.c b/Assemble.c +index 8b0af0c9..dba910cd 100644 +--- a/Assemble.c ++++ b/Assemble.c +@@ -695,12 +695,16 @@ static int load_devices(struct devs *devices, char *devmap, + } else if (strcmp(c->update, "revert-reshape") == 0 && + c->invalid_backup) + err = tst->ss->update_super(tst, content, +- "revert-reshape-nobackup", ++ UOPT_SPEC_REVERT_RESHAPE_NOBACKUP, + devname, c->verbose, + ident->uuid_set, + c->homehost); + else +- err = tst->ss->update_super(tst, content, c->update, ++ /* ++ * Mapping is temporary, will be removed in this patchset ++ */ ++ err = tst->ss->update_super(tst, content, ++ map_name(update_options, c->update), + devname, c->verbose, + ident->uuid_set, + c->homehost); +@@ -960,7 +964,7 @@ static int force_array(struct mdinfo *content, + continue; + } + content->events = devices[most_recent].i.events; +- tst->ss->update_super(tst, content, "force-one", ++ tst->ss->update_super(tst, content, UOPT_SPEC_FORCE_ONE, + devices[chosen_drive].devname, c->verbose, + 0, NULL); + +@@ -1788,7 +1792,7 @@ try_again: + if (!(devices[j].i.array.state & 1)) + clean = 0; + +- if (st->ss->update_super(st, &devices[j].i, "assemble", NULL, ++ if (st->ss->update_super(st, &devices[j].i, UOPT_SPEC_ASSEMBLE, NULL, + c->verbose, 0, NULL)) { + if (c->force) { + if (c->verbose >= 0) +@@ -1811,7 +1815,7 @@ try_again: + if (c->force && !clean && !is_container(content->array.level) && + !enough(content->array.level, content->array.raid_disks, + content->array.layout, clean, avail)) { +- change += st->ss->update_super(st, content, "force-array", ++ change += st->ss->update_super(st, content, UOPT_SPEC_FORCE_ARRAY, + devices[chosen_drive].devname, c->verbose, + 0, NULL); + was_forced = 1; +diff --git a/Examine.c b/Examine.c +index 9574a3cc..c9605a60 100644 +--- a/Examine.c ++++ b/Examine.c +@@ -117,7 +117,7 @@ int Examine(struct mddev_dev *devlist, + } + + if (c->SparcAdjust) +- st->ss->update_super(st, NULL, "sparc2.2", ++ st->ss->update_super(st, NULL, UOPT_SPARC22, + devlist->devname, 0, 0, NULL); + /* Ok, its good enough to try, though the checksum could be wrong */ + +diff --git a/Grow.c b/Grow.c +index b73ec2ae..82d5d2ea 100644 +--- a/Grow.c ++++ b/Grow.c +@@ -196,7 +196,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev) + info.disk.minor = minor(rdev); + info.disk.raid_disk = d; + info.disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE); +- if (st->ss->update_super(st, &info, "linear-grow-new", newdev, ++ if (st->ss->update_super(st, &info, UOPT_SPEC_LINEAR_GROW_NEW, newdev, + 0, 0, NULL) != 0) { + pr_err("Preparing new metadata failed on %s\n", newdev); + close(nfd); +@@ -254,7 +254,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev) + info.array.active_disks = nd+1; + info.array.working_disks = nd+1; + +- if (st->ss->update_super(st, &info, "linear-grow-update", dv, ++ if (st->ss->update_super(st, &info, UOPT_SPEC_LINEAR_GROW_UPDATE, dv, + 0, 0, NULL) != 0) { + pr_err("Updating metadata failed on %s\n", dv); + close(fd2); +@@ -668,7 +668,7 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha + goto free_info; + } + +- ret = st->ss->update_super(st, sra, "ppl", ++ ret = st->ss->update_super(st, sra, UOPT_PPL, + devname, + c->verbose, 0, NULL); + if (ret) { +@@ -4950,7 +4950,8 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, + continue; + st->ss->getinfo_super(st, &dinfo, NULL); + dinfo.reshape_progress = info->reshape_progress; +- st->ss->update_super(st, &dinfo, "_reshape_progress", ++ st->ss->update_super(st, &dinfo, ++ UOPT_SPEC__RESHAPE_PROGRESS, + NULL,0, 0, NULL); + st->ss->store_super(st, fdlist[j]); + st->ss->free_super(st); +diff --git a/Manage.c b/Manage.c +index 5a9ea316..87b8aa0c 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -605,6 +605,7 @@ int attempt_re_add(int fd, int tfd, struct mddev_dev *dv, + struct mdinfo mdi; + int duuid[4]; + int ouuid[4]; ++ enum update_opt update_enum = map_name(update_options, update); + + dev_st->ss->getinfo_super(dev_st, &mdi, NULL); + dev_st->ss->uuid_from_super(dev_st, ouuid); +@@ -666,23 +667,23 @@ int attempt_re_add(int fd, int tfd, struct mddev_dev *dv, + + if (dv->writemostly == FlagSet) + rv = dev_st->ss->update_super( +- dev_st, NULL, "writemostly", ++ dev_st, NULL, UOPT_SPEC_WRITEMOSTLY, + devname, verbose, 0, NULL); + if (dv->writemostly == FlagClear) + rv = dev_st->ss->update_super( +- dev_st, NULL, "readwrite", ++ dev_st, NULL, UOPT_SPEC_READWRITE, + devname, verbose, 0, NULL); + if (dv->failfast == FlagSet) + rv = dev_st->ss->update_super( +- dev_st, NULL, "failfast", ++ dev_st, NULL, UOPT_SPEC_FAILFAST, + devname, verbose, 0, NULL); + if (dv->failfast == FlagClear) + rv = dev_st->ss->update_super( +- dev_st, NULL, "nofailfast", ++ dev_st, NULL, UOPT_SPEC_NOFAILFAST, + devname, verbose, 0, NULL); + if (update) + rv = dev_st->ss->update_super( +- dev_st, NULL, update, ++ dev_st, NULL, update_enum, + devname, verbose, 0, NULL); + if (rv == 0) + rv = dev_st->ss->store_super(dev_st, tfd); +@@ -1731,6 +1732,7 @@ int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident + struct supertype supertype, *st = &supertype; + int fd, rv = 2; + struct mdinfo *info = NULL; ++ enum update_opt update_enum = map_name(update_options, update); + + memset(st, 0, sizeof(*st)); + +@@ -1762,7 +1764,7 @@ int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident + goto free_super; + } + +- rv = st->ss->update_subarray(st, subarray, update, ident); ++ rv = st->ss->update_subarray(st, subarray, update_enum, ident); + + if (rv) { + if (verbose >= 0) +diff --git a/maps.c b/maps.c +index c59036f1..b586679a 100644 +--- a/maps.c ++++ b/maps.c +@@ -194,27 +194,6 @@ mapping_t update_options[] = { + { "byteorder", UOPT_BYTEORDER }, + { "help", UOPT_HELP }, + { "?", UOPT_HELP }, +- /* +- * Those enries are temporary and will be removed in this patchset. +- * +- * Before update_super:update can be changed to enum, +- * all update_super sub-functions must be adapted first. +- * Update options will be passed as string (as it is for now), +- * and then mapped, so all options must be handled temporarily. +- * +- * Those options code specific and should not be accessible for user. +- */ +- { "force-one", UOPT_SPEC_FORCE_ONE }, +- { "force-array", UOPT_SPEC_FORCE_ARRAY }, +- { "assemble", UOPT_SPEC_ASSEMBLE }, +- { "linear-grow-new", UOPT_SPEC_LINEAR_GROW_NEW }, +- { "linear-grow-update", UOPT_SPEC_LINEAR_GROW_UPDATE }, +- { "_reshape_progress", UOPT_SPEC__RESHAPE_PROGRESS }, +- { "writemostly", UOPT_SPEC_WRITEMOSTLY }, +- { "readwrite", UOPT_SPEC_READWRITE }, +- { "failfast", UOPT_SPEC_FAILFAST }, +- { "nofailfast", UOPT_SPEC_NOFAILFAST }, +- { "revert-reshape-nobackup", UOPT_SPEC_REVERT_RESHAPE_NOBACKUP }, + { NULL, UOPT_UNDEFINED} + }; + +diff --git a/mdadm.h b/mdadm.h +index 31db25f5..5dc94390 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -1011,7 +1011,7 @@ extern struct superswitch { + * it will resume going in the opposite direction. + */ + int (*update_super)(struct supertype *st, struct mdinfo *info, +- char *update, ++ enum update_opt update, + char *devname, int verbose, + int uuid_set, char *homehost); + +@@ -1137,9 +1137,15 @@ extern struct superswitch { + /* Permit subarray's to be deleted from inactive containers */ + int (*kill_subarray)(struct supertype *st, + char *subarray_id); /* optional */ +- /* Permit subarray's to be modified */ ++ /** ++ * update_subarray() - Permit subarray to be modified. ++ * @st: Supertype. ++ * @subarray: Subarray name. ++ * @update: Update option. ++ * @ident: Optional identifiers. ++ */ + int (*update_subarray)(struct supertype *st, char *subarray, +- char *update, struct mddev_ident *ident); /* optional */ ++ enum update_opt update, struct mddev_ident *ident); + /* Check if reshape is supported for this external format. + * st is obtained from super_by_fd() where st->subarray[0] is + * initialized to indicate if reshape is being performed at the +diff --git a/super-intel.c b/super-intel.c +index 85fb7f17..1f5f6eda 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -3893,8 +3893,8 @@ struct mdinfo *getinfo_super_disks_imsm(struct supertype *st) + } + + static int update_super_imsm(struct supertype *st, struct mdinfo *info, +- char *update, char *devname, int verbose, +- int uuid_set, char *homehost) ++ enum update_opt update, char *devname, ++ int verbose, int uuid_set, char *homehost) + { + /* For 'assemble' and 'force' we need to return non-zero if any + * change was made. For others, the return value is ignored. +@@ -3930,7 +3930,7 @@ static int update_super_imsm(struct supertype *st, struct mdinfo *info, + + mpb = super->anchor; + +- switch (map_name(update_options, update)) { ++ switch (update) { + case UOPT_UUID: + /* We take this to mean that the family_num should be updated. + * However that is much smaller than the uuid so we cannot really +@@ -6538,7 +6538,7 @@ static int validate_ppl_imsm(struct supertype *st, struct mdinfo *info, + if (mdmon_running(st->container_devnm)) + st->update_tail = &st->updates; + +- if (st->ss->update_subarray(st, subarray, "ppl", NULL)) { ++ if (st->ss->update_subarray(st, subarray, UOPT_PPL, NULL)) { + pr_err("Failed to update subarray %s\n", + subarray); + } else { +@@ -7916,13 +7916,13 @@ static int get_rwh_policy_from_update(enum update_opt update) + } + + static int update_subarray_imsm(struct supertype *st, char *subarray, +- char *update, struct mddev_ident *ident) ++ enum update_opt update, struct mddev_ident *ident) + { + /* update the subarray currently referenced by ->current_vol */ + struct intel_super *super = st->sb; + struct imsm_super *mpb = super->anchor; + +- if (map_name(update_options, update) == UOPT_NAME) { ++ if (update == UOPT_NAME) { + char *name = ident->name; + char *ep; + int vol; +@@ -7956,7 +7956,7 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, + } + super->updates_pending++; + } +- } else if (get_rwh_policy_from_update(map_name(update_options, update)) != UOPT_UNDEFINED) { ++ } else if (get_rwh_policy_from_update(update) != UOPT_UNDEFINED) { + int new_policy; + char *ep; + int vol = strtoul(subarray, &ep, 10); +@@ -7964,7 +7964,7 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, + if (*ep != '\0' || vol >= super->anchor->num_raid_devs) + return 2; + +- new_policy = get_rwh_policy_from_update(map_name(update_options, update)); ++ new_policy = get_rwh_policy_from_update(update); + + if (st->update_tail) { + struct imsm_update_rwh_policy *u = xmalloc(sizeof(*u)); +diff --git a/super0.c b/super0.c +index d9f5bff4..a7c5f813 100644 +--- a/super0.c ++++ b/super0.c +@@ -491,7 +491,7 @@ static struct mdinfo *container_content0(struct supertype *st, char *subarray) + } + + static int update_super0(struct supertype *st, struct mdinfo *info, +- char *update, ++ enum update_opt update, + char *devname, int verbose, + int uuid_set, char *homehost) + { +@@ -502,20 +502,19 @@ static int update_super0(struct supertype *st, struct mdinfo *info, + int rv = 0; + int uuid[4]; + mdp_super_t *sb = st->sb; +- enum update_opt update_enum = map_name(update_options, update); + +- if (update_enum == UOPT_HOMEHOST && homehost) { ++ if (update == UOPT_HOMEHOST && homehost) { + /* + * note that 'homehost' is special as it is really + * a "uuid" update. + */ + uuid_set = 0; +- update_enum = UOPT_UUID; ++ update = UOPT_UUID; + info->uuid[0] = sb->set_uuid0; + info->uuid[1] = sb->set_uuid1; + } + +- switch (update_enum) { ++ switch (update) { + case UOPT_UUID: + if (!uuid_set && homehost) { + char buf[20]; +diff --git a/super1.c b/super1.c +index b0a97016..f7020320 100644 +--- a/super1.c ++++ b/super1.c +@@ -1208,7 +1208,7 @@ static struct mdinfo *container_content1(struct supertype *st, char *subarray) + } + + static int update_super1(struct supertype *st, struct mdinfo *info, +- char *update, char *devname, int verbose, ++ enum update_opt update, char *devname, int verbose, + int uuid_set, char *homehost) + { + /* NOTE: for 'assemble' and 'force' we need to return non-zero +@@ -1218,15 +1218,14 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + int rv = 0; + struct mdp_superblock_1 *sb = st->sb; + bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE); +- enum update_opt update_enum = map_name(update_options, update); + +- if (update_enum == UOPT_HOMEHOST && homehost) { ++ if (update == UOPT_HOMEHOST && homehost) { + /* + * Note that 'homehost' is special as it is really + * a "name" update. + */ + char *c; +- update_enum = UOPT_NAME; ++ update = UOPT_NAME; + c = strchr(sb->set_name, ':'); + if (c) + snprintf(info->name, sizeof(info->name), "%s", c+1); +@@ -1234,7 +1233,7 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + snprintf(info->name, sizeof(info->name), "%s", sb->set_name); + } + +- switch (update_enum) { ++ switch (update) { + case UOPT_NAME: { + int namelen; + +@@ -1534,7 +1533,7 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + * If that couldn't happen, the "-nobackup" version + * will be used. + */ +- if (update_enum == UOPT_SPEC_REVERT_RESHAPE_NOBACKUP && ++ if (update == UOPT_SPEC_REVERT_RESHAPE_NOBACKUP && + sb->reshape_position == 0 && + (__le32_to_cpu(sb->delta_disks) > 0 || + (__le32_to_cpu(sb->delta_disks) == 0 && +@@ -1618,14 +1617,14 @@ static int update_super1(struct supertype *st, struct mdinfo *info, + case UOPT_LAYOUT_UNSPECIFIED: + if (__le32_to_cpu(sb->level) != 0) { + pr_err("%s: %s only supported for RAID0\n", +- devname ?: "", map_num(update_options, update_enum)); ++ devname ?: "", map_num(update_options, update)); + rv = -1; +- } else if (update_enum == UOPT_LAYOUT_UNSPECIFIED) { ++ } else if (update == UOPT_LAYOUT_UNSPECIFIED) { + sb->feature_map &= ~__cpu_to_le32(MD_FEATURE_RAID0_LAYOUT); + sb->layout = 0; + } else { + sb->feature_map |= __cpu_to_le32(MD_FEATURE_RAID0_LAYOUT); +- sb->layout = __cpu_to_le32(update_enum == UOPT_LAYOUT_ORIGINAL ? 1 : 2); ++ sb->layout = __cpu_to_le32(update == UOPT_LAYOUT_ORIGINAL ? 1 : 2); + } + break; + default: +-- +2.38.1 + diff --git a/SOURCES/0075-Manage-Incremental-code-refactor-string-to-enum.patch b/SOURCES/0075-Manage-Incremental-code-refactor-string-to-enum.patch new file mode 100644 index 0000000..d4b20ff --- /dev/null +++ b/SOURCES/0075-Manage-Incremental-code-refactor-string-to-enum.patch @@ -0,0 +1,279 @@ +From f2e8393bd7223c419aaa33c45feeb5c75440b986 Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:35:23 +0100 +Subject: [PATCH 75/83] Manage&Incremental: code refactor, string to enum + +Prepare Manage and Incremental for later changing context->update to enum. +Change update from string to enum in multiple functions and pass enum +where already possible. + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + Grow.c | 8 ++++---- + Incremental.c | 8 ++++---- + Manage.c | 35 +++++++++++++++++------------------ + mdadm.c | 23 ++++++++++++++++++----- + mdadm.h | 4 ++-- + 5 files changed, 45 insertions(+), 33 deletions(-) + +diff --git a/Grow.c b/Grow.c +index 82d5d2ea..8f5cf07d 100644 +--- a/Grow.c ++++ b/Grow.c +@@ -605,12 +605,12 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha + } + + if (subarray) { +- char *update; ++ enum update_opt update; + + if (s->consistency_policy == CONSISTENCY_POLICY_PPL) +- update = "ppl"; ++ update = UOPT_PPL; + else +- update = "no-ppl"; ++ update = UOPT_NO_PPL; + + sprintf(container_dev, "/dev/%s", st->container_devnm); + +@@ -3243,7 +3243,7 @@ static int reshape_array(char *container, int fd, char *devname, + * level and frozen, we can safely add them. + */ + if (devlist) { +- if (Manage_subdevs(devname, fd, devlist, verbose, 0, NULL, 0)) ++ if (Manage_subdevs(devname, fd, devlist, verbose, 0, UOPT_UNDEFINED, 0)) + goto release; + } + +diff --git a/Incremental.c b/Incremental.c +index 5a5f4c4c..ff3548c0 100644 +--- a/Incremental.c ++++ b/Incremental.c +@@ -1025,7 +1025,7 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol, + close(dfd); + *dfdp = -1; + rv = Manage_subdevs(chosen->sys_name, mdfd, &devlist, +- -1, 0, NULL, 0); ++ -1, 0, UOPT_UNDEFINED, 0); + close(mdfd); + } + if (verbose > 0) { +@@ -1666,7 +1666,7 @@ static void remove_from_member_array(struct mdstat_ent *memb, + + if (subfd >= 0) { + rv = Manage_subdevs(memb->devnm, subfd, devlist, verbose, +- 0, NULL, 0); ++ 0, UOPT_UNDEFINED, 0); + if (rv & 2) { + if (sysfs_init(&mmdi, -1, memb->devnm)) + pr_err("unable to initialize sysfs for: %s\n", +@@ -1758,7 +1758,7 @@ int IncrementalRemove(char *devname, char *id_path, int verbose) + free_mdstat(mdstat); + } else { + rv |= Manage_subdevs(ent->devnm, mdfd, &devlist, +- verbose, 0, NULL, 0); ++ verbose, 0, UOPT_UNDEFINED, 0); + if (rv & 2) { + /* Failed due to EBUSY, try to stop the array. + * Give udisks a chance to unmount it first. +@@ -1770,7 +1770,7 @@ int IncrementalRemove(char *devname, char *id_path, int verbose) + + devlist.disposition = 'r'; + rv = Manage_subdevs(ent->devnm, mdfd, &devlist, +- verbose, 0, NULL, 0); ++ verbose, 0, UOPT_UNDEFINED, 0); + end: + close(mdfd); + free_mdstat(ent); +diff --git a/Manage.c b/Manage.c +index 87b8aa0c..594e3d2c 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -598,14 +598,12 @@ static void add_set(struct mddev_dev *dv, int fd, char set_char) + + int attempt_re_add(int fd, int tfd, struct mddev_dev *dv, + struct supertype *dev_st, struct supertype *tst, +- unsigned long rdev, +- char *update, char *devname, int verbose, +- mdu_array_info_t *array) ++ unsigned long rdev, enum update_opt update, ++ char *devname, int verbose, mdu_array_info_t *array) + { + struct mdinfo mdi; + int duuid[4]; + int ouuid[4]; +- enum update_opt update_enum = map_name(update_options, update); + + dev_st->ss->getinfo_super(dev_st, &mdi, NULL); + dev_st->ss->uuid_from_super(dev_st, ouuid); +@@ -683,7 +681,7 @@ int attempt_re_add(int fd, int tfd, struct mddev_dev *dv, + devname, verbose, 0, NULL); + if (update) + rv = dev_st->ss->update_super( +- dev_st, NULL, update_enum, ++ dev_st, NULL, update, + devname, verbose, 0, NULL); + if (rv == 0) + rv = dev_st->ss->store_super(dev_st, tfd); +@@ -715,8 +713,8 @@ skip_re_add: + int Manage_add(int fd, int tfd, struct mddev_dev *dv, + struct supertype *tst, mdu_array_info_t *array, + int force, int verbose, char *devname, +- char *update, unsigned long rdev, unsigned long long array_size, +- int raid_slot) ++ enum update_opt update, unsigned long rdev, ++ unsigned long long array_size, int raid_slot) + { + unsigned long long ldsize; + struct supertype *dev_st; +@@ -1332,7 +1330,7 @@ bool is_remove_safe(mdu_array_info_t *array, const int fd, char *devname, const + + int Manage_subdevs(char *devname, int fd, + struct mddev_dev *devlist, int verbose, int test, +- char *update, int force) ++ enum update_opt update, int force) + { + /* Do something to each dev. + * devmode can be +@@ -1727,12 +1725,13 @@ int autodetect(void) + return rv; + } + +-int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident *ident, int verbose) ++int Update_subarray(char *dev, char *subarray, enum update_opt update, ++ struct mddev_ident *ident, int verbose) + { + struct supertype supertype, *st = &supertype; + int fd, rv = 2; + struct mdinfo *info = NULL; +- enum update_opt update_enum = map_name(update_options, update); ++ char *update_verb = map_num(update_options, update); + + memset(st, 0, sizeof(*st)); + +@@ -1750,7 +1749,7 @@ int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident + if (is_subarray_active(subarray, st->devnm)) { + if (verbose >= 0) + pr_err("Subarray %s in %s is active, cannot update %s\n", +- subarray, dev, update); ++ subarray, dev, update_verb); + goto free_super; + } + +@@ -1759,23 +1758,23 @@ int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident + + info = st->ss->container_content(st, subarray); + +- if (strncmp(update, "ppl", 3) == 0 && !is_level456(info->array.level)) { ++ if (update == UOPT_PPL && !is_level456(info->array.level)) { + pr_err("RWH policy ppl is supported only for raid4, raid5 and raid6.\n"); + goto free_super; + } + +- rv = st->ss->update_subarray(st, subarray, update_enum, ident); ++ rv = st->ss->update_subarray(st, subarray, update, ident); + + if (rv) { + if (verbose >= 0) + pr_err("Failed to update %s of subarray-%s in %s\n", +- update, subarray, dev); ++ update_verb, subarray, dev); + } else if (st->update_tail) + flush_metadata_updates(st); + else + st->ss->sync_metadata(st); + +- if (rv == 0 && strcmp(update, "name") == 0 && verbose >= 0) ++ if (rv == 0 && update == UOPT_NAME && verbose >= 0) + pr_err("Updated subarray-%s name from %s, UUIDs may have changed\n", + subarray, dev); + +@@ -1816,10 +1815,10 @@ int move_spare(char *from_devname, char *to_devname, dev_t devid) + sprintf(devname, "%d:%d", major(devid), minor(devid)); + + devlist.disposition = 'r'; +- if (Manage_subdevs(from_devname, fd2, &devlist, -1, 0, NULL, 0) == 0) { ++ if (Manage_subdevs(from_devname, fd2, &devlist, -1, 0, UOPT_UNDEFINED, 0) == 0) { + devlist.disposition = 'a'; + if (Manage_subdevs(to_devname, fd1, &devlist, -1, 0, +- NULL, 0) == 0) { ++ UOPT_UNDEFINED, 0) == 0) { + /* make sure manager is aware of changes */ + ping_manager(to_devname); + ping_manager(from_devname); +@@ -1829,7 +1828,7 @@ int move_spare(char *from_devname, char *to_devname, dev_t devid) + } + else + Manage_subdevs(from_devname, fd2, &devlist, +- -1, 0, NULL, 0); ++ -1, 0, UOPT_UNDEFINED, 0); + } + close(fd1); + close(fd2); +diff --git a/mdadm.c b/mdadm.c +index f5f505fe..d06e2820 100644 +--- a/mdadm.c ++++ b/mdadm.c +@@ -1402,10 +1402,22 @@ int main(int argc, char *argv[]) + /* readonly, add/remove, readwrite, runstop */ + if (c.readonly > 0) + rv = Manage_ro(devlist->devname, mdfd, c.readonly); +- if (!rv && devs_found>1) +- rv = Manage_subdevs(devlist->devname, mdfd, +- devlist->next, c.verbose, c.test, +- c.update, c.force); ++ if (!rv && devs_found > 1) { ++ /* ++ * This is temporary and will be removed in next patches ++ * Null c.update will cause segfault ++ */ ++ if (c.update) ++ rv = Manage_subdevs(devlist->devname, mdfd, ++ devlist->next, c.verbose, c.test, ++ map_name(update_options, c.update), ++ c.force); ++ else ++ rv = Manage_subdevs(devlist->devname, mdfd, ++ devlist->next, c.verbose, c.test, ++ UOPT_UNDEFINED, ++ c.force); ++ } + if (!rv && c.readonly < 0) + rv = Manage_ro(devlist->devname, mdfd, c.readonly); + if (!rv && c.runstop > 0) +@@ -1931,7 +1943,8 @@ static int misc_list(struct mddev_dev *devlist, + continue; + } + rv |= Update_subarray(dv->devname, c->subarray, +- c->update, ident, c->verbose); ++ map_name(update_options, c->update), ++ ident, c->verbose); + continue; + case Dump: + rv |= Dump_metadata(dv->devname, dump_directory, c, ss); +diff --git a/mdadm.h b/mdadm.h +index 5dc94390..924f4b63 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -1478,7 +1478,7 @@ extern int Manage_stop(char *devname, int fd, int quiet, + int will_retry); + extern int Manage_subdevs(char *devname, int fd, + struct mddev_dev *devlist, int verbose, int test, +- char *update, int force); ++ enum update_opt update, int force); + extern int autodetect(void); + extern int Grow_Add_device(char *devname, int fd, char *newdev); + extern int Grow_addbitmap(char *devname, int fd, +@@ -1532,7 +1532,7 @@ extern int Monitor(struct mddev_dev *devlist, + + extern int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl); + extern int Kill_subarray(char *dev, char *subarray, int verbose); +-extern int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident *ident, int quiet); ++extern int Update_subarray(char *dev, char *subarray, enum update_opt update, struct mddev_ident *ident, int quiet); + extern int Wait(char *dev); + extern int WaitClean(char *dev, int verbose); + extern int SetAction(char *dev, char *action); +-- +2.38.1 + diff --git a/SOURCES/0076-Change-char-to-enum-in-context-update-refactor-code.patch b/SOURCES/0076-Change-char-to-enum-in-context-update-refactor-code.patch new file mode 100644 index 0000000..a18f8d1 --- /dev/null +++ b/SOURCES/0076-Change-char-to-enum-in-context-update-refactor-code.patch @@ -0,0 +1,289 @@ +From 3a87fa67112dc2c2c3664aeecd0b49cb4b6ceaa9 Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:35:24 +0100 +Subject: [PATCH 76/83] Change char* to enum in context->update & refactor code + +Storing update option in string is bad for frequent comparisons and +error prone. +Replace char array with enum so already existing enum is passed around +instead of string. +Adapt code to changes. + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + Assemble.c | 40 +++++++++++++++++----------------------- + mdadm.c | 52 +++++++++++++++++++--------------------------------- + mdadm.h | 2 +- + 3 files changed, 37 insertions(+), 57 deletions(-) + +diff --git a/Assemble.c b/Assemble.c +index dba910cd..49804941 100644 +--- a/Assemble.c ++++ b/Assemble.c +@@ -135,17 +135,17 @@ static int ident_matches(struct mddev_ident *ident, + struct mdinfo *content, + struct supertype *tst, + char *homehost, int require_homehost, +- char *update, char *devname) ++ enum update_opt update, char *devname) + { + +- if (ident->uuid_set && (!update || strcmp(update, "uuid")!= 0) && ++ if (ident->uuid_set && update != UOPT_UUID && + same_uuid(content->uuid, ident->uuid, tst->ss->swapuuid)==0 && + memcmp(content->uuid, uuid_zero, sizeof(int[4])) != 0) { + if (devname) + pr_err("%s has wrong uuid.\n", devname); + return 0; + } +- if (ident->name[0] && (!update || strcmp(update, "name")!= 0) && ++ if (ident->name[0] && update != UOPT_NAME && + name_matches(content->name, ident->name, homehost, require_homehost)==0) { + if (devname) + pr_err("%s has wrong name.\n", devname); +@@ -648,11 +648,10 @@ static int load_devices(struct devs *devices, char *devmap, + int err; + fstat(mdfd, &stb2); + +- if (strcmp(c->update, "uuid") == 0 && !ident->uuid_set) ++ if (c->update == UOPT_UUID && !ident->uuid_set) + random_uuid((__u8 *)ident->uuid); + +- if (strcmp(c->update, "ppl") == 0 && +- ident->bitmap_fd >= 0) { ++ if (c->update == UOPT_PPL && ident->bitmap_fd >= 0) { + pr_err("PPL is not compatible with bitmap\n"); + close(mdfd); + free(devices); +@@ -684,34 +683,30 @@ static int load_devices(struct devs *devices, char *devmap, + strcpy(content->name, ident->name); + content->array.md_minor = minor(stb2.st_rdev); + +- if (strcmp(c->update, "byteorder") == 0) ++ if (c->update == UOPT_BYTEORDER) + err = 0; +- else if (strcmp(c->update, "home-cluster") == 0) { ++ else if (c->update == UOPT_HOME_CLUSTER) { + tst->cluster_name = c->homecluster; + err = tst->ss->write_bitmap(tst, dfd, NameUpdate); +- } else if (strcmp(c->update, "nodes") == 0) { ++ } else if (c->update == UOPT_NODES) { + tst->nodes = c->nodes; + err = tst->ss->write_bitmap(tst, dfd, NodeNumUpdate); +- } else if (strcmp(c->update, "revert-reshape") == 0 && +- c->invalid_backup) ++ } else if (c->update == UOPT_REVERT_RESHAPE && c->invalid_backup) + err = tst->ss->update_super(tst, content, + UOPT_SPEC_REVERT_RESHAPE_NOBACKUP, + devname, c->verbose, + ident->uuid_set, + c->homehost); + else +- /* +- * Mapping is temporary, will be removed in this patchset +- */ + err = tst->ss->update_super(tst, content, +- map_name(update_options, c->update), ++ c->update, + devname, c->verbose, + ident->uuid_set, + c->homehost); + if (err < 0) { + if (err == -1) + pr_err("--update=%s not understood for %s metadata\n", +- c->update, tst->ss->name); ++ map_num(update_options, c->update), tst->ss->name); + tst->ss->free_super(tst); + free(tst); + close(mdfd); +@@ -721,7 +716,7 @@ static int load_devices(struct devs *devices, char *devmap, + *stp = st; + return -1; + } +- if (strcmp(c->update, "uuid")==0 && ++ if (c->update == UOPT_UUID && + !ident->uuid_set) { + ident->uuid_set = 1; + memcpy(ident->uuid, content->uuid, 16); +@@ -730,7 +725,7 @@ static int load_devices(struct devs *devices, char *devmap, + pr_err("Could not re-write superblock on %s.\n", + devname); + +- if (strcmp(c->update, "uuid")==0 && ++ if (c->update == UOPT_UUID && + ident->bitmap_fd >= 0 && !bitmap_done) { + if (bitmap_update_uuid(ident->bitmap_fd, + content->uuid, +@@ -1188,8 +1183,7 @@ static int start_array(int mdfd, + pr_err("%s: Need a backup file to complete reshape of this array.\n", + mddev); + pr_err("Please provided one with \"--backup-file=...\"\n"); +- if (c->update && +- strcmp(c->update, "revert-reshape") == 0) ++ if (c->update == UOPT_REVERT_RESHAPE) + pr_err("(Don't specify --update=revert-reshape again, that part succeeded.)\n"); + return 1; + } +@@ -1487,7 +1481,7 @@ try_again: + */ + if (map_lock(&map)) + pr_err("failed to get exclusive lock on mapfile - continue anyway...\n"); +- if (c->update && strcmp(c->update,"uuid") == 0) ++ if (c->update == UOPT_UUID) + mp = NULL; + else + mp = map_by_uuid(&map, content->uuid); +@@ -1634,7 +1628,7 @@ try_again: + goto out; + } + +- if (c->update && strcmp(c->update, "byteorder")==0) ++ if (c->update == UOPT_BYTEORDER) + st->minor_version = 90; + + st->ss->getinfo_super(st, content, NULL); +@@ -1902,7 +1896,7 @@ try_again: + /* First, fill in the map, so that udev can find our name + * as soon as we become active. + */ +- if (c->update && strcmp(c->update, "metadata")==0) { ++ if (c->update == UOPT_METADATA) { + content->array.major_version = 1; + content->array.minor_version = 0; + strcpy(content->text_version, "1.0"); +diff --git a/mdadm.c b/mdadm.c +index d06e2820..57e8e6fa 100644 +--- a/mdadm.c ++++ b/mdadm.c +@@ -724,13 +724,12 @@ int main(int argc, char *argv[]) + + case O(ASSEMBLE,'U'): /* update the superblock */ + case O(MISC,'U'): { +- enum update_opt updateopt = map_name(update_options, c.update); + enum update_opt print_mode = UOPT_HELP; + const char *error_addon = "update option"; + + if (c.update) { + pr_err("Can only update one aspect of superblock, both %s and %s given.\n", +- c.update, optarg); ++ map_num(update_options, c.update), optarg); + exit(2); + } + if (mode == MISC && !c.subarray) { +@@ -738,20 +737,20 @@ int main(int argc, char *argv[]) + exit(2); + } + +- c.update = optarg; ++ c.update = map_name(update_options, optarg); + + if (devmode == UpdateSubarray) { + print_mode = UOPT_SUBARRAY_ONLY; + error_addon = "update-subarray option"; + +- if (updateopt > UOPT_SUBARRAY_ONLY && updateopt < UOPT_HELP) +- updateopt = UOPT_UNDEFINED; ++ if (c.update > UOPT_SUBARRAY_ONLY && c.update < UOPT_HELP) ++ c.update = UOPT_UNDEFINED; + } + +- switch (updateopt) { ++ switch (c.update) { + case UOPT_UNDEFINED: + pr_err("'--update=%s' is invalid %s. ", +- c.update, error_addon); ++ optarg, error_addon); + outf = stderr; + case UOPT_HELP: + if (!outf) +@@ -776,14 +775,14 @@ int main(int argc, char *argv[]) + } + if (c.update) { + pr_err("Can only update one aspect of superblock, both %s and %s given.\n", +- c.update, optarg); ++ map_num(update_options, c.update), optarg); + exit(2); + } +- c.update = optarg; +- if (strcmp(c.update, "devicesize") != 0 && +- strcmp(c.update, "bbl") != 0 && +- strcmp(c.update, "force-no-bbl") != 0 && +- strcmp(c.update, "no-bbl") != 0) { ++ c.update = map_name(update_options, optarg); ++ if (c.update != UOPT_DEVICESIZE && ++ c.update != UOPT_BBL && ++ c.update != UOPT_NO_BBL && ++ c.update != UOPT_FORCE_NO_BBL) { + pr_err("only 'devicesize', 'bbl', 'no-bbl', and 'force-no-bbl' can be updated with --re-add\n"); + exit(2); + } +@@ -1357,7 +1356,7 @@ int main(int argc, char *argv[]) + } + } + +- if (c.update && strcmp(c.update, "nodes") == 0 && c.nodes == 0) { ++ if (c.update && c.update == UOPT_NODES && c.nodes == 0) { + pr_err("Please specify nodes number with --nodes\n"); + exit(1); + } +@@ -1402,22 +1401,10 @@ int main(int argc, char *argv[]) + /* readonly, add/remove, readwrite, runstop */ + if (c.readonly > 0) + rv = Manage_ro(devlist->devname, mdfd, c.readonly); +- if (!rv && devs_found > 1) { +- /* +- * This is temporary and will be removed in next patches +- * Null c.update will cause segfault +- */ +- if (c.update) +- rv = Manage_subdevs(devlist->devname, mdfd, +- devlist->next, c.verbose, c.test, +- map_name(update_options, c.update), +- c.force); +- else +- rv = Manage_subdevs(devlist->devname, mdfd, +- devlist->next, c.verbose, c.test, +- UOPT_UNDEFINED, +- c.force); +- } ++ if (!rv && devs_found > 1) ++ rv = Manage_subdevs(devlist->devname, mdfd, ++ devlist->next, c.verbose, ++ c.test, c.update, c.force); + if (!rv && c.readonly < 0) + rv = Manage_ro(devlist->devname, mdfd, c.readonly); + if (!rv && c.runstop > 0) +@@ -1937,14 +1924,13 @@ static int misc_list(struct mddev_dev *devlist, + rv |= Kill_subarray(dv->devname, c->subarray, c->verbose); + continue; + case UpdateSubarray: +- if (c->update == NULL) { ++ if (!c->update) { + pr_err("-U/--update must be specified with --update-subarray\n"); + rv |= 1; + continue; + } + rv |= Update_subarray(dv->devname, c->subarray, +- map_name(update_options, c->update), +- ident, c->verbose); ++ c->update, ident, c->verbose); + continue; + case Dump: + rv |= Dump_metadata(dv->devname, dump_directory, c, ss); +diff --git a/mdadm.h b/mdadm.h +index 924f4b63..13f8b4cb 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -616,7 +616,7 @@ struct context { + int export; + int test; + char *subarray; +- char *update; ++ enum update_opt update; + int scan; + int SparcAdjust; + int autof; +-- +2.38.1 + diff --git a/SOURCES/0077-mdmon-fix-segfault.patch b/SOURCES/0077-mdmon-fix-segfault.patch new file mode 100644 index 0000000..980ceda --- /dev/null +++ b/SOURCES/0077-mdmon-fix-segfault.patch @@ -0,0 +1,86 @@ +From 9b429fc0a4ffd7028b3b336589d38e32fb9045dc Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:46:21 +0100 +Subject: [PATCH 77/83] mdmon: fix segfault + +Mdmon crashes if stat2devnm returns null. +Use open_mddev to check if device is mddevice and get name using +fd2devnm. +Refactor container name handling. + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + Makefile | 2 +- + mdmon.c | 26 ++++++++++++-------------- + 2 files changed, 13 insertions(+), 15 deletions(-) + +diff --git a/Makefile b/Makefile +index ec1f99ed..5eac1a4e 100644 +--- a/Makefile ++++ b/Makefile +@@ -160,7 +160,7 @@ SRCS = $(patsubst %.o,%.c,$(OBJS)) + + INCL = mdadm.h part.h bitmap.h + +-MON_OBJS = mdmon.o monitor.o managemon.o uuid.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 config.o mapfile.o mdopen.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/mdmon.c b/mdmon.c +index e9d035eb..ecf52dc8 100644 +--- a/mdmon.c ++++ b/mdmon.c +@@ -363,14 +363,14 @@ int main(int argc, char *argv[]) + } + + if (all == 0 && container_name == NULL) { +- if (argv[optind]) +- container_name = argv[optind]; ++ if (argv[optind]) { ++ container_name = get_md_name(argv[optind]); ++ if (!container_name) ++ container_name = argv[optind]; ++ } + } + +- if (container_name == NULL) +- usage(); +- +- if (argc - optind > 1) ++ if (container_name == NULL || argc - optind > 1) + usage(); + + if (strcmp(container_name, "/proc/mdstat") == 0) +@@ -402,21 +402,19 @@ int main(int argc, char *argv[]) + free_mdstat(mdstat); + + return status; +- } else if (strncmp(container_name, "md", 2) == 0) { +- int id = devnm2devid(container_name); +- if (id) +- devnm = container_name; + } else { +- struct stat st; ++ int mdfd = open_mddev(container_name, 1); + +- if (stat(container_name, &st) == 0) +- devnm = xstrdup(stat2devnm(&st)); ++ if (mdfd < 0) ++ return 1; ++ devnm = fd2devnm(mdfd); ++ close(mdfd); + } + + if (!devnm) { + pr_err("%s is not a valid md device name\n", + container_name); +- exit(1); ++ return 1; + } + return mdmon(devnm, dofork && do_fork(), takeover); + } +-- +2.38.1 + diff --git a/SOURCES/0078-util-remove-obsolete-code-from-get_md_name.patch b/SOURCES/0078-util-remove-obsolete-code-from-get_md_name.patch new file mode 100644 index 0000000..b371d39 --- /dev/null +++ b/SOURCES/0078-util-remove-obsolete-code-from-get_md_name.patch @@ -0,0 +1,116 @@ +From b938519e7719c992dae2d61c796c45fe49e6b71b Mon Sep 17 00:00:00 2001 +From: Mateusz Kusiak +Date: Mon, 2 Jan 2023 09:46:22 +0100 +Subject: [PATCH 78/83] util: remove obsolete code from get_md_name + +get_md_name() is used only with mdstat entries. +Remove dead code and simplyfy function. + +Remove redundadnt checks from mdmon.c + +Signed-off-by: Mateusz Kusiak +Signed-off-by: Jes Sorensen +--- + mdmon.c | 8 +++----- + util.c | 51 +++++++++++++++++---------------------------------- + 2 files changed, 20 insertions(+), 39 deletions(-) + +diff --git a/mdmon.c b/mdmon.c +index ecf52dc8..60ba3182 100644 +--- a/mdmon.c ++++ b/mdmon.c +@@ -366,7 +366,7 @@ int main(int argc, char *argv[]) + if (argv[optind]) { + container_name = get_md_name(argv[optind]); + if (!container_name) +- container_name = argv[optind]; ++ return 1; + } + } + +@@ -403,11 +403,9 @@ int main(int argc, char *argv[]) + + return status; + } else { +- int mdfd = open_mddev(container_name, 1); +- +- if (mdfd < 0) +- return 1; ++ int mdfd = open_mddev(container_name, 0); + devnm = fd2devnm(mdfd); ++ + close(mdfd); + } + +diff --git a/util.c b/util.c +index 26ffdcea..9cd89fa4 100644 +--- a/util.c ++++ b/util.c +@@ -968,47 +968,30 @@ dev_t devnm2devid(char *devnm) + return 0; + } + ++/** ++ * get_md_name() - Get main dev node of the md device. ++ * @devnm: Md device name or path. ++ * ++ * Function checks if the full name was passed and returns md name ++ * if it is the MD device. ++ * ++ * Return: Main dev node of the md device or NULL if not found. ++ */ + char *get_md_name(char *devnm) + { +- /* find /dev/md%d or /dev/md/%d or make a device /dev/.tmp.md%d */ +- /* if dev < 0, want /dev/md/d%d or find mdp in /proc/devices ... */ +- +- static char devname[50]; ++ static char devname[NAME_MAX]; + struct stat stb; +- dev_t rdev = devnm2devid(devnm); +- char *dn; + +- if (rdev == 0) +- return 0; +- if (strncmp(devnm, "md_", 3) == 0) { +- snprintf(devname, sizeof(devname), "/dev/md/%s", +- devnm + 3); +- if (stat(devname, &stb) == 0 && +- (S_IFMT&stb.st_mode) == S_IFBLK && (stb.st_rdev == rdev)) +- return devname; +- } +- snprintf(devname, sizeof(devname), "/dev/%s", devnm); +- if (stat(devname, &stb) == 0 && (S_IFMT&stb.st_mode) == S_IFBLK && +- (stb.st_rdev == rdev)) +- return devname; ++ if (strncmp(devnm, "/dev/", 5) == 0) ++ snprintf(devname, sizeof(devname), "%s", devnm); ++ else ++ snprintf(devname, sizeof(devname), "/dev/%s", devnm); + +- snprintf(devname, sizeof(devname), "/dev/md/%s", devnm+2); +- if (stat(devname, &stb) == 0 && (S_IFMT&stb.st_mode) == S_IFBLK && +- (stb.st_rdev == rdev)) ++ if (!is_mddev(devname)) ++ return NULL; ++ if (stat(devname, &stb) == 0 && (S_IFMT&stb.st_mode) == S_IFBLK) + return devname; + +- dn = map_dev(major(rdev), minor(rdev), 0); +- if (dn) +- return dn; +- snprintf(devname, sizeof(devname), "/dev/.tmp.%s", devnm); +- if (mknod(devname, S_IFBLK | 0600, rdev) == -1) +- if (errno != EEXIST) +- return NULL; +- +- if (stat(devname, &stb) == 0 && (S_IFMT&stb.st_mode) == S_IFBLK && +- (stb.st_rdev == rdev)) +- return devname; +- unlink(devname); + return NULL; + } + +-- +2.38.1 + diff --git a/SOURCES/0079-mdadm-udev-Don-t-handle-change-event-on-raw-devices.patch b/SOURCES/0079-mdadm-udev-Don-t-handle-change-event-on-raw-devices.patch new file mode 100644 index 0000000..f888a09 --- /dev/null +++ b/SOURCES/0079-mdadm-udev-Don-t-handle-change-event-on-raw-devices.patch @@ -0,0 +1,54 @@ +From 24d329fc97a64ec185ef27e59730f3f058c09029 Mon Sep 17 00:00:00 2001 +From: Xiao Ni +Date: Thu, 5 Jan 2023 00:29:20 +0800 +Subject: [PATCH 79/83] mdadm/udev: Don't handle change event on raw devices + +The raw devices are ready when add event happpens and the raid +can be assembled. So there is no need to handle change events. +And it can cause some inconvenient problems. + +For example, the OS is installed on md0(/root) and md1(/home). +md0 and md1 are created on partitions. When it wants to re-install +OS, anaconda can't clear the storage configure. It deletes one +partition and does some jobs. The change event happens. Now +the raid device is assembled again. It can't delete the other +partitions. + +So in this patch, we don't handle change event on raw devices +anymore. + +Signed-off-by: Xiao Ni +Signed-off-by: Jes Sorensen +--- + udev-md-raid-assembly.rules | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/udev-md-raid-assembly.rules b/udev-md-raid-assembly.rules +index 39b4344b..d4a7f0a5 100644 +--- a/udev-md-raid-assembly.rules ++++ b/udev-md-raid-assembly.rules +@@ -11,6 +11,11 @@ SUBSYSTEM!="block", GOTO="md_inc_end" + ENV{SYSTEMD_READY}=="0", GOTO="md_inc_end" + + # handle potential components of arrays (the ones supported by md) ++# For member devices which are md/dm devices, we don't need to ++# handle add event. Because md/dm devices need to do some init jobs. ++# Then the change event happens. ++# When adding md/dm devices, ID_FS_TYPE can only be linux_raid_member ++# after change event happens. + ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="md_inc" + + # "noiswmd" on kernel command line stops mdadm from handling +@@ -28,6 +33,9 @@ GOTO="md_inc_end" + + LABEL="md_inc" + ++# Bare disks are ready when add event happens, the raid can be assembled. ++ACTION=="change", KERNEL!="dm-*|md*", GOTO="md_inc_end" ++ + # remember you can limit what gets auto/incrementally assembled by + # mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY' + ACTION!="remove", IMPORT{program}="BINDIR/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}" +-- +2.38.1 + diff --git a/SOURCES/0080-Manage-do-not-check-array-state-when-drive-is-remove.patch b/SOURCES/0080-Manage-do-not-check-array-state-when-drive-is-remove.patch new file mode 100644 index 0000000..e2c1179 --- /dev/null +++ b/SOURCES/0080-Manage-do-not-check-array-state-when-drive-is-remove.patch @@ -0,0 +1,33 @@ +From b3e7b7eb1dfedd7cbd9a3800e884941f67d94c96 Mon Sep 17 00:00:00 2001 +From: Kinga Tanska +Date: Tue, 27 Dec 2022 06:50:42 +0100 +Subject: [PATCH 80/83] Manage: do not check array state when drive is removed + +Array state doesn't need to be checked when drive is +removed, but until now clean state was required. Result +of the is_remove_safe() function will be independent +from array state. + +Signed-off-by: Kinga Tanska +Signed-off-by: Jes Sorensen +--- + Manage.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/Manage.c b/Manage.c +index 594e3d2c..4d6e54b1 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -1321,8 +1321,7 @@ bool is_remove_safe(mdu_array_info_t *array, const int fd, char *devname, const + sysfs_free(mdi); + + bool is_enough = enough(array->level, array->raid_disks, +- array->layout, (array->state & 1), +- avail); ++ array->layout, 1, avail); + + free(avail); + return is_enough; +-- +2.38.1 + diff --git a/SOURCES/0081-incremental-manage-do-not-verify-if-remove-is-safe.patch b/SOURCES/0081-incremental-manage-do-not-verify-if-remove-is-safe.patch new file mode 100644 index 0000000..4e0169c --- /dev/null +++ b/SOURCES/0081-incremental-manage-do-not-verify-if-remove-is-safe.patch @@ -0,0 +1,59 @@ +From 461fae7e7809670d286cc19aac5bfa861c29f93a Mon Sep 17 00:00:00 2001 +From: Kinga Tanska +Date: Tue, 27 Dec 2022 06:50:43 +0100 +Subject: [PATCH 81/83] incremental, manage: do not verify if remove is safe + +Function is_remove_safe() was introduced to verify if removing +member device won't cause failed state of the array. This +verification should be used only with set-faulty command. Add +special mode indicating that Incremental removal was executed. +If this mode is used do not execute is_remove_safe() routine. + +Signed-off-by: Kinga Tanska +Signed-off-by: Jes Sorensen +--- + Incremental.c | 2 +- + Manage.c | 7 ++++--- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/Incremental.c b/Incremental.c +index ff3548c0..09b94b9f 100644 +--- a/Incremental.c ++++ b/Incremental.c +@@ -1744,7 +1744,7 @@ int IncrementalRemove(char *devname, char *id_path, int verbose) + + memset(&devlist, 0, sizeof(devlist)); + devlist.devname = devname; +- devlist.disposition = 'f'; ++ devlist.disposition = 'I'; + /* for a container, we must fail each member array */ + if (ent->metadata_version && + strncmp(ent->metadata_version, "external:", 9) == 0) { +diff --git a/Manage.c b/Manage.c +index 4d6e54b1..6184d3f7 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -1494,8 +1494,9 @@ int Manage_subdevs(char *devname, int fd, + /* Assume this is a kernel-internal name like 'sda1' */ + int found = 0; + char dname[55]; +- if (dv->disposition != 'r' && dv->disposition != 'f') { +- pr_err("%s only meaningful with -r or -f, not -%c\n", ++ if (dv->disposition != 'r' && dv->disposition != 'f' && ++ dv->disposition != 'I') { ++ pr_err("%s only meaningful with -r, -f or -I, not -%c\n", + dv->devname, dv->disposition); + goto abort; + } +@@ -1647,7 +1648,7 @@ int Manage_subdevs(char *devname, int fd, + close(sysfd); + goto abort; + } +- ++ case 'I': /* incremental fail */ + if ((sysfd >= 0 && write(sysfd, "faulty", 6) != 6) || + (sysfd < 0 && ioctl(fd, SET_DISK_FAULTY, + rdev))) { +-- +2.38.1 + diff --git a/SOURCES/0082-super-intel-make-freesize-not-required-for-chunk-siz.patch b/SOURCES/0082-super-intel-make-freesize-not-required-for-chunk-siz.patch new file mode 100644 index 0000000..0035c89 --- /dev/null +++ b/SOURCES/0082-super-intel-make-freesize-not-required-for-chunk-siz.patch @@ -0,0 +1,52 @@ +From 071f839ea549e2a384cd13bba445245cd87e48b1 Mon Sep 17 00:00:00 2001 +From: Kinga Tanska +Date: Fri, 28 Oct 2022 04:51:17 +0200 +Subject: [PATCH 82/83] super-intel: make freesize not required for chunk size + migration + +Freesize is needed to be set for migrations where size of RAID could +be changed - expand. It tells how many free space is determined for +members. In chunk size migartion freesize is not needed to be set, +pointer shouldn't be checked if exists. This commit moves check to +condition which contains size calculations, instead of checking it +always at the first step. +Fix return value when superblock is not set. + +Signed-off-by: Kinga Tanska +Signed-off-by: Jes Sorensen +--- + super-intel.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/super-intel.c b/super-intel.c +index 1f5f6eda..89fac626 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -7719,11 +7719,11 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout, + struct intel_super *super = st->sb; + + /* +- * Autolayout mode, st->sb and freesize must be set. ++ * Autolayout mode, st->sb must be set. + */ +- if (!super || !freesize) { +- pr_vrb("freesize and superblock must be set for autolayout, aborting\n"); +- return 1; ++ if (!super) { ++ pr_vrb("superblock must be set for autolayout, aborting\n"); ++ return 0; + } + + if (!validate_geometry_imsm_orom(st->sb, level, layout, +@@ -7731,7 +7731,7 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout, + verbose)) + return 0; + +- if (super->orom) { ++ if (super->orom && freesize) { + imsm_status_t rv; + int count = count_volumes(super->hba, super->orom->dpa, + verbose); +-- +2.38.1 + diff --git a/SOURCES/0083-manage-move-comment-with-function-description.patch b/SOURCES/0083-manage-move-comment-with-function-description.patch new file mode 100644 index 0000000..091854f --- /dev/null +++ b/SOURCES/0083-manage-move-comment-with-function-description.patch @@ -0,0 +1,105 @@ +From 36a707824eb1dafbb990f5daf1cbbe0e37dbbefb Mon Sep 17 00:00:00 2001 +From: Kinga Tanska +Date: Thu, 5 Jan 2023 06:31:25 +0100 +Subject: [PATCH 83/83] manage: move comment with function description + +Move the function description from the function body to outside +to obey kernel coding style. + +Signed-off-by: Kinga Tanska +Acked-by: Coly Li +Signed-off-by: Jes Sorensen +--- + Manage.c | 72 ++++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 44 insertions(+), 28 deletions(-) + +diff --git a/Manage.c b/Manage.c +index 6184d3f7..fde6aba3 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -1327,38 +1327,54 @@ bool is_remove_safe(mdu_array_info_t *array, const int fd, char *devname, const + return is_enough; + } + ++/** ++ * Manage_subdevs() - Execute operation depending on devmode. ++ * ++ * @devname: name of the device. ++ * @fd: file descriptor. ++ * @devlist: list of sub-devices to manage. ++ * @verbose: verbose level. ++ * @test: test flag. ++ * @update: type of update. ++ * @force: force flag. ++ * ++ * This function executes operation defined by devmode ++ * for each dev from devlist. ++ * Devmode can be: ++ * 'a' - add the device ++ * 'S' - add the device as a spare - don't try re-add ++ * 'j' - add the device as a journal device ++ * 'A' - re-add the device ++ * 'r' - remove the device: HOT_REMOVE_DISK ++ * device can be 'faulty' or 'detached' in which case all ++ * matching devices are removed. ++ * 'f' - set the device faulty SET_DISK_FAULTY ++ * device can be 'detached' in which case any device that ++ * is inaccessible will be marked faulty. ++ * 'I' - remove device by using incremental fail ++ * which is executed when device is removed surprisingly. ++ * 'R' - mark this device as wanting replacement. ++ * 'W' - this device is added if necessary and activated as ++ * a replacement for a previous 'R' device. ++ * ----- ++ * 'w' - 'W' will be changed to 'w' when it is paired with ++ * a 'R' device. If a 'W' is found while walking the list ++ * it must be unpaired, and is an error. ++ * 'M' - this is created by a 'missing' target. It is a slight ++ * variant on 'A' ++ * 'F' - Another variant of 'A', where the device was faulty ++ * so must be removed from the array first. ++ * 'c' - confirm the device as found (for clustered environments) ++ * ++ * For 'f' and 'r', the device can also be a kernel-internal ++ * name such as 'sdb'. ++ * ++ * Return: 0 on success, otherwise 1 or 2. ++ */ + int Manage_subdevs(char *devname, int fd, + struct mddev_dev *devlist, int verbose, int test, + enum update_opt update, int force) + { +- /* Do something to each dev. +- * devmode can be +- * 'a' - add the device +- * 'S' - add the device as a spare - don't try re-add +- * 'j' - add the device as a journal device +- * 'A' - re-add the device +- * 'r' - remove the device: HOT_REMOVE_DISK +- * device can be 'faulty' or 'detached' in which case all +- * matching devices are removed. +- * 'f' - set the device faulty SET_DISK_FAULTY +- * device can be 'detached' in which case any device that +- * is inaccessible will be marked faulty. +- * 'R' - mark this device as wanting replacement. +- * 'W' - this device is added if necessary and activated as +- * a replacement for a previous 'R' device. +- * ----- +- * 'w' - 'W' will be changed to 'w' when it is paired with +- * a 'R' device. If a 'W' is found while walking the list +- * it must be unpaired, and is an error. +- * 'M' - this is created by a 'missing' target. It is a slight +- * variant on 'A' +- * 'F' - Another variant of 'A', where the device was faulty +- * so must be removed from the array first. +- * 'c' - confirm the device as found (for clustered environments) +- * +- * For 'f' and 'r', the device can also be a kernel-internal +- * name such as 'sdb'. +- */ + mdu_array_info_t array; + unsigned long long array_size; + struct mddev_dev *dv; +-- +2.38.1 + diff --git a/SOURCES/mdadm-3.3-udev.patch b/SOURCES/mdadm-3.3-udev.patch deleted file mode 100644 index 3e22ad1..0000000 --- a/SOURCES/mdadm-3.3-udev.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- mdadm/udev-md-raid-assembly.rules~ 2018-07-09 18:24:27.450774446 +0800 -+++ mdadm/udev-md-raid-assembly.rules 2018-07-09 18:25:12.630735637 +0800 -@@ -5,6 +5,10 @@ - ENV{ANACONDA}=="?*", GOTO="md_inc_end" - # assemble md arrays - -+# In Fedora we handle the raid components in 65-md-incremental.rules so that -+# we can do things like honor anaconda command line options and such -+GOTO="md_inc_end" -+ - SUBSYSTEM!="block", GOTO="md_inc_end" - - # skip non-initialized devices diff --git a/SOURCES/mdadm-udev.patch b/SOURCES/mdadm-udev.patch new file mode 100644 index 0000000..a9d4d93 --- /dev/null +++ b/SOURCES/mdadm-udev.patch @@ -0,0 +1,26 @@ +--- mdadm/udev-md-raid-assembly.rules.orig 2023-01-06 16:37:03.780756100 +0800 ++++ mdadm/udev-md-raid-assembly.rules 2023-01-06 17:04:09.536159980 +0800 +@@ -5,6 +5,9 @@ + ENV{ANACONDA}=="?*", GOTO="md_inc_end" + # assemble md arrays + ++# Also don't process disks that are slated to be a multipath device ++ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_inc_end" ++ + SUBSYSTEM!="block", GOTO="md_inc_end" + + # skip non-initialized devices +@@ -33,6 +36,13 @@ + + LABEL="md_inc" + ++# Make sure we don't handle dm devices when some limits are set. ++# And linux_raid_member only be set when change/remove event happen. ++# So we don't need to consider add event here. ++KERNEL=="dm-*", ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="md_inc_end" ++KERNEL=="dm-*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="md_inc_end" ++KERNEL=="dm-*", ENV{DM_SUSPENDED}=="1", GOTO="md_inc_end" ++ + # Bare disks are ready when add event happens, the raid can be assembled. + ACTION=="change", KERNEL!="dm-*|md*", GOTO="md_inc_end" + diff --git a/SOURCES/mdadm.rules b/SOURCES/mdadm.rules deleted file mode 100644 index 74646b3..0000000 --- a/SOURCES/mdadm.rules +++ /dev/null @@ -1,69 +0,0 @@ -# This file causes block devices with Linux RAID (mdadm) signatures to -# automatically cause mdadm to be run. -# See udev(8) for syntax - -# Don't process any events if anaconda is running as anaconda brings up -# raid devices manually -ENV{ANACONDA}=="?*", GOTO="md_end" - -# Also don't process disks that are slated to be a multipath device -ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end" - -# We process add events on block devices (since they are ready as soon as -# they are added to the system), but we must process change events as well -# on any dm devices (like LUKS partitions or LVM logical volumes) and on -# md devices because both of these first get added, then get brought live -# and trigger a change event. The reason we don't process change events -# on bare hard disks is because if you stop all arrays on a disk, then -# run fdisk on the disk to change the partitions, when fdisk exits it -# triggers a change event, and we want to wait until all the fdisks on -# all member disks are done before we do anything. Unfortunately, we have -# no way of knowing that, so we just have to let those arrays be brought -# up manually after fdisk has been run on all of the disks. - -# First, process all add events (md and dm devices will not really do -# anything here, just regular disks, and this also won't get any imsm -# array members either) -SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \ - IMPORT{program}="/sbin/mdadm -I $env{DEVNAME} --export $devnode --offroot $${DEVLINKS}" -SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \ - ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer" -SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \ - ENV{ID_FS_TYPE}=="linux_raid_member", \ - RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}" -SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \ - ENV{ID_FS_TYPE}=="linux_raid_member", \ - RUN+="/sbin/mdadm -If $name" - -# Next, check to make sure the BIOS raid stuff wasn't turned off via cmdline -IMPORT{cmdline}="noiswmd" -IMPORT{cmdline}="nodmraid" -ENV{noiswmd}=="?*", GOTO="md_imsm_inc_end" -ENV{nodmraid}=="?*", GOTO="md_imsm_inc_end" -SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="isw_raid_member", \ - RUN+="/sbin/mdadm -I $env{DEVNAME}" -SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="ddf_raid_member", \ - RUN+="/sbin/mdadm -I $env{DEVNAME}" -SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \ - ENV{ID_FS_TYPE}=="isw_raid_member", \ - RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}" -SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \ - ENV{ID_FS_TYPE}=="isw_raid_member", \ - RUN+="/sbin/mdadm -If $name" -LABEL="md_imsm_inc_end" - -# Next make sure that this isn't a dm device we should skip for some reason -ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_change_end" -ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_change_end" -ENV{DM_SUSPENDED}=="1", GOTO="dm_change_end" -KERNEL=="dm-*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \ - ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}" -LABEL="dm_change_end" - -# Finally catch any nested md raid arrays. If we brought up an md raid -# array that's part of another md raid array, it won't be ready to be used -# until the change event that occurs when it becomes live -KERNEL=="md*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \ - ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}" - -LABEL="md_end" diff --git a/SPECS/mdadm.spec b/SPECS/mdadm.spec index a4f2c7e..42294e1 100644 --- a/SPECS/mdadm.spec +++ b/SPECS/mdadm.spec @@ -1,7 +1,7 @@ Name: mdadm Version: 4.2 # extraversion is used to define rhel internal version -%define extraversion 6 +%define extraversion 8 Release: %{extraversion}%{?dist} Summary: The mdadm program controls Linux md devices (software RAID arrays) URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ @@ -9,71 +9,103 @@ License: GPLv2+ Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}%{?subversion:-%{subversion}}.tar.xz Source1: raid-check -Source2: mdadm.rules -Source3: mdadm-raid-check-sysconfig -Source4: mdmonitor.service -Source5: mdadm.conf -Source6: mdadm_event.conf -Source7: raid-check.timer -Source8: raid-check.service - -# Build without -Werror. -Patch00: disable-Werror.patch -Patch01: 0001-Unify-error-message.patch -Patch02: 0002-mdadm-Fix-double-free.patch -Patch03: 0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch -Patch04: 0004-udev-adapt-rules-to-systemd-v247.patch -Patch05: 0005-Replace-error-prone-signal-with-sigaction.patch -Patch06: 0006-mdadm-Respect-config-file-location-in-man.patch -Patch07: 0007-mdadm-Update-ReadMe.patch -Patch08: 0008-mdadm-Update-config-man-regarding-default-files-and-.patch -Patch09: 0009-mdadm-Update-config-manual.patch -Patch10: 0010-Create-Build-use-default_layout.patch -Patch11: 0011-mdadm-add-map_num_s.patch -Patch12: 0013-mdmon-Stop-parsing-duplicate-options.patch -Patch13: 0014-Grow-block-n-on-external-volumes.patch -Patch14: 0015-Incremental-Fix-possible-memory-and-resource-leaks.patch -Patch15: 0016-Mdmonitor-Fix-segfault.patch -Patch16: 0017-Mdmonitor-Improve-logging-method.patch -Patch17: 0018-Fix-possible-NULL-ptr-dereferences-and-memory-leaks.patch -Patch18: 0019-imsm-Remove-possibility-for-get_imsm_dev-to-return-N.patch -Patch19: 0020-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch -Patch20: 0021-util-replace-ioctl-use-with-function.patch -Patch21: 0022-mdadm-super1-restore-commit-45a87c2f31335-to-fix-clu.patch -Patch22: 0023-imsm-introduce-get_disk_slot_in_dev.patch -Patch23: 0024-imsm-use-same-slot-across-container.patch -Patch24: 0025-imsm-block-changing-slots-during-creation.patch -Patch25: 0026-mdadm-block-update-ppl-for-non-raid456-levels.patch -Patch26: 0027-mdadm-Fix-array-size-mismatch-after-grow.patch -Patch27: 0028-mdadm-Remove-dead-code-in-imsm_fix_size_mismatch.patch -Patch28: 0029-Monitor-use-devname-as-char-array-instead-of-pointer.patch -Patch29: 0030-Monitor-use-snprintf-to-fill-device-name.patch -Patch30: 0031-Makefile-Don-t-build-static-build-with-everything-an.patch -Patch31: 0032-DDF-Cleanup-validate_geometry_ddf_container.patch -Patch32: 0033-DDF-Fix-NULL-pointer-dereference-in-validate_geometr.patch -Patch33: 0034-mdadm-Grow-Fix-use-after-close-bug-by-closing-after-.patch -Patch34: 0035-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch -Patch35: 0036-mdadm-Fix-mdadm-r-remove-option-regression.patch -Patch36: 0037-mdadm-Fix-optional-write-behind-parameter.patch -Patch37: 0038-tests-00raid0-add-a-test-that-validates-raid0-with-l.patch -Patch38: 0039-tests-fix-raid0-tests-for-0.90-metadata.patch -Patch39: 0040-tests-04update-metadata-avoid-passing-chunk-size-to-.patch -Patch40: 0041-tests-02lineargrow-clear-the-superblock-at-every-ite.patch -Patch41: 0042-mdadm-test-Add-a-mode-to-repeat-specified-tests.patch -Patch42: 0043-mdadm-test-Mark-and-ignore-broken-test-failures.patch -Patch43: 0044-tests-Add-broken-files-for-all-broken-tests.patch -Patch44: 0045-mdadm-Replace-obsolete-usleep-with-nanosleep.patch -Patch45: 0046-tests-00readonly-Run-udevadm-settle-before-setting-r.patch -Patch46: 0047-tests-add-test-for-names.patch -Patch47: 0048-mdadm-remove-symlink-option.patch -Patch48: 0049-mdadm-move-data_offset-to-struct-shape.patch -Patch49: 0050-mdadm-Don-t-open-md-device-for-CREATE-and-ASSEMBLE.patch -Patch50: 0051-Grow-Split-Grow_reshape-into-helper-function.patch -Patch51: 0052-Assemble-check-if-device-is-container-before-schedul.patch +Source2: mdadm-raid-check-sysconfig +Source3: mdmonitor.service +Source4: mdadm.conf +Source5: mdadm_event.conf +Source6: raid-check.timer +Source7: raid-check.service + +Patch000: 0001-Unify-error-message.patch +Patch001: 0002-mdadm-Fix-double-free.patch +Patch002: 0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch +Patch003: 0004-udev-adapt-rules-to-systemd-v247.patch +Patch004: 0005-Replace-error-prone-signal-with-sigaction.patch +Patch005: 0006-mdadm-Respect-config-file-location-in-man.patch +Patch006: 0007-mdadm-Update-ReadMe.patch +Patch007: 0008-mdadm-Update-config-man-regarding-default-files-and-.patch +Patch008: 0009-mdadm-Update-config-manual.patch +Patch009: 0010-Create-Build-use-default_layout.patch +Patch010: 0011-mdadm-add-map_num_s.patch +# patch0012 is deleted because of needing KillMode=none +Patch011: 0013-mdmon-Stop-parsing-duplicate-options.patch +Patch012: 0014-Grow-block-n-on-external-volumes.patch +Patch013: 0015-Incremental-Fix-possible-memory-and-resource-leaks.patch +Patch014: 0016-Mdmonitor-Fix-segfault.patch +Patch015: 0017-Mdmonitor-Improve-logging-method.patch +Patch016: 0018-Fix-possible-NULL-ptr-dereferences-and-memory-leaks.patch +Patch017: 0019-imsm-Remove-possibility-for-get_imsm_dev-to-return-N.patch +Patch018: 0020-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch +Patch019: 0021-util-replace-ioctl-use-with-function.patch +Patch020: 0022-mdadm-super1-restore-commit-45a87c2f31335-to-fix-clu.patch +Patch021: 0023-imsm-introduce-get_disk_slot_in_dev.patch +Patch022: 0024-imsm-use-same-slot-across-container.patch +Patch023: 0025-imsm-block-changing-slots-during-creation.patch +Patch024: 0026-mdadm-block-update-ppl-for-non-raid456-levels.patch +Patch025: 0027-mdadm-Fix-array-size-mismatch-after-grow.patch +Patch026: 0028-mdadm-Remove-dead-code-in-imsm_fix_size_mismatch.patch +Patch027: 0029-Monitor-use-devname-as-char-array-instead-of-pointer.patch +Patch028: 0030-Monitor-use-snprintf-to-fill-device-name.patch +Patch029: 0031-Makefile-Don-t-build-static-build-with-everything-an.patch +Patch030: 0032-DDF-Cleanup-validate_geometry_ddf_container.patch +Patch031: 0033-DDF-Fix-NULL-pointer-dereference-in-validate_geometr.patch +Patch032: 0034-mdadm-Grow-Fix-use-after-close-bug-by-closing-after-.patch +Patch033: 0035-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch +Patch034: 0036-mdadm-Fix-mdadm-r-remove-option-regression.patch +Patch035: 0037-mdadm-Fix-optional-write-behind-parameter.patch +Patch036: 0038-tests-00raid0-add-a-test-that-validates-raid0-with-l.patch +Patch037: 0039-tests-fix-raid0-tests-for-0.90-metadata.patch +Patch038: 0040-tests-04update-metadata-avoid-passing-chunk-size-to-.patch +Patch039: 0041-tests-02lineargrow-clear-the-superblock-at-every-ite.patch +Patch040: 0042-mdadm-test-Add-a-mode-to-repeat-specified-tests.patch +Patch041: 0043-mdadm-test-Mark-and-ignore-broken-test-failures.patch +Patch042: 0044-tests-Add-broken-files-for-all-broken-tests.patch +Patch043: 0045-mdadm-Replace-obsolete-usleep-with-nanosleep.patch +Patch044: 0046-tests-00readonly-Run-udevadm-settle-before-setting-r.patch +Patch045: 0047-tests-add-test-for-names.patch +Patch046: 0048-mdadm-remove-symlink-option.patch +Patch047: 0049-mdadm-move-data_offset-to-struct-shape.patch +Patch048: 0050-mdadm-Don-t-open-md-device-for-CREATE-and-ASSEMBLE.patch +Patch049: 0051-Grow-Split-Grow_reshape-into-helper-function.patch +Patch050: 0052-Assemble-check-if-device-is-container-before-schedul.patch +Patch051: 0053-super1-report-truncated-device.patch +Patch052: 0054-mdadm-Correct-typos-punctuation-and-grammar-in-man.patch +Patch053: 0055-Manage-Block-unsafe-member-failing.patch +Patch054: 0056-Monitor-Fix-statelist-memory-leaks.patch +Patch055: 0057-mdadm-added-support-for-Intel-Alderlake-RST-on-VMD-p.patch +Patch056: 0058-mdadm-Add-Documentation-entries-to-systemd-services.patch +Patch057: 0059-ReadMe-fix-command-line-help.patch +Patch058: 0060-mdadm-replace-container-level-checking-with-inline.patch +Patch059: 0061-Mdmonitor-Omit-non-md-devices.patch +Patch060: 0062-Mdmonitor-Split-alert-into-separate-functions.patch +Patch061: 0063-Monitor-block-if-monitor-modes-are-combined.patch +Patch062: 0064-Update-mdadm-Monitor-manual.patch +Patch063: 0065-Grow-fix-possible-memory-leak.patch +Patch064: 0066-mdadm-create-ident_init.patch +Patch065: 0067-mdadm-Add-option-validation-for-update-subarray.patch +Patch066: 0068-Fix-update-subarray-on-active-volume.patch +Patch067: 0069-Add-code-specific-update-options-to-enum.patch +Patch068: 0070-super-ddf-Remove-update_super_ddf.patch +Patch069: 0071-super0-refactor-the-code-for-enum.patch +Patch070: 0072-super1-refactor-the-code-for-enum.patch +Patch071: 0073-super-intel-refactor-the-code-for-enum.patch +Patch072: 0074-Change-update-to-enum-in-update_super-and-update_sub.patch +Patch073: 0075-Manage-Incremental-code-refactor-string-to-enum.patch +Patch074: 0076-Change-char-to-enum-in-context-update-refactor-code.patch +Patch075: 0077-mdmon-fix-segfault.patch +Patch076: 0078-util-remove-obsolete-code-from-get_md_name.patch +Patch077: 0079-mdadm-udev-Don-t-handle-change-event-on-raw-devices.patch +Patch078: 0080-Manage-do-not-check-array-state-when-drive-is-remove.patch +Patch079: 0081-incremental-manage-do-not-verify-if-remove-is-safe.patch +Patch080: 0082-super-intel-make-freesize-not-required-for-chunk-siz.patch +Patch081: 0083-manage-move-comment-with-function-description.patch # Fedora customization patches -Patch97: mdadm-3.3-udev.patch -Patch98: mdadm-2.5.2-static.patch + +Patch200: mdadm-udev.patch +Patch201: mdadm-2.5.2-static.patch +# Build without -Werror. +Patch202: disable-Werror.patch BuildRequires: make BuildRequires: systemd-rpm-macros binutils-devel gcc systemd-devel @@ -99,25 +131,24 @@ make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR %install make DESTDIR=%{buildroot} MANDIR=%{_mandir} BINDIR=%{_sbindir} SYSTEMD_DIR=%{_unitdir} UDEVDIR=/usr/lib/udev/ install install-systemd install -Dp -m 755 %{SOURCE1} %{buildroot}%{_sbindir}/raid-check -install -Dp -m 644 %{SOURCE2} %{buildroot}%{_udevrulesdir}/65-md-incremental.rules -install -Dp -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/raid-check +install -Dp -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/raid-check mkdir -p -m 710 %{buildroot}/run/mdadm # systemd mkdir -p %{buildroot}%{_unitdir} -install -m644 %{SOURCE4} %{buildroot}%{_unitdir} +install -m644 %{SOURCE3} %{buildroot}%{_unitdir} +install -m644 %{SOURCE6} %{buildroot}%{_unitdir} install -m644 %{SOURCE7} %{buildroot}%{_unitdir} -install -m644 %{SOURCE8} %{buildroot}%{_unitdir} # tmpfile mkdir -p %{buildroot}%{_tmpfilesdir} -install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf +install -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf mkdir -p %{buildroot}%{_localstatedir}/run/ install -d -m 0710 %{buildroot}/run/%{name}/ # abrt mkdir -p %{buildroot}/etc/libreport/events.d -install -m644 %{SOURCE6} %{buildroot}/etc/libreport/events.d +install -m644 %{SOURCE5} %{buildroot}/etc/libreport/events.d %post %systemd_post mdmonitor.service raid-check.timer @@ -146,6 +177,14 @@ install -m644 %{SOURCE6} %{buildroot}/etc/libreport/events.d * Wed Mar 15 2023 MSVSphere Packaging Team - 4.2-6 - Rebuilt for MSVSphere 9.1. +* Fri Jan 6 2023 Xiao Ni - 4.2-8 +- Update to latest upstream +- Resolves rhbz#2127101, rhbz#2139789, rhbz#2149292, rhbz#2151209, rhbz#2148945 + +* Tue Nov 15 2022 Xiao Ni - 4.2-7 +- Update to latest upstream and keep udev rule close to upstream +- Resolves rhbz#2107147, rhbz#2129087, rhbz#2126428 + * Mon Sep 5 2022 Xiao Ni - 4.2-6 - Add ddf auto-assemble in mdadm udev rule - Resolves rhbz#2120690