diff mbox series

[2/3] xfs: add memory failure test for dax&reflink mode

Message ID 20220311151816.2174870-3-ruansy.fnst@fujitsu.com (mailing list archive)
State New, archived
Headers show
Series xfs: add memory failure tests for dax mode | expand

Commit Message

Shiyang Ruan March 11, 2022, 3:18 p.m. UTC
Verify that the dax-rmap feature works.

Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
---
 tests/xfs/901     | 49 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/901.out |  9 +++++++++
 2 files changed, 58 insertions(+)
 create mode 100755 tests/xfs/901
 create mode 100644 tests/xfs/901.out

Comments

Darrick J. Wong April 27, 2022, 6:07 p.m. UTC | #1
On Fri, Mar 11, 2022 at 11:18:15PM +0800, Shiyang Ruan wrote:
> Verify that the dax-rmap feature works.
> 
> Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>

With the same 'posion' -> 'poison' fix applied,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  tests/xfs/901     | 49 +++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/901.out |  9 +++++++++
>  2 files changed, 58 insertions(+)
>  create mode 100755 tests/xfs/901
>  create mode 100644 tests/xfs/901.out
> 
> diff --git a/tests/xfs/901 b/tests/xfs/901
> new file mode 100755
> index 00000000..a94a0c06
> --- /dev/null
> +++ b/tests/xfs/901
> @@ -0,0 +1,49 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# FS QA Test No. 901
> +#
> +# Test memory failure mechanism when dax and reflink working together
> +#
> +. ./common/preamble
> +_begin_fstest auto quick clone dax
> +
> +# Import common functions.
> +. ./common/filter
> +. ./common/reflink
> +
> +# real QA test starts here
> +_require_check_dmesg
> +_require_scratch_reflink
> +_require_cp_reflink
> +_require_xfs_scratch_rmapbt
> +_require_scratch_dax_mountopt "dax"
> +_require_test_program "t_mmap_cow_memory_failure"
> +
> +echo "Format and mount"
> +_scratch_mkfs > $seqres.full 2>&1
> +_scratch_mount "-o dax" >> $seqres.full 2>&1
> +
> +testdir=$SCRATCH_MNT/test-$seq
> +mkdir $testdir
> +
> +echo "Create the original files"
> +filesize=65536
> +_pwrite_byte 0x61 0 $filesize $testdir/testfile >> $seqres.full
> +_cp_reflink $testdir/testfile $testdir/posionfile >> $seqres.full
> +_scratch_cycle_mount "dax"
> +
> +echo "Inject memory failure (1 page)"
> +# create two processes:
> +#  process1: mread 4k to cause page fault, and wait
> +#  process2: mread 4k to cause page fault, then inject posion on this 4k page
> +$here/src/t_mmap_cow_memory_failure -s1 -S1 -R $testdir/testfile -P $testdir/posionfile
> +
> +echo "Inject memory failure (2 pages)"
> +$here/src/t_mmap_cow_memory_failure -s2 -S2 -R $testdir/testfile -P $testdir/posionfile
> +
> +_check_dmesg_for "Sending SIGBUS to t_mmap_cow_memo" || echo "Memory failure didn't kill the process"
> +_check_dmesg_for "recovery action for dax page: Recovered" || echo "Failured page didn't recovered"
> +
> +# success, all done
> +status=0
> diff --git a/tests/xfs/901.out b/tests/xfs/901.out
> new file mode 100644
> index 00000000..92d64846
> --- /dev/null
> +++ b/tests/xfs/901.out
> @@ -0,0 +1,9 @@
> +QA output created by 901
> +Format and mount
> +Create the original files
> +Inject memory failure (1 page)
> +Inject posion...
> +Process is killed by signal: 7
> +Inject memory failure (2 pages)
> +Inject posion...
> +Process is killed by signal: 7
> -- 
> 2.35.1
> 
> 
>
diff mbox series

Patch

diff --git a/tests/xfs/901 b/tests/xfs/901
new file mode 100755
index 00000000..a94a0c06
--- /dev/null
+++ b/tests/xfs/901
@@ -0,0 +1,49 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# FS QA Test No. 901
+#
+# Test memory failure mechanism when dax and reflink working together
+#
+. ./common/preamble
+_begin_fstest auto quick clone dax
+
+# Import common functions.
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_require_check_dmesg
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_scratch_rmapbt
+_require_scratch_dax_mountopt "dax"
+_require_test_program "t_mmap_cow_memory_failure"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount "-o dax" >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+echo "Create the original files"
+filesize=65536
+_pwrite_byte 0x61 0 $filesize $testdir/testfile >> $seqres.full
+_cp_reflink $testdir/testfile $testdir/posionfile >> $seqres.full
+_scratch_cycle_mount "dax"
+
+echo "Inject memory failure (1 page)"
+# create two processes:
+#  process1: mread 4k to cause page fault, and wait
+#  process2: mread 4k to cause page fault, then inject posion on this 4k page
+$here/src/t_mmap_cow_memory_failure -s1 -S1 -R $testdir/testfile -P $testdir/posionfile
+
+echo "Inject memory failure (2 pages)"
+$here/src/t_mmap_cow_memory_failure -s2 -S2 -R $testdir/testfile -P $testdir/posionfile
+
+_check_dmesg_for "Sending SIGBUS to t_mmap_cow_memo" || echo "Memory failure didn't kill the process"
+_check_dmesg_for "recovery action for dax page: Recovered" || echo "Failured page didn't recovered"
+
+# success, all done
+status=0
diff --git a/tests/xfs/901.out b/tests/xfs/901.out
new file mode 100644
index 00000000..92d64846
--- /dev/null
+++ b/tests/xfs/901.out
@@ -0,0 +1,9 @@ 
+QA output created by 901
+Format and mount
+Create the original files
+Inject memory failure (1 page)
+Inject posion...
+Process is killed by signal: 7
+Inject memory failure (2 pages)
+Inject posion...
+Process is killed by signal: 7