* [f2fs-dev] [PATCH] f2fs/005: add testcase to check checkpoint disabling functionality
@ 2024-10-12 10:15 Chao Yu via Linux-f2fs-devel
2024-10-25 4:11 ` Zorro Lang
0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2024-10-12 10:15 UTC (permalink / raw)
To: Zorro Lang; +Cc: Qi Han, fstests, linux-f2fs-devel
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>
---
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
diff --git a/tests/f2fs/005 b/tests/f2fs/005
new file mode 100755
index 00000000..4faf1bb9
--- /dev/null
+++ b/tests/f2fs/005
@@ -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
diff --git a/tests/f2fs/005.out b/tests/f2fs/005.out
new file mode 100644
index 00000000..caa3c880
--- /dev/null
+++ b/tests/f2fs/005.out
@@ -0,0 +1 @@
+QA output created by 005
--
2.40.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs/005: add testcase to check checkpoint disabling functionality
2024-10-12 10:15 [f2fs-dev] [PATCH] f2fs/005: add testcase to check checkpoint disabling functionality Chao Yu via Linux-f2fs-devel
@ 2024-10-25 4:11 ` Zorro Lang
2024-10-28 13:46 ` Chao Yu via Linux-f2fs-devel
0 siblings, 1 reply; 3+ messages in thread
From: Zorro Lang @ 2024-10-25 4:11 UTC (permalink / raw)
To: Chao Yu; +Cc: Qi Han, fstests, linux-f2fs-devel
On Sat, Oct 12, 2024 at 06:15:01PM +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>
> ---
> 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
>
> diff --git a/tests/f2fs/005 b/tests/f2fs/005
> new file mode 100755
> index 00000000..4faf1bb9
> --- /dev/null
> +++ b/tests/f2fs/005
> @@ -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?
https://lore.kernel.org/fstests/20241025034413.5s6ecilfgqcoeudt@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com/T/#t
Or just similar?
If this's a different test ...(see below)
> +#
> +. ./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
You can use _scratch_mkfs_sized, don't need a loop device.
And without the loop device, above _cleanup is not needed either.
> +
> +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
> diff --git a/tests/f2fs/005.out b/tests/f2fs/005.out
> new file mode 100644
> index 00000000..caa3c880
> --- /dev/null
> +++ b/tests/f2fs/005.out
> @@ -0,0 +1 @@
> +QA output created by 005
If nothing output, please:
echo "Silence is golden"
Thanks,
Zorro
> --
> 2.40.1
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs/005: add testcase to check checkpoint disabling functionality
2024-10-25 4:11 ` Zorro Lang
@ 2024-10-28 13:46 ` Chao Yu via Linux-f2fs-devel
0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2024-10-28 13:46 UTC (permalink / raw)
To: Zorro Lang; +Cc: Qi Han, fstests, linux-f2fs-devel
On 2024/10/25 12:11, Zorro Lang wrote:
> On Sat, Oct 12, 2024 at 06:15:01PM +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>
>> ---
>> 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
>>
>> diff --git a/tests/f2fs/005 b/tests/f2fs/005
>> new file mode 100755
>> index 00000000..4faf1bb9
>> --- /dev/null
>> +++ b/tests/f2fs/005
>> @@ -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?
>
> https://lore.kernel.org/fstests/20241025034413.5s6ecilfgqcoeudt@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com/T/#t
>
> Or just similar?
>
> If this's a different test ...(see below)
It's a different one.
>
>> +#
>> +. ./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
>
> You can use _scratch_mkfs_sized, don't need a loop device.
> And without the loop device, above _cleanup is not needed either.
>
>> +
>> +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
>> diff --git a/tests/f2fs/005.out b/tests/f2fs/005.out
>> new file mode 100644
>> index 00000000..caa3c880
>> --- /dev/null
>> +++ b/tests/f2fs/005.out
>> @@ -0,0 +1 @@
>> +QA output created by 005
>
> If nothing output, please:
>
> echo "Silence is golden"
Will update this patch according to your comments, thank you!
Thanks,
>
> Thanks,
> Zorro
>
>> --
>> 2.40.1
>>
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-28 13:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-12 10:15 [f2fs-dev] [PATCH] f2fs/005: add testcase to check checkpoint disabling functionality Chao Yu via Linux-f2fs-devel
2024-10-25 4:11 ` Zorro Lang
2024-10-28 13:46 ` Chao Yu via Linux-f2fs-devel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).