Blame SOURCES/0017-mdadm-tests-add-one-test-case-for-failfast-of-raid1.patch

5eacff
From 76b906d2406cdf136f64de77e881eb2d180108d9 Mon Sep 17 00:00:00 2001
5eacff
From: Gioh Kim <gi-oh.kim@cloud.ionos.com>
5eacff
Date: Fri, 7 Dec 2018 14:30:09 +0100
5eacff
Subject: [RHEL7.7 PATCH 17/24] mdadm/tests: add one test case for failfast of
5eacff
 raid1
5eacff
5eacff
This creates raid1 device with the failfast option and check all
5eacff
slaves have the failfast flag. And it does assembling and growing
5eacff
the raid1 device and check the failfast works fine.
5eacff
5eacff
Signed-off-by: Gioh Kim <gi-oh.kim@cloud.ionos.com>
5eacff
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
5eacff
---
5eacff
 tests/05r1-failfast | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++
5eacff
 1 file changed, 74 insertions(+)
5eacff
 create mode 100644 tests/05r1-failfast
5eacff
5eacff
diff --git a/tests/05r1-failfast b/tests/05r1-failfast
5eacff
new file mode 100644
5eacff
index 0000000..823dd6f
5eacff
--- /dev/null
5eacff
+++ b/tests/05r1-failfast
5eacff
@@ -0,0 +1,74 @@
5eacff
+
5eacff
+# create a simple mirror and check failfast flag works
5eacff
+mdadm -CR $md0 -e1.2 --level=raid1 --failfast -n2 $dev0 $dev1
5eacff
+check raid1
5eacff
+if grep -v failfast /sys/block/md0/md/rd*/state > /dev/null
5eacff
+then
5eacff
+   die "failfast missing"
5eacff
+fi
5eacff
+
5eacff
+# Removing works with the failfast flag
5eacff
+mdadm $md0 -f $dev0
5eacff
+mdadm $md0 -r $dev0
5eacff
+if grep -v failfast /sys/block/md0/md/rd1/state > /dev/null
5eacff
+then
5eacff
+   die "failfast missing"
5eacff
+fi
5eacff
+
5eacff
+# Adding works with the failfast flag
5eacff
+mdadm $md0 -a --failfast $dev0
5eacff
+check wait
5eacff
+if grep -v failfast /sys/block/md0/md/rd0/state > /dev/null
5eacff
+then
5eacff
+   die "failfast missing"
5eacff
+fi
5eacff
+
5eacff
+mdadm -S $md0
5eacff
+
5eacff
+# Assembling works with the failfast flag
5eacff
+mdadm -A $md0 $dev0 $dev1
5eacff
+check raid1
5eacff
+if grep -v failfast /sys/block/md0/md/rd*/state > /dev/null
5eacff
+then
5eacff
+   die "failfast missing"
5eacff
+fi
5eacff
+
5eacff
+# Adding works with the nofailfast flag
5eacff
+mdadm $md0 -f $dev0
5eacff
+mdadm $md0 -r $dev0
5eacff
+mdadm $md0 -a --nofailfast $dev0
5eacff
+check wait
5eacff
+if grep failfast /sys/block/md0/md/rd0/state > /dev/null
5eacff
+then
5eacff
+   die "failfast should be missing"
5eacff
+fi
5eacff
+
5eacff
+# Assembling with one faulty slave works with the failfast flag
5eacff
+mdadm $md0 -f $dev0
5eacff
+mdadm $md0 -r $dev0
5eacff
+mdadm -S $md0
5eacff
+mdadm -A $md0 $dev0 $dev1
5eacff
+check raid1
5eacff
+mdadm -S $md0
5eacff
+
5eacff
+# Spare works with the failfast flag
5eacff
+mdadm -CR $md0 -e1.2 --level=raid1 --failfast -n2 $dev0 $dev1
5eacff
+check raid1
5eacff
+mdadm $md0 -a --failfast $dev2
5eacff
+check wait
5eacff
+check spares 1
5eacff
+if grep -v failfast /sys/block/md0/md/rd*/state > /dev/null
5eacff
+then
5eacff
+   die "failfast missing"
5eacff
+fi
5eacff
+
5eacff
+# Grow works with the failfast flag
5eacff
+mdadm -G $md0 --raid-devices=3
5eacff
+check wait
5eacff
+if grep -v failfast /sys/block/md0/md/rd*/state > /dev/null
5eacff
+then
5eacff
+   die "failfast missing"
5eacff
+fi
5eacff
+mdadm -S $md0
5eacff
+
5eacff
+exit 0
5eacff
-- 
5eacff
2.7.5
5eacff