btrfs/012: check free size of scratch device before copying files
[xfstests-dev.git] / tests / overlay / 025
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 025
6 #
7 # Overlayfs failed to get posix acls if lower or upper
8 # fs is tmpfs.
9 # Kernel commit below fixed it.
10 # 5201dc449e4b ovl: use cached acl on underlying layer
11 #
12 # This reproducer was originally written by
13 #     Miklos Szeredi <mszeredi@redhat.com>
14 #
15 seq=`basename $0`
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
18
19 here=`pwd`
20 tmp=/tmp/$$
21 status=1        # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
23
24 _cleanup()
25 {
26         cd /
27         $UMOUNT_PROG $tmpfsdir/mnt
28         $UMOUNT_PROG $tmpfsdir
29         rm -rf $tmpfsdir
30         rm -f $tmp.*
31 }
32
33 # get standard environment, filters and checks
34 . ./common/rc
35 . ./common/filter
36
37 # remove previous $seqres.full before test
38 rm -f $seqres.full
39
40 # real QA test starts here
41
42 # Modify as appropriate.
43 _supported_fs overlay
44 _require_user
45 _require_extra_fs tmpfs
46
47 # create a tmpfs in $TEST_DIR
48 tmpfsdir=$TEST_DIR/tmpfs
49 mkdir -p $tmpfsdir
50 $MOUNT_PROG -t tmpfs tmpfs $tmpfsdir
51
52 mkdir -p $tmpfsdir/{lower,upper,work,mnt}
53 mkdir -p -m 0 $tmpfsdir/upper/testd
54 # grant permission for $qa_user
55 setfacl -m u:$qa_user:rx $tmpfsdir/upper/testd
56
57 # mount overlay using dirs in tmpfs
58 _overlay_mount_dirs $tmpfsdir/{lower,upper,work,overlay,mnt}
59
60 # user accessing test dir, should be OKay
61 _user_do "ls $tmpfsdir/mnt/testd"
62
63 echo "Silence is golden"
64 # success, all done
65 status=0
66 exit