From: Chao Yu <chao@kernel.org>
To: Zorro Lang <zlang@kernel.org>, fstests@vger.kernel.org
Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
Chao Yu <chao@kernel.org>
Subject: [PATCH v3 5/6] common/rc: introduce _check_f2fs_filesystem()
Date: Tue, 11 Mar 2025 16:04:29 +0800 [thread overview]
Message-ID: <20250311080430.3696582-5-chao@kernel.org> (raw)
In-Reply-To: <20250311080430.3696582-1-chao@kernel.org>
_check_generic_filesystem() will fail the test once it detects
corruption, let's introduce _check_f2fs_filesystem() to just check
filesystem w/ --dry-run option, and return the error number, then
let caller to decide whether the corruption is as expected or not.
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
---
v3:
- introduce _check_f2fs_filesystem() to dry run on f2fs image
common/rc | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/common/rc b/common/rc
index 23b642f4..00883eb7 100644
--- a/common/rc
+++ b/common/rc
@@ -3519,6 +3519,46 @@ _check_generic_filesystem()
return 0
}
+_check_f2fs_filesystem()
+{
+ local device=$1
+
+ # If type is set, we're mounted
+ local type=`_fs_type $device`
+ local ok=1
+
+ if [ "$type" = "$FSTYP" ]
+ then
+ # mounted ...
+ local mountpoint=`_umount_or_remount_ro $device`
+ fi
+
+ FSCK_OPTIONS="--dry-run"
+ $F2FS_FSCK_PROG $FSCK_OPTIONS $device >>$seqres.full 2>&1
+ if [ $? -ne 0 ]
+ then
+ ok=0
+ fi
+
+ if [ $ok -eq 0 ]
+ then
+ echo "*** mount output ***" >>$seqres.full
+ _mount >>$seqres.full
+ echo "*** end mount output" >>$seqres.full
+ elif [ "$type" = "$FSTYP" ]
+ then
+ # was mounted ...
+ _mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint
+ ok=$?
+ fi
+
+ if [ $ok -eq 0 ]; then
+ return 1
+ fi
+
+ return 0
+}
+
# Filter the knowen errors the UDF Verifier reports.
_udf_test_known_error_filter()
{
@@ -3623,6 +3663,9 @@ _check_test_fs()
ubifs)
# there is no fsck program for ubifs yet
;;
+ f2fs)
+ _check_f2fs_filesystem $TEST_DEV
+ ;;
*)
_check_generic_filesystem $TEST_DEV
;;
@@ -3679,6 +3722,9 @@ _check_scratch_fs()
ubifs)
# there is no fsck program for ubifs yet
;;
+ f2fs)
+ _check_f2fs_filesystem $device
+ ;;
*)
_check_generic_filesystem $device
;;
--
2.48.1
next prev parent reply other threads:[~2025-03-11 8:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 8:04 [PATCH v3 1/6] common/config: remove redundant export variables Chao Yu
2025-03-11 8:04 ` [PATCH v3 2/6] common/config: export F2FS_INJECT_PROG Chao Yu
2025-03-11 8:04 ` [PATCH v3 3/6] common/config: export F2FS_FSCK_PROG Chao Yu
2025-03-11 14:09 ` Zorro Lang
2025-03-11 8:04 ` [PATCH v3 4/6] common/rc: use -f for mkfs.f2fs by default Chao Yu
2025-03-11 14:10 ` Zorro Lang
2025-03-11 8:04 ` Chao Yu [this message]
2025-03-11 13:54 ` [PATCH v3 5/6] common/rc: introduce _check_f2fs_filesystem() Zorro Lang
2025-03-11 8:04 ` [PATCH v3 6/6] f2fs/009: detect and repair nlink corruption Chao Yu
2025-03-11 9:20 ` Chao Yu
2025-03-11 14:06 ` Zorro Lang
2025-03-12 7:14 ` 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=20250311080430.3696582-5-chao@kernel.org \
--to=chao@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=zlang@kernel.org \
/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