On Fri, Mar 11, 2022 at 11:18:16PM +0800, Shiyang Ruan wrote: > Verify that dax-rmap works for both normal extent and shared extent. > > Signed-off-by: Shiyang Ruan <ruansy.fnst@xxxxxxxxxxx> > --- > tests/xfs/902 | 52 +++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/902.out | 9 ++++++++ > 2 files changed, 61 insertions(+) > create mode 100755 tests/xfs/902 > create mode 100644 tests/xfs/902.out > > diff --git a/tests/xfs/902 b/tests/xfs/902 > new file mode 100755 > index 00000000..291d34fd > --- /dev/null > +++ b/tests/xfs/902 > @@ -0,0 +1,52 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# > +# 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=4096 And I guess while I'm whinging about not embedding the page size in the C source code, the test script shouldn't be doing that either. blksz=$(get_page_size) --D > +_pwrite_byte 0x61 0 $((blksz * nr)) $testdir/testfile >> $seqres.full > +_pwrite_byte 0x62 0 $((blksz * nr)) $testdir/posionfile >> $seqres.full > +seq 0 2 $((nr - 1)) | while read i; do > + _reflink_range $testdir/testfile $((blksz * i)) \ > + $testdir/posionfile $((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/posionfile > + > +echo "Inject memory failure (2 pages)" > +# posion on reflinked page and not reflinked page > +$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/902.out b/tests/xfs/902.out > new file mode 100644 > index 00000000..3c055d54 > --- /dev/null > +++ b/tests/xfs/902.out > @@ -0,0 +1,9 @@ > +QA output created by 902 > +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 > > >