overlay/075: fix wrong invocation of t_immutable
[xfstests-dev.git] / tests / overlay / 022
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
4 #
5 # FS QA Test 022
6 #
7 # Regression test for kernel commit:
8 #     76bc8e2 ovl: disallow overlayfs as upperdir
9 #
10 # This reproducer was originally written by
11 #     Miklos Szeredi <mszeredi@redhat.com>
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         $UMOUNT_PROG $tmp/mnt > /dev/null 2>&1
26         rm -rf $tmp
27         rm -f $tmp.*
28 }
29
30 # get standard environment, filters and checks
31 . ./common/rc
32 . ./common/filter
33
34 # remove previous $seqres.full before test
35 rm -f $seqres.full
36
37 # real QA test starts here
38
39 # Modify as appropriate.
40 _supported_fs overlay
41 _require_scratch
42
43 # Remove all files from previous tests
44 _scratch_mkfs
45
46 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
47 mkdir -p $upperdir/upper
48 mkdir -p $upperdir/work
49 # mount overlay with dirs in upper
50 _scratch_mount
51
52 mkdir -p $tmp/{lower,mnt}
53 # mount overlay using upper from another overlay upper
54 # should fail
55 _overlay_mount_dirs $tmp/lower $SCRATCH_MNT/upper \
56   $SCRATCH_MNT/work overlay $tmp/mnt > /dev/null 2>&1
57 if [ $? -ne 0 ] ; then
58         echo "Silence is golden"
59 else
60         echo "Test Fail"
61         echo "Overlay upperdir can't be another overlay upperdir"
62 fi
63
64 # success, all done
65 status=0
66 exit