mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
overlay: mount/unmount base fs before/after running tests
When TEST/SCRATCH_DEV are configured to the base fs block device, use this information to mount base fs before running tests, unmount it after running tests and cycle on _test_cycle_mount along with the overlay mounts. This helps catching overlayfs bugs related to leaking objects in underlying (base) fs. To preserve expected tests behavior, the semantics are: - _scratch_mkfs mounts the base fs, cleans all files, creates lower/upper dirs and keeps base fs mounted - _scratch_mount mounts base fs (if needed) and mounts overlay - _scratch_unmount unmounts overlay and base fs Tests that use _scratch_unmount to unmount a custom overlay mount and expect to have access to overlay base dir, were fixed to use explicit umount $SCRATCH_MNT instead. The overlay test itself, does not support formatting the base fs, so config options like MKFS_OPTIONS and FSCK_OPTIONS are ignored on 'check -overlay'. The config option MOUNT_OPTIONS is used to mount the base scratch fs. The config option TEST_FS_MOUNT_OPTS is used to mount the base test fs. The config option OVERLAY_MOUNT_OPTIONS is used to mount both test and scratch overlay mounts. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
committed by
Eryu Guan
parent
bcba40e3df
commit
2ab614524d
+3
-2
@@ -73,7 +73,8 @@ mkdir -p $lowerdir1/testdir/d
|
||||
_overlay_mount_dirs $lowerdir1 $lowerdir2 $workdir $SCRATCH_DEV $SCRATCH_MNT
|
||||
rm -rf $SCRATCH_MNT/testdir
|
||||
mkdir -p $SCRATCH_MNT/testdir/visibledir
|
||||
_scratch_unmount
|
||||
# unmount overlayfs but not base fs
|
||||
$UMOUNT_PROG $SCRATCH_MNT
|
||||
|
||||
# mount overlay again, with lowerdir1 and lowerdir2 as multiple lowerdirs,
|
||||
# and create a new file in testdir, triggers copyup from lowerdir,
|
||||
@@ -84,7 +85,7 @@ touch $SCRATCH_MNT/testdir/visiblefile
|
||||
|
||||
# umount and mount overlay again, buggy kernel treats the copied-up dir as
|
||||
# opaque, visibledir is not seen in merged dir.
|
||||
_scratch_unmount
|
||||
$UMOUNT_PROG $SCRATCH_MNT
|
||||
_overlay_mount_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir \
|
||||
$SCRATCH_DEV $SCRATCH_MNT
|
||||
ls $SCRATCH_MNT/testdir
|
||||
|
||||
Reference in New Issue
Block a user