* [PATCH v2] common/rc: add repair fsck flag -f for ext4
@ 2025-06-25 21:20 Leah Rumancik
2025-06-26 3:51 ` Theodore Ts'o
2025-06-26 19:53 ` Zorro Lang
0 siblings, 2 replies; 5+ messages in thread
From: Leah Rumancik @ 2025-06-25 21:20 UTC (permalink / raw)
To: fstests; +Cc: linux-ext4, Leah Rumancik
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] common/rc: add repair fsck flag -f for ext4
2025-06-25 21:20 [PATCH v2] common/rc: add repair fsck flag -f for ext4 Leah Rumancik
@ 2025-06-26 3:51 ` Theodore Ts'o
2025-06-26 19:53 ` Zorro Lang
2025-06-26 19:53 ` Zorro Lang
1 sibling, 1 reply; 5+ messages in thread
From: Theodore Ts'o @ 2025-06-26 3:51 UTC (permalink / raw)
To: Leah Rumancik; +Cc: fstests, linux-ext4
On Wed, Jun 25, 2025 at 02:20:22PM -0700, Leah Rumancik wrote:
> 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>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Looks good to me, although I might suggest ammending or just dropping
the comment:
> # Let's hope fsck -y suffices...
... since obviously, for ext[234] it wasn't sufficient. :-)
- Ted
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] common/rc: add repair fsck flag -f for ext4
2025-06-25 21:20 [PATCH v2] common/rc: add repair fsck flag -f for ext4 Leah Rumancik
2025-06-26 3:51 ` Theodore Ts'o
@ 2025-06-26 19:53 ` Zorro Lang
2025-06-26 20:44 ` Leah Rumancik
1 sibling, 1 reply; 5+ messages in thread
From: Zorro Lang @ 2025-06-26 19:53 UTC (permalink / raw)
To: Leah Rumancik; +Cc: fstests, linux-ext4
On Wed, Jun 25, 2025 at 02:20:22PM -0700, Leah Rumancik wrote:
> 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
I think you can use [[ "$FSTYP" == ext[234] ]] directly.
> + 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
Same here
Others look good to me. If you agree, I can help to do this change
when I merge it :)
Reviewed-by: Zorro Lang <zlang@redhat.com>
> + 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
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] common/rc: add repair fsck flag -f for ext4
2025-06-26 3:51 ` Theodore Ts'o
@ 2025-06-26 19:53 ` Zorro Lang
0 siblings, 0 replies; 5+ messages in thread
From: Zorro Lang @ 2025-06-26 19:53 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Leah Rumancik, fstests, linux-ext4
On Wed, Jun 25, 2025 at 11:51:25PM -0400, Theodore Ts'o wrote:
> On Wed, Jun 25, 2025 at 02:20:22PM -0700, Leah Rumancik wrote:
> > 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>
>
> Reviewed-by: Theodore Ts'o <tytso@mit.edu>
>
> Looks good to me, although I might suggest ammending or just dropping
> the comment:
>
> > # Let's hope fsck -y suffices...
>
> ... since obviously, for ext[234] it wasn't sufficient. :-)
Thanks Ted, I'll remove it when I merge this patch :)
Thanks,
Zorro
>
> - Ted
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] common/rc: add repair fsck flag -f for ext4
2025-06-26 19:53 ` Zorro Lang
@ 2025-06-26 20:44 ` Leah Rumancik
0 siblings, 0 replies; 5+ messages in thread
From: Leah Rumancik @ 2025-06-26 20:44 UTC (permalink / raw)
To: Zorro Lang; +Cc: fstests, linux-ext4
Sounds great, thanks Zorro!
- leah
On Thu, Jun 26, 2025 at 12:53 PM Zorro Lang <zlang@redhat.com> wrote:
>
> On Wed, Jun 25, 2025 at 02:20:22PM -0700, Leah Rumancik wrote:
> > 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
>
> I think you can use [[ "$FSTYP" == ext[234] ]] directly.
>
> > + 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
>
> Same here
>
> Others look good to me. If you agree, I can help to do this change
> when I merge it :)
>
> Reviewed-by: Zorro Lang <zlang@redhat.com>
>
> > + 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
> >
> >
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-06-26 20:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25 21:20 [PATCH v2] common/rc: add repair fsck flag -f for ext4 Leah Rumancik
2025-06-26 3:51 ` Theodore Ts'o
2025-06-26 19:53 ` Zorro Lang
2025-06-26 19:53 ` Zorro Lang
2025-06-26 20:44 ` Leah Rumancik
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).