From: Leah Rumancik Date: Wed, 25 Jun 2025 21:20:22 +0000 (-0700) Subject: common/rc: add repair fsck flag -f for ext4 X-Git-Tag: v2025.07.13~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a7b5d6b38296e655a9d659844937154ea57db7b8;p=xfstests-dev.git common/rc: add repair fsck flag -f for ext4 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 Reviewed-by: Theodore Ts'o Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- diff --git a/common/rc b/common/rc index fbab26b2..c6393576 100644 --- a/common/rc +++ b/common/rc @@ -1551,6 +1551,7 @@ _repair_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 @@ -1558,8 +1559,11 @@ _repair_scratch_fs() fstyp=$OVL_BASE_FSTYP _unmount $OVL_BASE_SCRATCH_MNT fi - # Let's hope fsck -y suffices... - fsck -t $fstyp -y $dev 2>&1 + if [[ "$FSTYP" =~ ext[234]$ ]]; then + fsopts="-f" + fi + + fsck -t $fstyp -y ${fsopts} $dev 2>&1 local res=$? case $res in $FSCK_OK|$FSCK_NONDESTRUCT|$FSCK_REBOOT) @@ -1603,8 +1607,11 @@ _repair_test_fs() res=$? ;; *) - # Let's hope fsck -y suffices... - fsck -t $FSTYP -y $TEST_DEV >$tmp.repair 2>&1 + local fsopts= + if [[ "$FSTYP" =~ ext[234]$ ]]; then + fsopts="-f" + fi + fsck -t $FSTYP -y ${fsopts} $TEST_DEV >$tmp.repair 2>&1 res=$? if test "$res" -lt 4 ; then res=0