xfs: add memory failure tests for dax mode
v4 cover xfs: add memory failure tests for dax mode
This patchset is to verify whether memory failure mechanism still works with the fsdax-rmap feature. With this feature, fsdax and reflink can be used together[1]. So, we also test it for reflinked files in filesystem mounted with dax option.
[1] https://lore.kernel.org/linux-xfs/[email protected]/
Changes since v3:
1. Update the copyright
Changes since v2:
1. Fixed typo in .out files
Changes since v1:
1. Fixed typo
2. Use sysconf(_SC_PAGESIZE) as page size, instead of the fixed 4KiB
3. Use $(get_page_size) in testcase
4. Unify the style of comments => /* */
Shiyang Ruan (3):
xfs: add memory failure test for dax mode
xfs: add memory failure test for dax&reflink mode
xfs: add memory failure test for partly-reflinked&dax file
.gitignore | 1 + src/Makefile | 3 +- src/t_mmap_cow_memory_failure.c | 157 ++++++++++++++++++++++++++++++++ tests/xfs/900 | 50 ++++++++++ tests/xfs/900.out | 9 ++ tests/xfs/901 | 51 +++++++++++ tests/xfs/901.out | 9 ++ tests/xfs/902 | 54 +++++++++++ tests/xfs/902.out | 9 ++ 9 files changed, 342 insertions(+), 1 deletion(-) create mode 100644 src/t_mmap_cow_memory_failure.c create mode 100755 tests/xfs/900 create mode 100644 tests/xfs/900.out create mode 100755 tests/xfs/901 create mode 100644 tests/xfs/901.out create mode 100755 tests/xfs/902 create mode 100644 tests/xfs/902.out
Signature · 1 line
2.37.1
PATCH v4 1/3 xfs: add memory failure test for dax mode
Make sure memory failure mechanism works when filesystem is mounted with dax option.
--- .gitignore | 1 + src/Makefile | 3 +- src/t_mmap_cow_memory_failure.c | 157 ++++++++++++++++++++++++++++++++ tests/xfs/900 | 50 ++++++++++ tests/xfs/900.out | 9 ++ 5 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 src/t_mmap_cow_memory_failure.c create mode 100755 tests/xfs/900 create mode 100644 tests/xfs/900.out
.gitignore +1 -0
@@ -147,6 +147,7 @@ tags /src/t_holes /src/t_immutable /src/t_mmap_collision +/src/t_mmap_cow_memory_failure /src/t_mmap_cow_race /src/t_mmap_dio /src/t_mmap_fallocate
src/Makefile +2 -1
@@ -18,7 +18,8 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \ t_ext4_dax_journal_corruption t_ext4_dax_inline_corruption \ t_ofd_locks t_mmap_collision mmap-write-concurrent \ t_get_file_time t_create_short_dirs t_create_long_dirs t_enospc \ - t_mmap_writev_overlap checkpoint_journal mmap-rw-fault allocstale + t_mmap_writev_overlap checkpoint_journal mmap-rw-fault allocstale \ + t_mmap_cow_memory_failure LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \ preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \
src/t_mmap_cow_memory_failure.c new file +157 -0
157 lines not on this page · raw message
tests/xfs/900 new file +50 -0
50 lines not on this page · raw message
tests/xfs/900.out new file +9 -0
@@ -0,0 +1,9 @@ +QA output created by 900 +Format and mount +Create the original files +Inject memory failure (1 page) +Inject poison... +Process is killed by signal: 7 +Inject memory failure (2 pages) +Inject poison... +Process is killed by signal: 7
Signature · 1 line
2.37.1
PATCH v4 2/3 xfs: add memory failure test for dax&reflink mode
In reply to Shiyang RuanVerify that the dax-rmap feature works.
--- tests/xfs/901 | 51 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/901.out | 9 +++++++++ 2 files changed, 60 insertions(+) create mode 100755 tests/xfs/901 create mode 100644 tests/xfs/901.out
tests/xfs/901 new file +51 -0
@@ -0,0 +1,51 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Fujitsu Limited. All Rights Reserved. +# +# 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/poisonfile >> $seqres.full +_scratch_cycle_mount "dax" + +echo "Inject memory failure (1 page)" +# create two processes: +# process1: mread 1 page to cause page fault, and wait +# process2: mread 1 page to cause page fault, then inject poison on this page +$here/src/t_mmap_cow_memory_failure -s1 -S1 -R $testdir/testfile -P $testdir/poisonfile + +echo "Inject memory failure (2 pages)" +$here/src/t_mmap_cow_memory_failure -s2 -S2 -R $testdir/testfile -P $testdir/poisonfile + +_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 +exit
tests/xfs/901.out new file +9 -0
@@ -0,0 +1,9 @@ +QA output created by 901 +Format and mount +Create the original files +Inject memory failure (1 page) +Inject poison... +Process is killed by signal: 7 +Inject memory failure (2 pages) +Inject poison... +Process is killed by signal: 7
Signature · 1 line
2.37.1
PATCH v4 3/3 xfs: add memory failure test for partly-reflinked&dax file
In reply to Shiyang RuanVerify that dax-rmap works for both normal extent and shared extent.
--- tests/xfs/902 | 54 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/902.out | 9 ++++++++ 2 files changed, 63 insertions(+) create mode 100755 tests/xfs/902 create mode 100644 tests/xfs/902.out
tests/xfs/902 new file +54 -0
@@ -0,0 +1,54 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Fujitsu Limited. All Rights Reserved. +# +# FS QA Test No. 902 +# +# Test memory failure mechanism when dax and reflink working together +# test for partly reflinked file +# +. ./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_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" +nr=16 +blksz=$(get_page_size) +_pwrite_byte 0x61 0 $((blksz * nr)) $testdir/testfile >> $seqres.full +_pwrite_byte 0x62 0 $((blksz * nr)) $testdir/poisonfile >> $seqres.full +seq 0 2 $((nr - 1)) | while read i; do + _reflink_range $testdir/testfile $((blksz * i)) \ + $testdir/poisonfile $((blksz * i)) $blksz >> $seqres.full +done +_scratch_cycle_mount "dax" + +echo "Inject memory failure (1 page)" +$here/src/t_mmap_cow_memory_failure -s1 -S1 -R $testdir/testfile -P $testdir/poisonfile + +echo "Inject memory failure (2 pages)" +# poison on reflinked page and not reflinked page +$here/src/t_mmap_cow_memory_failure -s2 -S2 -R $testdir/testfile -P $testdir/poisonfile + +_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 +exit
tests/xfs/902.out new file +9 -0
@@ -0,0 +1,9 @@ +QA output created by 902 +Format and mount +Create the original files +Inject memory failure (1 page) +Inject poison... +Process is killed by signal: 7 +Inject memory failure (2 pages) +Inject poison... +Process is killed by signal: 7
Signature · 1 line
2.37.1