xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / generic / 327
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 327
6 #
7 # Ensure that we can't go over the hard block limit when reflinking.
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     rm -rf $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27 . ./common/reflink
28 . ./common/quota
29
30 # real QA test starts here
31 _supported_os Linux
32 _require_scratch_reflink
33 _require_cp_reflink
34 _require_xfs_io_command "fiemap"
35 _require_quota
36 _require_nobody
37 _require_user
38
39 rm -f $seqres.full
40
41 echo "Format and mount"
42 _scratch_mkfs > $seqres.full 2>&1
43 export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS"
44 _scratch_mount >> $seqres.full 2>&1
45 quotacheck -u -g $SCRATCH_MNT 2> /dev/null
46 quotaon $SCRATCH_MNT 2> /dev/null
47
48 testdir=$SCRATCH_MNT/test-$seq
49 mkdir $testdir
50
51 sz=1048576
52 echo "Create the original files"
53 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
54 chown $qa_user $testdir/file1
55 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
56 _report_quota_blocks $SCRATCH_MNT
57 _scratch_cycle_mount
58 quotaon $SCRATCH_MNT 2> /dev/null
59
60 echo "Set hard quota to prevent third reflink"
61 setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT
62 _report_quota_blocks $SCRATCH_MNT
63
64 echo "Try to reflink again"
65 touch $testdir/file3
66 chown $qa_user $testdir/file3
67 su $qa_user -c "cp --reflink=always -f $testdir/file1 $testdir/file3" 2>&1 | _filter_scratch
68 _report_quota_blocks $SCRATCH_MNT
69
70 # success, all done
71 status=0
72 exit