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 seqres=$RESULT_DIR/$seq
19 echo "QA output created by $seq"
23 status=1 # failure is the default!
24 trap "_cleanup; exit \$status" 0 1 2 3 15
32 # get standard environment, filters and checks
36 # remove previous $seqres.full before test
39 # real QA test starts here
42 # Use non-default scratch underlying overlay dirs, we need to check
43 # them explicity after test.
44 _require_scratch_nocheck
45 _require_scratch_feature index
47 # Remove all files from previous tests
50 # Create multiple lowerdirs, upperdirs and workdir
51 lowerdir=$OVL_BASE_SCRATCH_MNT/lower
52 lowerdir2=$OVL_BASE_SCRATCH_MNT/lower2
53 upperdir=$OVL_BASE_SCRATCH_MNT/upper
54 upperdir2=$OVL_BASE_SCRATCH_MNT/upper2
55 workdir=$OVL_BASE_SCRATCH_MNT/workdir
56 mkdir -p $lowerdir $lowerdir2 $upperdir $upperdir2 $workdir
58 # Mount overlay with lowerdir, upperdir, workdir and index=on
59 # to store the file handles of lowerdir and upperdir in overlay.origin xattr
60 _overlay_scratch_mount_dirs $lowerdir $upperdir $workdir -oindex=on
61 $UMOUNT_PROG $SCRATCH_MNT
63 # Try to mount an overlay with the same upperdir and different lowerdir - expect ESTALE
64 _overlay_scratch_mount_dirs $lowerdir2 $upperdir $workdir -oindex=on \
65 2>&1 | _filter_error_mount
66 $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
68 # Try to mount an overlay with the same workdir and different upperdir - expect ESTALE
69 _overlay_scratch_mount_dirs $lowerdir $upperdir2 $workdir -oindex=on \
70 2>&1 | _filter_error_mount
71 $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
73 # Mount overlay with original lowerdir, upperdir, workdir and index=on - expect success
74 _overlay_scratch_mount_dirs $lowerdir $upperdir $workdir -oindex=on
77 _overlay_check_scratch_dirs $lowerdir $upperdir $workdir -oindex=on