xfs/007: fix regressions on V4 filesystems
[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 . ./common/preamble
10 _begin_fstest auto quick clone realtime
11
12 # Override the default cleanup function.
13 _cleanup()
14 {
15     cd /
16     umount $SCRATCH_MNT > /dev/null 2>&1
17     rm -rf $tmp.* $testdir $metadump_file
18 }
19
20 # Import common functions.
21 . ./common/filter
22 . ./common/reflink
23
24 # real QA test starts here
25 _supported_fs xfs
26 _require_realtime
27 _require_scratch_reflink
28 _require_cp_reflink
29
30 echo "Format and mount scratch device"
31 _scratch_mkfs >> $seqres.full
32 _scratch_mount
33
34 testdir=$SCRATCH_MNT/test-$seq
35 mkdir $testdir
36
37 echo "Create the original file blocks"
38 blksz=65536
39 $XFS_IO_PROG -R -f -c "truncate $blksz" $testdir/file1
40
41 echo "Reflink every block"
42 _cp_reflink $testdir/file1 $testdir/file2 2>&1 | _filter_scratch
43
44 test -s $testdir/file2 && _fail "Should not be able to reflink a realtime file."
45
46 # success, all done
47 status=0
48 exit