mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
overlay: fix _repair_scratch_fs
_repair_scratch_fs did not do the right thing for overlay. Implement and call _repair_overlay_scratch_fs to repair overlay filesystem and then fall through to repair base filesystem. The only tests currentrly calling _repair_scratch_fs on a ./check -overlay run are generic/330 generic/332 in case the base fs supports reflink. The rest of the tests calling _repair_scratch_fs require that $SCRATCH_DEV is a block device. Suggested-by: zhangyi (F) <yi.zhang@huawei.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
committed by
Eryu Guan
parent
16b7039194
commit
d9f4cb7271
@@ -320,3 +320,20 @@ _check_overlay_scratch_fs()
|
||||
"$OVL_BASE_SCRATCH_DEV" "$OVL_BASE_SCRATCH_MNT" \
|
||||
$OVL_BASE_MOUNT_OPTIONS $SELINUX_MOUNT_OPTIONS
|
||||
}
|
||||
|
||||
_repair_overlay_scratch_fs()
|
||||
{
|
||||
_overlay_fsck_dirs $OVL_BASE_SCRATCH_MNT/$OVL_LOWER \
|
||||
$OVL_BASE_SCRATCH_MNT/$OVL_UPPER \
|
||||
$OVL_BASE_SCRATCH_MNT/$OVL_WORK -y
|
||||
local res=$?
|
||||
case $res in
|
||||
$FSCK_OK|$FSCK_NONDESTRUCT)
|
||||
res=0
|
||||
;;
|
||||
*)
|
||||
_dump_err2 "fsck.overlay failed, err=$res"
|
||||
;;
|
||||
esac
|
||||
return $res
|
||||
}
|
||||
|
||||
@@ -1112,8 +1112,17 @@ _repair_scratch_fs()
|
||||
return $res
|
||||
;;
|
||||
*)
|
||||
# Let's hope fsck -y suffices...
|
||||
fsck -t $FSTYP -y $SCRATCH_DEV 2>&1
|
||||
local dev=$SCRATCH_DEV
|
||||
local fstyp=$FSTYP
|
||||
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
|
||||
$UMOUNT_PROG $OVL_BASE_SCRATCH_MNT
|
||||
fi
|
||||
# Let's hope fsck -y suffices...
|
||||
fsck -t $fstyp -y $dev 2>&1
|
||||
local res=$?
|
||||
case $res in
|
||||
$FSCK_OK|$FSCK_NONDESTRUCT|$FSCK_REBOOT)
|
||||
|
||||
Reference in New Issue
Block a user