mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
overlay: correct scratch dirs check
Tests that use _overlay_scratch_mount_dirs instead of _scratch_mount should use _require_scratch_nocheck instead of _require_scratch because these tests are either mounting with multiple lower dirs or mounting with non-default lower/upper/work dir, so _check_overlay_scratch_fs won't handle these cases correctly. So we introduce _overlay_check_scratch_dirs helper and should call this helper with the correct dir arguments for these non-default cases. This patch modify these tests to optionally call _overlay_check_scratch_dirs at the end of the test or after _scratch_umount to mount base filesystem only and run the checker. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
@@ -219,6 +219,35 @@ _overlay_check_dirs()
|
||||
return $err
|
||||
}
|
||||
|
||||
# Check the same mnt/dev of _check_overlay_scratch_fs but non-default
|
||||
# underlying scratch dirs of overlayfs, it needs lower/upper/work dirs
|
||||
# provided as arguments, and it's useful for non-default setups such
|
||||
# as multiple lower layers
|
||||
_overlay_check_scratch_dirs()
|
||||
{
|
||||
local lowerdir=$1
|
||||
local upperdir=$2
|
||||
local workdir=$3
|
||||
shift 3
|
||||
|
||||
# Need to umount overlay for scratch dir check
|
||||
local ovl_mounted=`_is_dir_mountpoint $SCRATCH_MNT`
|
||||
[ -z "$ovl_mounted" ] || $UMOUNT_PROG $SCRATCH_MNT
|
||||
|
||||
# Check dirs with extra overlay options
|
||||
_overlay_check_dirs $lowerdir $upperdir $workdir $*
|
||||
local ret=$?
|
||||
|
||||
if [ $ret -eq 0 -a -n "$ovl_mounted" ]; then
|
||||
# overlay was mounted, remount with extra mount options
|
||||
_overlay_scratch_mount_dirs $lowerdir $upperdir \
|
||||
$workdir $*
|
||||
ret=$?
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
_overlay_check_fs()
|
||||
{
|
||||
# The first arguments is overlay mount point use for checking
|
||||
|
||||
Reference in New Issue
Block a user