4 # Test copy-up of lowerdir with opaque xattr set.
6 # When copying up a directory with opaque xattr set, the xattr was copied up as
7 # well, after a remount the opaque flag is honored so the copied-up directory
8 # is treated as opaque, which causes files created in the lowerdir to be hidden
9 # when using multiple lower directories.
11 # This is fixed by "ovl: don't copy up opaqueness".
13 #-----------------------------------------------------------------------
14 # Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License as
18 # published by the Free Software Foundation.
20 # This program is distributed in the hope that it would be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write the Free Software Foundation,
27 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #-----------------------------------------------------------------------
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
37 status=1 # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
46 # get standard environment, filters and checks
51 # remove previous $seqres.full before test
54 # real QA test starts here
60 # Remove all files from previous tests
63 # Create multiple lowerdirs and upperdir, workdir, and testdir on lowerdir
64 lowerdir1=$SCRATCH_DEV/lower1
65 lowerdir2=$SCRATCH_DEV/lower2
66 upperdir=$SCRATCH_DEV/upper
67 workdir=$SCRATCH_DEV/workdir
68 mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
69 mkdir -p $lowerdir1/testdir/d
71 # mount overlay with $lowerdir2 as upperdir, and remove & recreate testdir,
72 # make testdir on $lowerdir2 opaque
73 _overlay_mount_dirs $lowerdir1 $lowerdir2 $workdir $SCRATCH_DEV $SCRATCH_MNT
74 rm -rf $SCRATCH_MNT/testdir
75 mkdir -p $SCRATCH_MNT/testdir/visibledir
78 # mount overlay again, with lowerdir1 and lowerdir2 as multiple lowerdirs,
79 # and create a new file in testdir, triggers copyup from lowerdir,
80 # copyup should not copy overlayfs private xattr
81 _overlay_mount_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir \
82 $SCRATCH_DEV $SCRATCH_MNT
83 touch $SCRATCH_MNT/testdir/visiblefile
85 # umount and mount overlay again, buggy kernel treats the copied-up dir as
86 # opaque, visibledir is not seen in merged dir.
88 _overlay_mount_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir \
89 $SCRATCH_DEV $SCRATCH_MNT
90 ls $SCRATCH_MNT/testdir