diff mbox series

[v2] generic/new: drop caches while freeze

Message ID 20231215115505.1826465-1-jencce.kernel@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v2] generic/new: drop caches while freeze | expand

Commit Message

Murphy Zhou Dec. 15, 2023, 11:55 a.m. UTC
Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
---
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

Comments

Zorro Lang Dec. 15, 2023, 5:31 p.m. UTC | #1
On Fri, Dec 15, 2023 at 07:55:05PM +0800, Murphy Zhou wrote:
> Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> ---
> v2:
>   re-number to 738
>   mkfs and mount scratch in the begining
>   create more files and comment why
>   unfreeze in cleanup

This version looks better to me. I'll merge this patch with a few of
small changes. Thanks for this new coverage!

Reviewed-by: Zorro Lang <zlang@redhat.com>

> 
>  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
>
diff mbox series

Patch

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