xfs: convert tests to SPDX license tags
[xfstests-dev.git] / tests / xfs / 131
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 131
6 #
7 # Ensure that we can't reflink realtime files.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     umount $SCRATCH_MNT > /dev/null 2>&1
22     rm -rf $tmp.* $testdir $metadump_file
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28 . ./common/reflink
29
30 # real QA test starts here
31 _supported_os Linux
32 _supported_fs xfs
33 _require_realtime
34 _require_scratch_reflink
35 _require_cp_reflink
36
37 rm -f $seqres.full
38
39 echo "Format and mount scratch device"
40 _scratch_mkfs >> $seqres.full
41 _scratch_mount
42
43 testdir=$SCRATCH_MNT/test-$seq
44 mkdir $testdir
45
46 echo "Create the original file blocks"
47 blksz=65536
48 $XFS_IO_PROG -R -f -c "truncate $blksz" $testdir/file1
49
50 echo "Reflink every block"
51 _cp_reflink $testdir/file1 $testdir/file2 2>&1 | _filter_scratch
52
53 test -s $testdir/file2 && _fail "Should not be able to reflink a realtime file."
54
55 # success, all done
56 status=0
57 exit