Skip to contentSkip to conversation

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

PATCH In review Chao Yu 2 participants 3 messages Mar 27, 2025 – Apr 27, 2025

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH v2 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 both commit ("f2fs: fix to avoid panic once fallocation fails for pinfile") and commit ("f2fs: fix to avoid running out of free segments") to avoid system panic. Note that w/ these two commit, we fixed such issue in both convential and zoned block device.

Cc Jaegeuk Kim <[email protected]>

---
v2:
- clean up codes suggested by Zorro
- change output to expect ENOSPC error if we have applied fixes

 tests/f2fs/011     | 53 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/f2fs/011.out |  2 ++
 2 files changed, 55 insertions(+)
 create mode 100755 tests/f2fs/011
 create mode 100644 tests/f2fs/011.out
tests/f2fs/011 new file +53 -0
new file mode 100755
index 00000000..ec3d39ec
@@ -0,0 +1,53 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2025 Chao Yu.  All Rights Reserved.
+#
+# FS QA Test No. f2fs/011
+#
+# 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 both commit ("f2fs: fix to avoid panic once
+# fallocation fails for pinfile") and commit ("f2fs: fix to avoid
+# running out of free segments") to avoid system panic.
+# Note that w/ these two commit, we fixed such issue in both
+# convential and zoned block device.
+#
+. ./common/preamble
+_begin_fstest auto quick
+
+_fixed_by_kernel_commit 48ea8b200414 \
+	"f2fs: fix to avoid panic once fallocation fails for pinfile"
+_fixed_by_kernel_commit xxxxxxxxxxxx \
+	"f2fs: fix to avoid running out of free segments"
+
+_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
+	$XFS_IO_PROG -f -c "pwrite 0 1m" $SCRATCH_MNT/$i >>$seqres.full
+done
+sync
+
+for ((i=0;i<256;i+=2)) do
+	rm -f $SCRATCH_MNT/$i
+done
+sync
+
+touch $pinfile
+$F2FS_IO_PROG pinfile set $pinfile >> $seqres.full
+$XFS_IO_PROG -c "falloc 0 $((3*256*1024*1024))" $pinfile
+
+status=0
+exit
tests/f2fs/011.out new file +2 -0
new file mode 100644
index 00000000..559c3fdf
@@ -0,0 +1,2 @@
+QA output created by 011
+fallocate: No space left on device
Signature · 1 line
2.49.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 17 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 both commit ("f2fs: fix to avoid panic once fallocation fails for pinfile") and commit ("f2fs: fix to avoid running out of free segments") to avoid system panic. Note that w/ these two commit, we fixed such issue in both convential and zoned block device.

Quoted 6 lines
Cc Jaegeuk Kim <[email protected]>

---
v2:
- clean up codes suggested by Zorro
- change output to expect ENOSPC error if we have applied fixes

Sorry I missed this V2, this version looks good to me. As there's not more review points from f2fs list, so I'd like to merge it:

Quoted 76 lines
 tests/f2fs/011     | 53 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/f2fs/011.out |  2 ++
 2 files changed, 55 insertions(+)
 create mode 100755 tests/f2fs/011
 create mode 100644 tests/f2fs/011.out
tests/f2fs/011 new file +53 -0
new file mode 100755
index 00000000..ec3d39ec
@@ -0,0 +1,53 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2025 Chao Yu.  All Rights Reserved.
+#
+# FS QA Test No. f2fs/011
+#
+# 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 both commit ("f2fs: fix to avoid panic once
+# fallocation fails for pinfile") and commit ("f2fs: fix to avoid
+# running out of free segments") to avoid system panic.
+# Note that w/ these two commit, we fixed such issue in both
+# convential and zoned block device.
+#
+. ./common/preamble
+_begin_fstest auto quick
+
+_fixed_by_kernel_commit 48ea8b200414 \
+	"f2fs: fix to avoid panic once fallocation fails for pinfile"
+_fixed_by_kernel_commit xxxxxxxxxxxx \
+	"f2fs: fix to avoid running out of free segments"
+
+_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
+	$XFS_IO_PROG -f -c "pwrite 0 1m" $SCRATCH_MNT/$i >>$seqres.full
+done
+sync
+
+for ((i=0;i<256;i+=2)) do
+	rm -f $SCRATCH_MNT/$i
+done
+sync
+
+touch $pinfile
+$F2FS_IO_PROG pinfile set $pinfile >> $seqres.full
+$XFS_IO_PROG -c "falloc 0 $((3*256*1024*1024))" $pinfile
+
+status=0
+exit
tests/f2fs/011.out new file +2 -0
new file mode 100644
index 00000000..559c3fdf
@@ -0,0 +1,2 @@
+QA output created by 011
+fallocate: No space left on device
Signature · 1 line
2.49.0
author
#2 lore raw
Quoted 25 lines · Zorro Lang
Quoted 17 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 both commit ("f2fs: fix to avoid panic once fallocation fails for pinfile") and commit ("f2fs: fix to avoid running out of free segments") to avoid system panic. Note that w/ these two commit, we fixed such issue in both convential and zoned block device.

Quoted 6 lines
Cc Jaegeuk Kim <[email protected]>

---
v2:
- clean up codes suggested by Zorro
- change output to expect ENOSPC error if we have applied fixes

Quoted 2 lines

Sorry I missed this V2, this version looks good to me. As there's not more review points from f2fs list, so I'd like to merge it:

Thank you, Zorro.

Could you please take a look at this new testcase?

https://lore.kernel.org/fstests/[email protected]

Thanks,

Quoted 80 lines
Quoted 76 lines
 tests/f2fs/011     | 53 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/f2fs/011.out |  2 ++
 2 files changed, 55 insertions(+)
 create mode 100755 tests/f2fs/011
 create mode 100644 tests/f2fs/011.out
tests/f2fs/011 new file +53 -0
new file mode 100755
index 00000000..ec3d39ec
@@ -0,0 +1,53 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2025 Chao Yu.  All Rights Reserved.
+#
+# FS QA Test No. f2fs/011
+#
+# 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 both commit ("f2fs: fix to avoid panic once
+# fallocation fails for pinfile") and commit ("f2fs: fix to avoid
+# running out of free segments") to avoid system panic.
+# Note that w/ these two commit, we fixed such issue in both
+# convential and zoned block device.
+#
+. ./common/preamble
+_begin_fstest auto quick
+
+_fixed_by_kernel_commit 48ea8b200414 \
+	"f2fs: fix to avoid panic once fallocation fails for pinfile"
+_fixed_by_kernel_commit xxxxxxxxxxxx \
+	"f2fs: fix to avoid running out of free segments"
+
+_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
+	$XFS_IO_PROG -f -c "pwrite 0 1m" $SCRATCH_MNT/$i >>$seqres.full
+done
+sync
+
+for ((i=0;i<256;i+=2)) do
+	rm -f $SCRATCH_MNT/$i
+done
+sync
+
+touch $pinfile
+$F2FS_IO_PROG pinfile set $pinfile >> $seqres.full
+$XFS_IO_PROG -c "falloc 0 $((3*256*1024*1024))" $pinfile
+
+status=0
+exit
tests/f2fs/011.out new file +2 -0
new file mode 100644
index 00000000..559c3fdf
@@ -0,0 +1,2 @@
+QA output created by 011
+fallocate: No space left on device
Signature · 1 line
2.49.0