From: Leah Rumancik <leah.rumancik@gmail.com>
To: fstests@vger.kernel.org
Cc: linux-ext4@vger.kernel.org, Leah Rumancik <leah.rumancik@gmail.com>
Subject: [PATCH v2] common/rc: add repair fsck flag -f for ext4
Date: Wed, 25 Jun 2025 14:20:22 -0700 [thread overview]
Message-ID: <20250625212022.35111-1-leah.rumancik@gmail.com> (raw)
There is a descrepancy between the fsck flags for ext4 during
filesystem repair and filesystem checking which causes occasional test
failures. In particular, _check_generic_filesystems uses -f for force
checking, but _repair_scratch_fs does not. In some tests, such as
generic/441, we sometimes exit fsck repair early with the filesystem
being deemed "clean" but then _check_generic_filesystems finds issues
during the forced full check. Bringing these flags in sync fixes the
flakes.
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
---
v2: update to fix for ext2/3 as well
common/rc | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/common/rc b/common/rc
index daf62c92..ddced1b7 100644
--- a/common/rc
+++ b/common/rc
@@ -1496,19 +1496,24 @@ _repair_scratch_fs()
_check_scratch_fs
;;
*)
local dev=$SCRATCH_DEV
local fstyp=$FSTYP
+ local fsopts=
if [ $FSTYP = "overlay" -a -n "$OVL_BASE_SCRATCH_DEV" ]; then
_repair_overlay_scratch_fs
# Fall through to repair base fs
dev=$OVL_BASE_SCRATCH_DEV
fstyp=$OVL_BASE_FSTYP
_unmount $OVL_BASE_SCRATCH_MNT
fi
+ if [ $FSTYP = "ext4" ] || [ $FSTYP = "ext3" ] || [ $FSTYP = "ext2" ]; then
+ fsopts="-f"
+ fi
+
# Let's hope fsck -y suffices...
- fsck -t $fstyp -y $dev 2>&1
+ fsck -t $fstyp -y ${fsopts} $dev 2>&1
local res=$?
case $res in
$FSCK_OK|$FSCK_NONDESTRUCT|$FSCK_REBOOT)
res=0
;;
@@ -1548,12 +1553,16 @@ _repair_test_fs()
yes | $BTRFS_UTIL_PROG check --repair --force "$TEST_DEV" >> \
$tmp.repair 2>&1
res=$?
;;
*)
+ local fsopts=
+ if [ $FSTYP = "ext4" ] || [ $FSTYP = "ext3" ] || [ $FSTYP = "ext2" ]; then
+ fsopts="-f"
+ fi
# Let's hope fsck -y suffices...
- fsck -t $FSTYP -y $TEST_DEV >$tmp.repair 2>&1
+ fsck -t $FSTYP -y ${fsopts} $TEST_DEV >$tmp.repair 2>&1
res=$?
if test "$res" -lt 4 ; then
res=0
fi
;;
--
2.50.0.727.gbf7dc18ff4-goog
next reply other threads:[~2025-06-25 21:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 21:20 Leah Rumancik [this message]
2025-06-26 3:51 ` [PATCH v2] common/rc: add repair fsck flag -f for ext4 Theodore Ts'o
2025-06-26 19:53 ` Zorro Lang
2025-06-26 19:53 ` Zorro Lang
2025-06-26 20:44 ` Leah Rumancik
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=20250625212022.35111-1-leah.rumancik@gmail.com \
--to=leah.rumancik@gmail.com \
--cc=fstests@vger.kernel.org \
--cc=linux-ext4@vger.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;
as well as URLs for NNTP newsgroup(s).