f2fs/005: add testcase to check checkpoint disabling functionality
PATCH 1/1 f2fs/005: add testcase to check checkpoint disabling functionality
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.
--- tests/f2fs/005 | 59 ++++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/005.out | 1 + 2 files changed, 60 insertions(+) create mode 100755 tests/f2fs/005 create mode 100644 tests/f2fs/005.out
tests/f2fs/005 new file +59 -0
@@ -0,0 +1,59 @@ +#! /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 + +_cleanup() +{ + rm -f $img + rmdir $mnt + _scratch_unmount >> $seqres.full + cd / + rm -r -f $tmp.* +} + +_require_scratch +_scratch_mkfs >> $seqres.full +_scratch_mount >> $seqres.full + +img=$SCRATCH_MNT/f2fs.img +mnt=$SCRATCH_MNT/f2fs.mnt +testfile=$mnt/testfile +tmpfile=$mnt/tmpfile +tmpdir=$mnt/tmpdir + +mkdir $mnt +dd if=/dev/zero of=$img bs=1M count=50 2>/dev/null +$MKFS_F2FS_PROG -f $img >/dev/null 2>&1 +sync + +# use mode=lfs to let f2fs always triggers OPU +mount -t $FSTYP -o loop,mode=lfs,checkpoint=disable:10%,noinline_dentry $img $mnt + +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 + +mount -o remount,checkpoint=enable $mnt + +# it may hang umount if tmpdir is still dirty during evict() +umount $mnt + +status=0 +exit
tests/f2fs/005.out new file +1 -0
@@ -0,0 +1 @@ +QA output created by 005
Signature · 1 line
2.40.1
Quoted 19 lines · Chao Yu
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 <[email protected]>Signed-off-by Chao Yu <[email protected]>--- tests/f2fs/005 | 59 ++++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/005.out | 1 + 2 files changed, 60 insertions(+) create mode 100755 tests/f2fs/005 create mode 100644 tests/f2fs/005.outtests/f2fs/005 new file +0
-0
tests/f2fs/005 line 9
Quoted 9 lines
tests/f2fs/005 new file +9
-0@@ -0,0 +1,59 @@ +#! /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.
Is this a duplicated test of another patch from you?
Or just similar?
If this's a different test ...(see below)
Quoted 20 lines
tests/f2fs/005 new file +20
-0+# +. ./common/preamble +_begin_fstest auto quick + +_cleanup() +{ + rm -f $img + rmdir $mnt + _scratch_unmount >> $seqres.full + cd / + rm -r -f $tmp.* +} + +_require_scratch +_scratch_mkfs >> $seqres.full +_scratch_mount >> $seqres.full + +img=$SCRATCH_MNT/f2fs.img +mnt=$SCRATCH_MNT/f2fs.mnt +testfile=$mnt/testfile
tests/f2fs/005 line 39
Quoted 10 lines
tests/f2fs/005 new file +10
-0+tmpfile=$mnt/tmpfile +tmpdir=$mnt/tmpdir + +mkdir $mnt +dd if=/dev/zero of=$img bs=1M count=50 2>/dev/null +$MKFS_F2FS_PROG -f $img >/dev/null 2>&1 +sync + +# use mode=lfs to let f2fs always triggers OPU +mount -t $FSTYP -o loop,mode=lfs,checkpoint=disable:10%,noinline_dentry $img $mnt
You can use _scratch_mkfs_sized, don't need a loop device. And without the loop device, above _cleanup is not needed either.
Quoted 26 lines
tests/f2fs/005 new file +20
-0+ +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 + +mount -o remount,checkpoint=enable $mnt + +# it may hang umount if tmpdir is still dirty during evict() +umount $mnt + +status=0 +exittests/f2fs/005.out new file +0
-0
tests/f2fs/005.out line 1
Quoted 1 line
tests/f2fs/005.out new file +1
-0@@ -0,0 +1 @@ +QA output created by 005
If nothing output, please:
echo "Silence is golden"
Thanks,
Zorro
Quoted 3 lines
Signature · 1 line
2.40.1
Quoted 32 lines · Zorro Lang
Quoted 19 lines · Chao Yu
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 <[email protected]>Signed-off-by Chao Yu <[email protected]>--- tests/f2fs/005 | 59 ++++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/005.out | 1 + 2 files changed, 60 insertions(+)create mode 100755 tests/f2fs/005
create mode 100644 tests/f2fs/005.outtests/f2fs/005 new file +0
-0tests/f2fs/005 line 9
Quoted 9 lines
tests/f2fs/005 new file +9
-0@@ -0,0 +1,59 @@ +#! /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.Is this a duplicated test of another patch from you?
Quoted 5 lines
Or just similar?
If this's a different test ...(see below)
It's a different one.
Quoted 65 lines
Quoted 21 lines
tests/f2fs/005 new file +20
-0+# +. ./common/preamble +_begin_fstest auto quick + +_cleanup() +{ + rm -f $img + rmdir $mnt + _scratch_unmount >> $seqres.full + cd / + rm -r -f $tmp.* +} + +_require_scratch +_scratch_mkfs >> $seqres.full +_scratch_mount >> $seqres.full + +img=$SCRATCH_MNT/f2fs.img +mnt=$SCRATCH_MNT/f2fs.mnt +testfile=$mnt/testfiletests/f2fs/005 line 39
Quoted 10 lines
tests/f2fs/005 new file +10
-0+tmpfile=$mnt/tmpfile +tmpdir=$mnt/tmpdir + +mkdir $mnt +dd if=/dev/zero of=$img bs=1M count=50 2>/dev/null +$MKFS_F2FS_PROG -f $img >/dev/null 2>&1 +sync + +# use mode=lfs to let f2fs always triggers OPU +mount -t $FSTYP -o loop,mode=lfs,checkpoint=disable:10%,noinline_dentry $img $mntYou can use
_scratch_mkfs_sized, don't need a loop device. And without the loop device, above_cleanupis not needed either.Quoted 26 lines
tests/f2fs/005 new file +20
-0+ +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 + +mount -o remount,checkpoint=enable $mnt + +# it may hang umount if tmpdir is still dirty during evict() +umount $mnt + +status=0 +exittests/f2fs/005.out new file +0
-0tests/f2fs/005.out line 1
Quoted 1 line
tests/f2fs/005.out new file +1
-0@@ -0,0 +1 @@ +QA output created by 005If nothing output, please:
Quoted 1 line
echo "Silence is golden"
Will update this patch according to your comments, thank you!
Thanks,
Quoted 8 lines
Thanks,
ZorroQuoted 3 lines
Signature · 1 line
2.40.1