Files
apfstests/tests/generic/503
T
Ross Zwisler d2f9bf265f generic: test DAX DMA vs truncate/hole-punch
This adds a regression test for the following series:

[PATCH v4 0/2] ext4: fix DAX dma vs truncate/hole-punch
https://lists.01.org/pipermail/linux-nvdimm/2018-July/016842.html

which adds synchronization between DAX DMA in ext4 and truncate/hole-punch.
The intention of the test is to test those specific changes, but it runs
fine both with XFS and without DAX so I've put it in the generic tests
instead of ext4 and not restricted it to only DAX configurations.

When run with v4.18-rc6 + DAX + ext4, this test will hit the following
WARN_ON_ONCE() in dax_disassociate_entry():

	WARN_ON_ONCE(trunc && page_ref_count(page) > 1);

If you change this to a WARN_ON() instead, you can see that each of the
four paths being exercised in this test hits that condition many times in
the one second that the subtest is being run.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-07-29 13:43:57 +08:00

65 lines
1.8 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2018 Intel Corporation. All Rights Reserved.
#
# FS QA Test No. 503
#
# This is a regression test for kernel patch:
# ext4: handle layout changes to pinned DAX mapping
#
# This test exercises each of the DAX paths in ext4 which remove blocks from
# an inode's block map. This includes things like hole punch, truncate down,
# etc. This test was written to regression test errors seen with an ext4 +
# DAX setup, but the test runs fine with or without DAX and with XFS so we
# don't require the DAX mount option or a specific filesystem for the test.
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# remove previous $seqres.full before test
rm -f $seqres.full
# Modify as appropriate.
_supported_fs generic
_supported_os Linux
_require_test
_require_scratch
_require_test_program "t_mmap_collision"
_require_xfs_io_command "falloc"
_require_xfs_io_command "fpunch"
_require_xfs_io_command "fcollapse"
_require_xfs_io_command "fzero"
_scratch_mkfs >> $seqres.full 2>&1
# To get the failure we turn off DAX on our SCRATCH_MNT so we can get O_DIRECT
# behavior. We will continue to use unmodified mount options for the test
# TEST_DIR. The failures fixed by the above mentioned kernel patch trigger
# when those mount options include "-o dax", but the test runs fine without
# that option so we don't require it.
export MOUNT_OPTIONS=""
_scratch_mount >> $seqres.full 2>&1
# real QA test starts here
$here/src/t_mmap_collision $TEST_DIR/testfile $SCRATCH_MNT/testfile
# success, all done
echo "Silence is golden"
status=0
exit