2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # Ensure that we can't go over the hard block limit when reflinking.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
30 # real QA test starts here
31 _require_scratch_reflink
33 _require_xfs_io_command "fiemap"
40 echo "Format and mount"
41 _scratch_mkfs > $seqres.full 2>&1
42 export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS"
43 _scratch_mount >> $seqres.full 2>&1
44 quotacheck -u -g $SCRATCH_MNT 2> /dev/null
45 quotaon $SCRATCH_MNT 2> /dev/null
47 testdir=$SCRATCH_MNT/test-$seq
51 echo "Create the original files"
52 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
53 chown $qa_user $testdir/file1
54 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
55 _report_quota_blocks $SCRATCH_MNT
57 quotaon $SCRATCH_MNT 2> /dev/null
59 echo "Set hard quota to prevent third reflink"
60 setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT
61 _report_quota_blocks $SCRATCH_MNT
63 echo "Try to reflink again"
65 chown $qa_user $testdir/file3
66 su $qa_user -c "cp --reflink=always -f $testdir/file1 $testdir/file3" 2>&1 | _filter_scratch
67 _report_quota_blocks $SCRATCH_MNT