Signed-off-by: Murphy Zhou <jencce.kernel@xxxxxxxxx> --- v2: re-number to 738 mkfs and mount scratch in the begining create more files and comment why unfreeze in cleanup tests/generic/738 | 54 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/738.out | 2 ++ 2 files changed, 56 insertions(+) create mode 100755 tests/generic/738 create mode 100644 tests/generic/738.out diff --git a/tests/generic/738 b/tests/generic/738 new file mode 100755 index 00000000..9f1f9d6b --- /dev/null +++ b/tests/generic/738 @@ -0,0 +1,54 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test 738 +# +# Test possible deadlock of umount and reclaim memory +# when there are EOF blocks in files. +# +. ./common/preamble +_begin_fstest freeze auto quick + +_cleanup() +{ + xfs_freeze -u $SCRATCH_MNT + wait + cd / + rm -r -f $tmp.* +} + +_supported_fs generic +_require_scratch +_require_freeze + +_scratch_mkfs >> $seqres.full +_scratch_mount + +create_eof_block_file() +{ + # Create several EOF blocks in the new file + for j in $(seq 1 5); do + cat $SCRATCH_MNT/testfile >> $1 + done +} + +$XFS_IO_PROG -fc "pwrite 0 64k" $SCRATCH_MNT/testfile >> $seqres.full + +# Create enough files to make sure there is enough cache +for i in $(seq 0 1024); do + create_eof_block_file $SCRATCH_MNT/$i +done + +sync + +xfs_freeze -f $SCRATCH_MNT + +# This will hang if bug reproduces +echo 3 > /proc/sys/vm/drop_caches & + +# Wait a while before exiting and unfreezing. +sleep 3 +# success, all done +echo "Silence is golden" +status=0 +exit diff --git a/tests/generic/738.out b/tests/generic/738.out new file mode 100644 index 00000000..5719515a --- /dev/null +++ b/tests/generic/738.out @@ -0,0 +1,2 @@ +QA output created by 738 +Silence is golden -- 2.31.1