From: Chao Yu <chao@kernel.org>
To: Zorro Lang <zlang@redhat.com>
Cc: fstests@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net,
Chao Yu <chao@kernel.org>, Qi Han <hanqi@vivo.com>
Subject: [PATCH] f2fs/005: add testcase to check checkpoint disabling functionality
Date: Sat, 12 Oct 2024 18:15:01 +0800 [thread overview]
Message-ID: <20241012101501.377899-1-chao@kernel.org> (raw)
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
next reply other threads:[~2024-10-12 10:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 10:15 Chao Yu [this message]
2024-10-25 4:11 ` [PATCH] f2fs/005: add testcase to check checkpoint disabling functionality Zorro Lang
2024-10-28 13:46 ` Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241012101501.377899-1-chao@kernel.org \
--to=chao@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=hanqi@vivo.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=zlang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox