diff options
author | Murphy Zhou <jencce.kernel@gmail.com> | 2023-12-15 19:55:05 +0800 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2023-12-16 01:36:05 +0800 |
commit | 4050ac7b38b0386bff53db1f636ae6f7bc8783b2 (patch) | |
tree | ec7841adb191cadc63236093df57333cedc444e8 | |
parent | f814a0d8b89c84055b4351f8b9655c5868db08ba (diff) | |
download | xfstests-dev-4050ac7b38b0386bff53db1f636ae6f7bc8783b2.tar.gz |
generic: drop caches while freeze
This's a bug reproducer for a downstream kernel, upstream linux has
fixed this issue "indirectly". When the superblock is frozen and
reclaim attempts to process certain inodes that require transactions
to break down, such as those with post-eof or COW fork blocks, a
deadlock might happen.
Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
-rwxr-xr-x | tests/generic/738 | 52 | ||||
-rw-r--r-- | tests/generic/738.out | 2 |
2 files changed, 54 insertions, 0 deletions
diff --git a/tests/generic/738 b/tests/generic/738 new file mode 100755 index 0000000000..2b37b1e73a --- /dev/null +++ b/tests/generic/738 @@ -0,0 +1,52 @@ +#! /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 auto quick freeze + +_cleanup() +{ + xfs_freeze -u $SCRATCH_MNT 2>/dev/null + 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 0000000000..5719515a70 --- /dev/null +++ b/tests/generic/738.out @@ -0,0 +1,2 @@ +QA output created by 738 +Silence is golden |