Skip to contentSkip to conversation

f2fs/011: test to check out-of-space issue

PATCH Superseded Chao Yu 2 participants 2 messages Mar 26, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 f2fs/011: test to check out-of-space issue

This is a regression testcase to check whether we will handle out-of-space case correctly during fallocate() on pinned file once we disable checkpoint.

Testcase:
1. mount f2fs w/ checkpoint=disable option
2. create fragmented file data
3. set flag w/ pinned flag
4. fallocate space for pinned file, expects panic due to running out of space.

We should apply commit 48ea8b200414 ("f2fs: fix to avoid panic once fallocation fails for pinfile") to avoid system panic. Note that it only fix the issue for regular block device, problem still exist for zoned block device.

Cc Jaegeuk Kim <[email protected]>
---
 tests/f2fs/011     | 58 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/f2fs/011.out |  2 ++
 2 files changed, 60 insertions(+)
 create mode 100755 tests/f2fs/011
 create mode 100644 tests/f2fs/011.out
tests/f2fs/011 new file +58 -0
new file mode 100755
index 00000000..1ece8fd0
@@ -0,0 +1,58 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2025 Chao Yu.  All Rights Reserved.
+#
+# FS QA Test No. f2fs/012
+#
+# This is a regression testcase to check whether we will handle
+# out-of-space case correctly during fallocate() on pinned file
+# once we disable checkpoint.
+# 1. mount f2fs w/ checkpoint=disable option
+# 2. create fragmented file data
+# 3. set flag w/ pinned flag
+# 4. fallocate space for pinned file, expects panic due to running
+# out of space
+# We should apply commit 48ea8b200414 ("f2fs: fix to avoid panic
+# once fallocation fails for pinfile") to avoid system panic.
+# Note that it only fix the issue for regular block device, problem
+# still exist for zoned block device.
+#
+. ./common/preamble
+_begin_fstest auto quick
+
+_cleanup()
+{
+	cd /
+	rm -r -f $tmp.*
+}
+
+_fixed_by_kernel_commit 48ea8b200414 \
+       "f2fs: fix to avoid panic once fallocation fails for pinfile"
+
+_require_scratch
+_require_command "$F2FS_IO_PROG" f2fs_io
+
+_scratch_mkfs_sized $((1*1024*1024*1024)) >> $seqres.full
+_scratch_mount -o checkpoint=disable:10%
+
+pinfile=$SCRATCH_MNT/file
+
+# simulate fragment status in f2fs
+for ((i=0;i<256;i++)) do
+       dd if=/dev/zero of=$SCRATCH_MNT/$i bs=1M count=1 >>$seqres.full 2>&1
+done
+sync
+
+for ((i=0;i<256;i+=2)) do
+       rm $SCRATCH_MNT/$i >> $seqres.full 2>&1
+done
+sync
+
+touch $pinfile
+$F2FS_IO_PROG pinfile set $pinfile >> $seqres.full
+fallocate -l $((3*256*1024*1024)) $pinfile >> $seqres.full 2>&1
+
+echo "Silence is golden"
+
+status=0
+exit
tests/f2fs/011.out new file +2 -0
new file mode 100644
index 00000000..62e02519
@@ -0,0 +1,2 @@
+QA output created by 011
+Silence is golden
Signature · 1 line
2.49.0
#1 lore raw
Quoted 48 lines · Chao Yu

This is a regression testcase to check whether we will handle out-of-space case correctly during fallocate() on pinned file once we disable checkpoint.

Testcase:
1. mount f2fs w/ checkpoint=disable option
2. create fragmented file data
3. set flag w/ pinned flag
4. fallocate space for pinned file, expects panic due to running out of space.

We should apply commit 48ea8b200414 ("f2fs: fix to avoid panic once fallocation fails for pinfile") to avoid system panic. Note that it only fix the issue for regular block device, problem still exist for zoned block device.

Cc Jaegeuk Kim <[email protected]>
---
 tests/f2fs/011     | 58 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/f2fs/011.out |  2 ++
 2 files changed, 60 insertions(+)
 create mode 100755 tests/f2fs/011
 create mode 100644 tests/f2fs/011.out
tests/f2fs/011 new file +17 -0
new file mode 100755
index 00000000..1ece8fd0
@@ -0,0 +1,58 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2025 Chao Yu.  All Rights Reserved.
+#
+# FS QA Test No. f2fs/012
+#
+# This is a regression testcase to check whether we will handle
+# out-of-space case correctly during fallocate() on pinned file
+# once we disable checkpoint.
+# 1. mount f2fs w/ checkpoint=disable option
+# 2. create fragmented file data
+# 3. set flag w/ pinned flag
+# 4. fallocate space for pinned file, expects panic due to running
+# out of space
+# We should apply commit 48ea8b200414 ("f2fs: fix to avoid panic
+# once fallocation fails for pinfile") to avoid system panic.
+# Note that it only fix the issue for regular block device, problem

tests/f2fs/011 line 27

Quoted 10 lines
tests/f2fs/011 new file +10 -0
+# still exist for zoned block device.
+#
+. ./common/preamble
+_begin_fstest auto quick
+
+_cleanup()
+{
+	cd /
+	rm -r -f $tmp.*
+}

Default _cleanup does the same things, so above _cleanup can be removed.

Quoted 5 lines
tests/f2fs/011 new file +5 -0
+
+_fixed_by_kernel_commit 48ea8b200414 \
+       "f2fs: fix to avoid panic once fallocation fails for pinfile"
+
+_require_scratch

tests/f2fs/011 line 42

Quoted 10 lines
tests/f2fs/011 new file +10 -0
+_require_command "$F2FS_IO_PROG" f2fs_io
+
+_scratch_mkfs_sized $((1*1024*1024*1024)) >> $seqres.full
+_scratch_mount -o checkpoint=disable:10%
+
+pinfile=$SCRATCH_MNT/file
+
+# simulate fragment status in f2fs
+for ((i=0;i<256;i++)) do
+       dd if=/dev/zero of=$SCRATCH_MNT/$i bs=1M count=1 >>$seqres.full 2>&1

We'd like to use xfs_io when we can:

$XFS_IO_PROG -f -c "pwrite 0 1m" $SCRATCH_MNT/$i >>$seqres.full

tests/f2fs/011 line 47

Quoted 5 lines
tests/f2fs/011 new file +5 -0
+done
+sync
+
+for ((i=0;i<256;i+=2)) do
+       rm $SCRATCH_MNT/$i >> $seqres.full 2>&1

How about "rm -f $SCRATCH_MNT/$i" without ">> $seqres.full 2>&1" ?

tests/f2fs/011 line 53

Quoted 6 lines
tests/f2fs/011 new file +6 -0
+done
+sync
+
+touch $pinfile
+$F2FS_IO_PROG pinfile set $pinfile >> $seqres.full
+fallocate -l $((3*256*1024*1024)) $pinfile >> $seqres.full 2>&1

Same, we'd like to use xfs_io at first, due to it's already a necessary running dependence of fstests.

$XFS_IO_PROG -c "falloc 0 $((3*256*1024*1024))" $pinfile

Thanks,
Zorro

Quoted 16 lines
tests/f2fs/011 new file +5 -0
+
+echo "Silence is golden"
+
+status=0
+exit
tests/f2fs/011.out new file +2 -0
new file mode 100644
index 00000000..62e02519
@@ -0,0 +1,2 @@
+QA output created by 011
+Silence is golden
Signature · 1 line
2.49.0