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
# Modify as appropriate.
_supported_fs overlay
_supported_os Linux
-_require_scratch
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
_require_loop
# Remove all files from previous tests
# unmount overlayfs
$UMOUNT_PROG $SCRATCH_MNT
+# check overlayfs
+_overlay_check_scratch_dirs $lowerd $upperd $workd
+
# unmount undelying xfs, this tiggers panic if memleak happens
$UMOUNT_PROG ${OVL_BASE_SCRATCH_MNT}/uppermnt
$UMOUNT_PROG ${OVL_BASE_SCRATCH_MNT}/lowermnt
# real QA test starts here
_supported_fs overlay
_supported_os Linux
-_require_scratch
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
# Remove all files from previous tests
_scratch_mkfs
_overlay_scratch_mount_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir
rm -rf $SCRATCH_MNT/testdir
+# check overlayfs
+_overlay_check_scratch_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir
+
# success, all done
echo "Silence is golden"
status=0
# real QA test starts here
_supported_fs overlay
_supported_os Linux
-_require_scratch
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
# Remove all files from previous tests
_scratch_mkfs
# unmount overlayfs but not base fs
$UMOUNT_PROG $SCRATCH_MNT
+# check overlayfs
+_overlay_check_scratch_dirs $lowerdir1 $lowerdir2 $workdir2
+
# mount overlay again, with lowerdir1 and lowerdir2 as multiple lowerdirs,
# and create a new file in testdir, triggers copyup from lowerdir,
# copyup should not copy overlayfs private xattr
_overlay_scratch_mount_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir
ls $SCRATCH_MNT/testdir
+# check overlayfs
+_overlay_check_scratch_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir
+
# success, all done
status=0
exit
# real QA test starts here
_supported_fs overlay
_supported_os Linux
-_require_scratch
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
_require_chattr i
# Remove all files from previous tests
touch $SCRATCH_MNT/bar 2>&1 | _filter_scratch
_scratch_remount rw 2>&1 | _filter_ro_mount
+# check overlayfs
+_overlay_check_scratch_dirs $lowerdir2 $upperdir $workdir
+
# success, all done
status=0
exit
# real QA test starts here
_supported_fs overlay
_supported_os Linux
-_require_scratch
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
_require_scratch_feature index
# Remove all files from previous tests
_overlay_mount_dirs $lowerdir2 $upperdir2 $workdir \
overlay3 $SCRATCH_MNT -oindex=on 2>&1 | _filter_busy_mount
+# check overlayfs
+_overlay_check_scratch_dirs $lowerdir $upperdir $workdir
# success, all done
status=0
# real QA test starts here
_supported_fs overlay
_supported_os Linux
-_require_scratch
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
_require_scratch_feature index
# Remove all files from previous tests
# Mount overlay with original lowerdir, upperdir, workdir and index=on - expect success
_overlay_scratch_mount_dirs $lowerdir $upperdir $workdir -oindex=on
+# check overlayfs
+_overlay_check_scratch_dirs $lowerdir $upperdir $workdir -oindex=on
+
# success, all done
status=0
exit
# real QA test starts here
_supported_fs overlay
_supported_os Linux
-_require_scratch
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
_require_attrs
_require_test_program "t_dir_type"
_scratch_unmount
+# check overlayfs
+_check_scratch_fs
+
# Verify pure lower residing in dir which has another lower layer
_scratch_mkfs
[[ $subdir_d == "subdir d" ]] || \
echo "Pure lower in dir which has another lower layer: Invalid d_ino reported for subdir"
+# check overlayfs
+_overlay_check_scratch_dirs "$middir:$lowerdir" $upperdir $workdir
+
echo "Silence is golden"
status=0
exit
# real QA test starts here
_supported_fs overlay
_supported_os Linux
-_require_scratch
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
_require_test
_require_attrs
_require_test_program "t_dir_type"
_scratch_unmount
+# check overlayfs
+_overlay_check_scratch_dirs $lowerdir $upperdir $workdir
+
# Verify pure lower residing in dir which has another lower layer
middir=$OVL_BASE_TEST_DIR/$seq-ovl-mid
lowerdir=$OVL_BASE_TEST_DIR/$seq-ovl-lower
[[ $subdir_d == "subdir d" ]] || \
echo "Pure lower in dir which has another lower layer: Invalid d_ino reported for subdir"
+# check overlayfs
+_overlay_check_scratch_dirs "$middir:$lowerdir" $upperdir $workdir
+
echo "Silence is golden"
status=0
exit
# real QA test starts here
_supported_fs overlay
_supported_os Linux
-_require_scratch
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
_require_test
_require_test_program "af_unix"
_require_test_program "t_dir_type"
# Compare inode numbers before/after mount cycle
check_inode_numbers $testdir $tmp.after_move $tmp.after_cycle
+# check overlayfs
+_overlay_check_scratch_dirs $lowerdir $upperdir $workdir
+
echo "Silence is golden"
status=0
exit
# real QA test starts here
_supported_fs overlay
_supported_os Linux
-_require_scratch
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
_require_test
_require_scratch_feature index
_require_test_program "t_dir_type"
# Verify that the hardlinks survive a mount cycle
$UMOUNT_PROG $SCRATCH_MNT
+_overlay_check_scratch_dirs $lowerdir $upperdir $workdir -o index=on
_overlay_scratch_mount_dirs $lowerdir $upperdir $workdir -o index=on
echo "== After mount cycle =="
cat $FILES
check_ino_nlink $SCRATCH_MNT $tmp.after_one $tmp.after_two
+# check overlayfs
+_overlay_check_scratch_dirs $lowerdir $upperdir $workdir -o index=on
+
status=0
exit
_supported_fs overlay
_supported_os Linux
_require_test
-_require_scratch
_require_test_program "open_by_handle"
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
# We need to require both features together, because nfs_export cannot
# be enabled when index is disabled
_require_scratch_overlay_features index nfs_export
-o "index=on,nfs_export=on"
}
-# Unmount the overlay without unmounting base fs
+# Unmount the overlay without unmounting base fs and check the
+# underlying dirs
unmount_dirs()
{
$UMOUNT_PROG $SCRATCH_MNT
+
+ _overlay_check_scratch_dirs $middle:$lower $upper $work \
+ -o "index=on,nfs_export=on"
}
# Check non-stale file handles of lower/upper files and verify
_supported_fs overlay
_supported_os Linux
_require_test
-_require_scratch
_require_test_program "open_by_handle"
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
# We need to require all features together, because nfs_export cannot
# be enabled when index is disabled
_require_scratch_overlay_features index nfs_export redirect_dir
-o "index=on,nfs_export=on,redirect_dir=on"
}
-# Unmount the overlay without unmounting base fs
+# Unmount the overlay without unmounting base fs and check the
+# underlying dirs
unmount_dirs()
{
$UMOUNT_PROG $SCRATCH_MNT
+
+ _overlay_check_scratch_dirs $middle:$lower $upper $work \
+ -o "index=on,nfs_export=on,redirect_dir=on"
}
# Check non-stale file handles of lower/upper moved files
_supported_fs overlay
_supported_os Linux
_require_test
-_require_scratch
_require_test_program "open_by_handle"
+# Use non-default scratch underlying overlay dirs, we need to check
+# them explicity after test.
+_require_scratch_nocheck
# We need to require all features together, because nfs_export cannot
# be enabled when index is disabled
_require_scratch_overlay_features index nfs_export redirect_dir
-o "index=on,nfs_export=on,redirect_dir=on"
}
-# Unmount the overlay without unmounting base fs
+# Unmount the overlay without unmounting base fs and check the
+# underlying dirs
unmount_dirs()
{
$UMOUNT_PROG $SCRATCH_MNT
+
+ _overlay_check_scratch_dirs $middle:$lower $upper $work \
+ -o "index=on,nfs_export=on,redirect_dir=on"
}
# Check file handles of dir with ancestor under lower redirect