2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
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.
11 # Commit b581755b1c56 ("ovl: xattr filter fix") fixed this issue.
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
28 # get standard environment, filters and checks
35 # real QA test starts here
40 _require_attrs trusted
42 # Remove all files from previous tests
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
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
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"