Message ID | 20250326120341.3641535-1-chao@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | f2fs/011: test to check out-of-space issue | expand |
On Wed, Mar 26, 2025 at 08:03:41PM +0800, Chao Yu wrote: > 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 <jaegeuk@kernel.org> > Signed-off-by: Chao Yu <chao@kernel.org> > --- > 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 > > diff --git a/tests/f2fs/011 b/tests/f2fs/011 > new file mode 100755 > index 00000000..1ece8fd0 > --- /dev/null > +++ b/tests/f2fs/011 > @@ -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.* > +} Default _cleanup does the same things, so above _cleanup can be removed. > + > +_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 We'd like to use xfs_io when we can: $XFS_IO_PROG -f -c "pwrite 0 1m" $SCRATCH_MNT/$i >>$seqres.full > +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" ? > +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 > + > +echo "Silence is golden" > + > +status=0 > +exit > diff --git a/tests/f2fs/011.out b/tests/f2fs/011.out > new file mode 100644 > index 00000000..62e02519 > --- /dev/null > +++ b/tests/f2fs/011.out > @@ -0,0 +1,2 @@ > +QA output created by 011 > +Silence is golden > -- > 2.49.0 >
diff --git a/tests/f2fs/011 b/tests/f2fs/011 new file mode 100755 index 00000000..1ece8fd0 --- /dev/null +++ b/tests/f2fs/011 @@ -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 diff --git a/tests/f2fs/011.out b/tests/f2fs/011.out new file mode 100644 index 00000000..62e02519 --- /dev/null +++ b/tests/f2fs/011.out @@ -0,0 +1,2 @@ +QA output created by 011 +Silence is golden
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 <jaegeuk@kernel.org> Signed-off-by: Chao Yu <chao@kernel.org> --- 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