overlay: rename OVERLAY_LOWER/UPPER/WORK_DIR
[xfstests-dev.git] / tests / overlay / 011
1 #! /bin/bash
2 # FS QA Test 011
3 #
4 # test overlay private xattr on overlayfs with multiple lower dirs, all the
5 # lower layers except the lowest one should honor overlay private xattr
6 # "trusted.overlay", which means it should not be visible to user.
7 #
8 # Commit b581755b1c56 ("ovl: xattr filter fix") fixed this issue.
9 #
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2016 Red Hat Inc.  All Rights Reserved.
12 #
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
16 #
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
25 #-----------------------------------------------------------------------
26 #
27
28 seq=`basename $0`
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 tmp=/tmp/$$
34 status=1        # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
36
37 _cleanup()
38 {
39         cd /
40         rm -f $tmp.*
41 }
42
43 # get standard environment, filters and checks
44 . ./common/rc
45 . ./common/filter
46 . ./common/attr
47
48 rm -f $seqres.full
49
50 # real QA test starts here
51 _supported_fs overlay
52 _supported_os Linux
53 _require_test
54 _require_scratch
55 _require_attrs
56
57 # Remove all files from previous tests
58 _scratch_mkfs
59
60 # Create test dir on upper and make it opaque by setting proper xattr
61 lowerdir=$SCRATCH_DEV/$OVL_LOWER
62 upperdir=$SCRATCH_DEV/$OVL_UPPER
63 mkdir -p $lowerdir/testdir
64 mkdir -p $upperdir/testdir
65 $SETFATTR_PROG -n "trusted.overlay.opaque" -v "y" $upperdir/testdir
66
67 # mount overlay with multiple lowerdirs, with $lowerdir as the lowest dir and
68 # $upperdir overlaid on top of $lowerdir, so that "trusted.overlay.opaque"
69 # xattr should be honored and should not be listed
70 # mount readonly, because there's no upper and workdir
71 $MOUNT_PROG -t overlay -o ro -o lowerdir=$upperdir:$lowerdir none $SCRATCH_MNT
72
73 # Dump trusted.overlay xattr, we should not see the "opaque" xattr
74 $GETFATTR_PROG -d -m overlay $SCRATCH_MNT/testdir
75 echo "Silence is golden"
76
77 # success, all done
78 status=0
79 exit