Message ID | 20241028141700.1786745-1-chao@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [f2fs-dev,v2] f2fs/005: add testcase to check checkpoint disabling functionality | expand |
On Mon, Oct 28, 2024 at 10:17:00PM +0800, Chao Yu wrote: > This patch introduce a regression test to check whether f2fs handles > dirty inode correctly when checkpoint is disabled in a corner case, > it may hang umount before the bug is fixed. > > Cc: Qi Han <hanqi@vivo.com> > Signed-off-by: Chao Yu <chao@kernel.org> > --- > v2: > - add _fixed_by_kernel_commit() > - use _scratch_mkfs_sized() rather than formating size-specified This test looks good to me, if no more review points from f2fs list, I'll merge it. Reviewed-by: Zorro Lang <zlang@redhat.com> > loop device > - code cleanup > tests/f2fs/005 | 47 ++++++++++++++++++++++++++++++++++++++++++++++ > tests/f2fs/005.out | 2 ++ > 2 files changed, 49 insertions(+) > create mode 100755 tests/f2fs/005 > create mode 100644 tests/f2fs/005.out > > diff --git a/tests/f2fs/005 b/tests/f2fs/005 > new file mode 100755 > index 00000000..a817d51a > --- /dev/null > +++ b/tests/f2fs/005 > @@ -0,0 +1,47 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2024 Oppo. All Rights Reserved. > +# > +# FS QA Test No. f2fs/005 > +# > +# This is a regression test to check whether f2fs handles dirty > +# inode correctly when checkpoint is disabled, it may hang umount > +# before the bug is fixed. > +# > +. ./common/preamble > +_begin_fstest auto quick > + > +_fixed_by_kernel_commit xxxxxxxxxxxx \ > + "f2fs: fix f2fs_bug_on when uninstalling filesystem call f2fs_evict_inode." > + > +_require_scratch > +_scratch_mkfs_sized $((1024*1024*50)) >> $seqres.full > + > +# use mode=lfs to let f2fs always triggers OPU > +_scratch_mount -o mode=lfs,checkpoint=disable:10%,noinline_dentry >> $seqres.full > + > +testfile=$SCRATCH_MNT/testfile > +tmpfile=$SCRATCH_MNT/tmpfile > +tmpdir=$SCRATCH_MNT/tmpdir > + > +dd if=/dev/zero of=$testfile bs=1M count=5 2>/dev/null > +mkdir $tmpdir > +touch $tmpfile > +sync > + > +# it dirties tmpdir inode by updating ctime, > +# but it doesn't moving the inode to gdirty_list. > +mv $tmpfile $tmpdir > + > +# it runs out of free segment > +dd if=/dev/zero of=$testfile bs=1M count=5 conv=notrunc conv=fsync 2>/dev/null > + > +_scratch_mount -o remount,checkpoint=enable > + > +# it may hang umount if tmpdir is still dirty during evict() > +_scratch_unmount > + > +echo "Silence is golden" > + > +status=0 > +exit > diff --git a/tests/f2fs/005.out b/tests/f2fs/005.out > new file mode 100644 > index 00000000..a5027f12 > --- /dev/null > +++ b/tests/f2fs/005.out > @@ -0,0 +1,2 @@ > +QA output created by 005 > +Silence is golden > -- > 2.40.1 >
diff --git a/tests/f2fs/005 b/tests/f2fs/005 new file mode 100755 index 00000000..a817d51a --- /dev/null +++ b/tests/f2fs/005 @@ -0,0 +1,47 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Oppo. All Rights Reserved. +# +# FS QA Test No. f2fs/005 +# +# This is a regression test to check whether f2fs handles dirty +# inode correctly when checkpoint is disabled, it may hang umount +# before the bug is fixed. +# +. ./common/preamble +_begin_fstest auto quick + +_fixed_by_kernel_commit xxxxxxxxxxxx \ + "f2fs: fix f2fs_bug_on when uninstalling filesystem call f2fs_evict_inode." + +_require_scratch +_scratch_mkfs_sized $((1024*1024*50)) >> $seqres.full + +# use mode=lfs to let f2fs always triggers OPU +_scratch_mount -o mode=lfs,checkpoint=disable:10%,noinline_dentry >> $seqres.full + +testfile=$SCRATCH_MNT/testfile +tmpfile=$SCRATCH_MNT/tmpfile +tmpdir=$SCRATCH_MNT/tmpdir + +dd if=/dev/zero of=$testfile bs=1M count=5 2>/dev/null +mkdir $tmpdir +touch $tmpfile +sync + +# it dirties tmpdir inode by updating ctime, +# but it doesn't moving the inode to gdirty_list. +mv $tmpfile $tmpdir + +# it runs out of free segment +dd if=/dev/zero of=$testfile bs=1M count=5 conv=notrunc conv=fsync 2>/dev/null + +_scratch_mount -o remount,checkpoint=enable + +# it may hang umount if tmpdir is still dirty during evict() +_scratch_unmount + +echo "Silence is golden" + +status=0 +exit diff --git a/tests/f2fs/005.out b/tests/f2fs/005.out new file mode 100644 index 00000000..a5027f12 --- /dev/null +++ b/tests/f2fs/005.out @@ -0,0 +1,2 @@ +QA output created by 005 +Silence is golden
This patch introduce a regression test to check whether f2fs handles dirty inode correctly when checkpoint is disabled in a corner case, it may hang umount before the bug is fixed. Cc: Qi Han <hanqi@vivo.com> Signed-off-by: Chao Yu <chao@kernel.org> --- v2: - add _fixed_by_kernel_commit() - use _scratch_mkfs_sized() rather than formating size-specified loop device - code cleanup tests/f2fs/005 | 47 ++++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/005.out | 2 ++ 2 files changed, 49 insertions(+) create mode 100755 tests/f2fs/005 create mode 100644 tests/f2fs/005.out