mdadm/SOURCES/0149-tests-add-a-regression-test-that-raid456-can-t-assem.patch

59 lines
1.6 KiB
Diff
Raw Normal View History

2024-05-22 10:44:49 +00:00
From 8d45abd0c317d3f4971b779b4f8d1e33b5490dac Mon Sep 17 00:00:00 2001
From: Yu Kuai <yukuai3@huawei.com>
Date: Mon, 29 May 2023 21:28:24 +0800
Subject: [PATCH 149/165] tests: add a regression test that raid456 can't
assemble again
This is a regression test for commit 0aecb06e2249 ("md/raid5: don't allow
replacement while reshape is in progress").
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
---
tests/25raid456-recovery-while-reshape | 33 ++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 tests/25raid456-recovery-while-reshape
diff --git a/tests/25raid456-recovery-while-reshape b/tests/25raid456-recovery-while-reshape
new file mode 100644
index 00000000..3f6251bf
--- /dev/null
+++ b/tests/25raid456-recovery-while-reshape
@@ -0,0 +1,33 @@
+devs="$dev0 $dev1 $dev2"
+
+set_up_test()
+{
+ mdadm -Cv -R -n 3 -l5 $md0 $devs --assume-clean --size=50M || die "create array failed"
+ mdadm -a $md0 $dev3 $dev4 || die "failed to bind new disk to array"
+ echo 1000 > /sys/block/md0/md/sync_speed_max
+}
+
+clean_up_test()
+{
+ mdadm -S $md0
+}
+
+trap 'clean_up_test' EXIT
+
+set_up_test || die "set up test failed"
+
+# trigger reshape
+mdadm --grow -l 6 $md0
+sleep 1
+
+# set up replacement
+echo frozen > /sys/block/md0/md/sync_action
+echo want_replacement > /sys/block/md0/md/rd0/state
+echo reshape > /sys/block/md0/md/sync_action
+sleep 1
+
+# reassemeble array
+mdadm -S $md0 || die "can't stop array"
+mdadm --assemble $md0 $devs $dev3 $dev4 || die "can't assemble array"
+
+exit 0
--
2.40.1