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
39 _require_attrs trusted
41 # Remove all files from previous tests
44 # Create test dir on upper and make it opaque by setting proper xattr
45 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
46 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
47 mkdir -p $lowerdir/testdir
48 mkdir -p $upperdir/testdir
49 $SETFATTR_PROG -n "trusted.overlay.opaque" -v "y" $upperdir/testdir
51 # mount overlay with multiple lowerdirs, with $lowerdir as the lowest dir and
52 # $upperdir overlaid on top of $lowerdir, so that "trusted.overlay.opaque"
53 # xattr should be honored and should not be listed
54 # mount readonly, because there's no upper and workdir
55 $MOUNT_PROG -t overlay -o ro -o lowerdir=$upperdir:$lowerdir $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
57 # Dump trusted.overlay xattr, we should not see the "opaque" xattr
58 _getfattr -d -m overlay $SCRATCH_MNT/testdir
59 echo "Silence is golden"