btrfs/012: check free size of scratch device before copying files
[xfstests-dev.git] / tests / overlay / 024
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 024
6 #
7 # "work" directory under workdir should be cleaned up
8 # well on overlayfs startup, or overlayfs will be mounted
9 # read-only.
10 # Kernel commit below fixes it.
11 # eea2fb4851e9 ovl: proper cleanup of workdir
12 #
13 # This reproducer was originally written by
14 #     Miklos Szeredi <mszeredi@redhat.com>
15 #
16 seq=`basename $0`
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
19
20 here=`pwd`
21 tmp=/tmp/$$
22 status=1        # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
24
25 _cleanup()
26 {
27         cd /
28         rm -f $tmp.*
29 }
30
31 # get standard environment, filters and checks
32 . ./common/rc
33 . ./common/filter
34
35 # remove previous $seqres.full before test
36 rm -f $seqres.full
37
38 # real QA test starts here
39
40 # Modify as appropriate.
41 _supported_fs overlay
42 _require_scratch
43
44 # Remove all files from previous tests
45 _scratch_mkfs
46
47 # making workdir
48 wkdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
49 mkdir -p $wkdir/work/foo
50
51 _scratch_mount
52
53 # try writing to mountpoint
54 touch $SCRATCH_MNT/bar
55
56 # checking work dir is clean
57 if [ -e $wkdir/work/foo ] ; then
58         echo "work dir is not clean"
59 else
60         echo "Silence is golden"
61 fi
62 # success, all done
63 status=0
64 exit