mdadm: Fix testcase 06wrmostly
PATCH 1/3 mdadm: Fix testcase 06wrmostly
From: Mingli Yu <[email protected]>
Backport patch [1] to fix the failure of the 06wrmostly test.
Signed-off-by Mingli Yu <[email protected]>
--- ...-Fix-optional-write-behind-parameter.patch | 45 +++++++++++++++++++ meta/recipes-extended/mdadm/mdadm_4.2.bb | 1 + 2 files changed, 46 insertions(+) create mode 100644 meta/recipes-extended/mdadm/files/0001-mdadm-Fix-optional-write-behind-parameter.patch
meta/recipes-extended/mdadm/files/0001-mdadm-Fix-optional-write-behind-parameter.patch new file +45 -0
@@ -0,0 +1,45 @@ +From 41edf6f45895193f4a523cb0a08d639c9ff9ccc9 Mon Sep 17 00:00:00 2001 +From: Logan Gunthorpe <[email protected]> +Date: Wed, 22 Jun 2022 14:25:12 -0600 +Subject: [PATCH] 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: + + mdadm: Invalid value for maximum outstanding write-behind writes: (null). + Must be between 0 and 16383. + +To fix this, check if optarg is NULL before parising it, as the origial +code did. + +Upstream-Status: Backport [https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=41edf6f45895193f4a523cb0a08d639c9ff9ccc9] + +Fixes: 60815698c0ac ("Refactor parse_num and use it to parse optarg.") +Cc: Mateusz Grzonka <[email protected]> +Signed-off-by: Logan Gunthorpe <[email protected]> +Acked-by: Mariusz Tkaczyk <[email protected]> +Signed-off-by: Jes Sorensen <[email protected]> +Signed-off-by: Mingli Yu <[email protected]> +--- + mdadm.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/mdadm.c b/mdadm.c +index d0c5e6de..56722ed9 100644 +--- a/mdadm.c ++++ b/mdadm.c +@@ -1201,8 +1201,9 @@ int main(int argc, char *argv[]) + case O(BUILD, WriteBehind): + case O(CREATE, WriteBehind): + s.write_behind = DEFAULT_MAX_WRITE_BEHIND; +- if (parse_num(&s.write_behind, optarg) != 0 || +- s.write_behind < 0 || s.write_behind > 16383) { ++ if (optarg && ++ (parse_num(&s.write_behind, optarg) != 0 || ++ s.write_behind < 0 || s.write_behind > 16383)) { + pr_err("Invalid value for maximum outstanding write-behind writes: %s.\n\tMust be between 0 and 16383.\n", + optarg); + exit(2); +-- +2.25.1 +
meta/recipes-extended/mdadm/mdadm_4.2.bb +1 -0
@@ -26,6 +26,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \ file://0001-Makefile-install-mdcheck.patch \ file://0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch \ file://0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ + file://0001-mdadm-Fix-optional-write-behind-parameter.patch \ " SRC_URI[sha256sum] = "461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d"
Signature · 1 line
2.25.1
PATCH 2/3 mdadm: fix tests/02lineargrow
From: Mingli Yu <[email protected]>
Backport patch [1] to fix tests/02lineargrow.
Signed-off-by Mingli Yu <[email protected]>
--- ...ow-clear-the-superblock-at-every-ite.patch | 33 +++++++++++++++++++ meta/recipes-extended/mdadm/mdadm_4.2.bb | 1 + 2 files changed, 34 insertions(+) create mode 100644 meta/recipes-extended/mdadm/files/0001-tests-02lineargrow-clear-the-superblock-at-every-ite.patch
meta/recipes-extended/mdadm/files/0001-tests-02lineargrow-clear-the-superblock-at-every-ite.patch new file +33 -0
@@ -0,0 +1,33 @@ +From a2c832465fc75202e244327b2081231dfa974617 Mon Sep 17 00:00:00 2001 +From: Sudhakar Panneerselvam <[email protected]> +Date: Wed, 22 Jun 2022 14:25:16 -0600 +Subject: [PATCH] tests/02lineargrow: clear the superblock at every iteration + +This fixes 02lineargrow test as prior metadata causes --add operation +to misbehave. + +Upstream-Status: Backport [https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=a2c832465fc75202e244327b2081231dfa974617] + +Signed-off-by: Sudhakar Panneerselvam <[email protected]> +Signed-off-by: Himanshu Madhani <[email protected]> +Signed-off-by: Logan Gunthorpe <[email protected]> +Signed-off-by: Jes Sorensen <[email protected]> +Signed-off-by: Mingli Yu <[email protected]> +--- + tests/02lineargrow | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tests/02lineargrow b/tests/02lineargrow +index e05c219d..595bf9f2 100644 +--- a/tests/02lineargrow ++++ b/tests/02lineargrow +@@ -20,4 +20,6 @@ do + testdev $md0 3 $sz 1 + + mdadm -S $md0 ++ mdadm --zero /dev/loop2 ++ mdadm --zero /dev/loop3 + done +-- +2.25.1 +
meta/recipes-extended/mdadm/mdadm_4.2.bb +1 -0
@@ -27,6 +27,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \ file://0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch \ file://0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ file://0001-mdadm-Fix-optional-write-behind-parameter.patch \ + file://0001-tests-02lineargrow-clear-the-superblock-at-every-ite.patch \ " SRC_URI[sha256sum] = "461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d"
Signature · 1 line
2.25.1
PATCH 3/3 mdadm: Fix raid0 tests
In reply to [email protected]From: Mingli Yu <[email protected]>
Backport patches to fix raid0 tests:
tests/00raid0
tests/00readonly
tests/03r0assem
tests/04r0update
tests/04update-metadata
Signed-off-by Mingli Yu <[email protected]>
--- ...-Run-udevadm-settle-before-setting-r.patch | 39 +++++++ ...metadata-avoid-passing-chunk-size-to.patch | 41 +++++++ ...ts-fix-raid0-tests-for-0.90-metadata.patch | 102 ++++++++++++++++++ meta/recipes-extended/mdadm/mdadm_4.2.bb | 3 + 4 files changed, 185 insertions(+) create mode 100644 meta/recipes-extended/mdadm/files/0001-tests-00readonly-Run-udevadm-settle-before-setting-r.patch create mode 100644 meta/recipes-extended/mdadm/files/0001-tests-04update-metadata-avoid-passing-chunk-size-to.patch create mode 100644 meta/recipes-extended/mdadm/files/0001-tests-fix-raid0-tests-for-0.90-metadata.patch
meta/recipes-extended/mdadm/files/0001-tests-00readonly-Run-udevadm-settle-before-setting-r.patch new file +39 -0
@@ -0,0 +1,39 @@ +From 39b381252c32275079344d30de18b76fda4bba26 Mon Sep 17 00:00:00 2001 +From: Logan Gunthorpe <[email protected]> +Date: Wed, 27 Jul 2022 15:52:45 -0600 +Subject: [PATCH] tests/00readonly: Run udevadm settle before setting ro + +In some recent kernel versions, 00readonly fails with: + + mdadm: failed to set readonly for /dev/md0: Device or resource busy + ERROR: array is not read-only! + +This was traced down to a race condition with udev holding a reference +to the block device at the same time as trying to set it read only. + +To fix this, call udevadm settle before setting the array read only. + +Upstream-Status: Backport [https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=39b381252c32275079344d30de18b76fda4bba26] + +Signed-off-by: Logan Gunthorpe <[email protected]> +Signed-off-by: Jes Sorensen <[email protected]> +Signed-off-by: Mingli Yu <[email protected]> +--- + tests/00readonly | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/00readonly b/tests/00readonly +index 39202487..afe243b3 100644 +--- a/tests/00readonly ++++ b/tests/00readonly +@@ -12,6 +12,7 @@ do + $dev1 $dev2 $dev3 $dev4 --assume-clean + check nosync + check $level ++ udevadm settle + mdadm -ro $md0 + check readonly + state=$(cat /sys/block/md0/md/array_state) +-- +2.25.1 +
meta/recipes-extended/mdadm/files/0001-tests-04update-metadata-avoid-passing-chunk-size-to.patch new file +41 -0
41 lines not on this page · raw message
meta/recipes-extended/mdadm/files/0001-tests-fix-raid0-tests-for-0.90-metadata.patch new file +102 -0
102 lines not on this page · raw message
meta/recipes-extended/mdadm/mdadm_4.2.bb +3 -0
@@ -28,6 +28,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \ file://0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ file://0001-mdadm-Fix-optional-write-behind-parameter.patch \ file://0001-tests-02lineargrow-clear-the-superblock-at-every-ite.patch \ + file://0001-tests-fix-raid0-tests-for-0.90-metadata.patch \ + file://0001-tests-00readonly-Run-udevadm-settle-before-setting-r.patch \ + file://0001-tests-04update-metadata-avoid-passing-chunk-size-to.patch \ " SRC_URI[sha256sum] = "461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d"
Signature · 1 line
2.25.1