2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2017 CTERA Networks. All Rights Reserved.
7 # Test mount error cases with option index=on
9 # - Upper/lower mismatch
10 # - Index/upper mismatch
12 # With index=on, lowerdir and upperdir are verified using a file handle
13 # stored in trusted.overlay.origin xattr in upperdir and indexdir.
15 # Failure to verify lowerdir/upperdir on mount results in ESTALE.
18 _begin_fstest auto quick mount
20 # Import common functions.
23 # real QA test starts here
25 # Use non-default scratch underlying overlay dirs, we need to check
26 # them explicity after test.
27 _require_scratch_nocheck
28 _require_scratch_feature index
30 # Remove all files from previous tests
33 # Create multiple lowerdirs, upperdirs and workdir
34 lowerdir=$OVL_BASE_SCRATCH_MNT/lower
35 lowerdir2=$OVL_BASE_SCRATCH_MNT/lower2
36 upperdir=$OVL_BASE_SCRATCH_MNT/upper
37 upperdir2=$OVL_BASE_SCRATCH_MNT/upper2
38 workdir=$OVL_BASE_SCRATCH_MNT/workdir
39 mkdir -p $lowerdir $lowerdir2 $upperdir $upperdir2 $workdir
41 # Mount overlay with lowerdir, upperdir, workdir and index=on
42 # to store the file handles of lowerdir and upperdir in overlay.origin xattr
43 _overlay_scratch_mount_dirs $lowerdir $upperdir $workdir -oindex=on
44 $UMOUNT_PROG $SCRATCH_MNT
46 # Try to mount an overlay with the same upperdir and different lowerdir - expect ESTALE
47 _overlay_scratch_mount_dirs $lowerdir2 $upperdir $workdir -oindex=on \
48 2>&1 | _filter_error_mount
49 $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
51 # Try to mount an overlay with the same workdir and different upperdir - expect ESTALE
52 _overlay_scratch_mount_dirs $lowerdir $upperdir2 $workdir -oindex=on \
53 2>&1 | _filter_error_mount
54 $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
56 # Mount overlay with original lowerdir, upperdir, workdir and index=on - expect success
57 _overlay_scratch_mount_dirs $lowerdir $upperdir $workdir -oindex=on
60 _overlay_check_scratch_dirs $lowerdir $upperdir $workdir -oindex=on