overlay: run unionmount testsuite test cases
[xfstests-dev.git] / tests / overlay / 011
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test 011
6 #
7 # test overlay private xattr on overlayfs with multiple lower dirs, all the
8 # lower layers except the lowest one should honor overlay private xattr
9 # "trusted.overlay", which means it should not be visible to user.
10 #
11 # Commit b581755b1c56 ("ovl: xattr filter fix") fixed this issue.
12 #
13 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1        # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
21
22 _cleanup()
23 {
24         cd /
25         rm -f $tmp.*
26 }
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31 . ./common/attr
32
33 rm -f $seqres.full
34
35 # real QA test starts here
36 _supported_fs overlay
37 _supported_os Linux
38 _require_test
39 _require_scratch
40 _require_attrs
41
42 # Remove all files from previous tests
43 _scratch_mkfs
44
45 # Create test dir on upper and make it opaque by setting proper xattr
46 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
47 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
48 mkdir -p $lowerdir/testdir
49 mkdir -p $upperdir/testdir
50 $SETFATTR_PROG -n "trusted.overlay.opaque" -v "y" $upperdir/testdir
51
52 # mount overlay with multiple lowerdirs, with $lowerdir as the lowest dir and
53 # $upperdir overlaid on top of $lowerdir, so that "trusted.overlay.opaque"
54 # xattr should be honored and should not be listed
55 # mount readonly, because there's no upper and workdir
56 $MOUNT_PROG -t overlay -o ro -o lowerdir=$upperdir:$lowerdir $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
57
58 # Dump trusted.overlay xattr, we should not see the "opaque" xattr
59 _getfattr -d -m overlay $SCRATCH_MNT/testdir
60 echo "Silence is golden"
61
62 # success, all done
63 status=0
64 exit