4 # Test mount error cases with option index=on
6 # - Upper/lower mismatch
7 # - Index/upper mismatch
9 # With index=on, lowerdir and upperdir are verified using a file handle
10 # stored in trusted.overlay.origin xattr in upperdir and indexdir.
12 # Failure to verify lowerdir/upperdir on mount results in ESTALE.
14 #-----------------------------------------------------------------------
15 # Copyright (C) 2017 CTERA Networks. All Rights Reserved.
16 # Author: Amir Goldstein <amir73il@gmail.com>
18 # This program is free software; you can redistribute it and/or
19 # modify it under the terms of the GNU General Public License as
20 # published by the Free Software Foundation.
22 # This program is distributed in the hope that it would be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
27 # You should have received a copy of the GNU General Public License
28 # along with this program; if not, write the Free Software Foundation,
29 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #-----------------------------------------------------------------------
34 seqres=$RESULT_DIR/$seq
35 echo "QA output created by $seq"
39 status=1 # failure is the default!
40 trap "_cleanup; exit \$status" 0 1 2 3 15
48 # get standard environment, filters and checks
52 # remove previous $seqres.full before test
55 # real QA test starts here
59 _require_scratch_feature index
61 # Remove all files from previous tests
64 # Create multiple lowerdirs, upperdirs and workdir
65 lowerdir=$OVL_BASE_SCRATCH_MNT/lower
66 lowerdir2=$OVL_BASE_SCRATCH_MNT/lower2
67 upperdir=$OVL_BASE_SCRATCH_MNT/upper
68 upperdir2=$OVL_BASE_SCRATCH_MNT/upper2
69 workdir=$OVL_BASE_SCRATCH_MNT/workdir
70 mkdir -p $lowerdir $lowerdir2 $upperdir $upperdir2 $workdir
72 # Mount overlay with lowerdir, upperdir, workdir and index=on
73 # to store the file handles of lowerdir and upperdir in overlay.origin xattr
74 _overlay_scratch_mount_dirs $lowerdir $upperdir $workdir -oindex=on
75 $UMOUNT_PROG $SCRATCH_MNT
77 # Try to mount an overlay with the same upperdir and different lowerdir - expect ESTALE
78 _overlay_scratch_mount_dirs $lowerdir2 $upperdir $workdir -oindex=on \
79 2>&1 | _filter_scratch
80 $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
82 # Try to mount an overlay with the same workdir and different upperdir - expect ESTALE
83 _overlay_scratch_mount_dirs $lowerdir $upperdir2 $workdir -oindex=on \
84 2>&1 | _filter_scratch
85 $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
87 # Mount overlay with original lowerdir, upperdir, workdir and index=on - expect success
88 _overlay_scratch_mount_dirs $lowerdir $upperdir $workdir -oindex=on