2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc. All Rights Reserved.
7 # Regression test for a quota accounting bug when reflinking across EOF
8 # of a file in which we forgot dq_attach.
11 _begin_fstest auto quick clone quota
13 # Import common functions.
18 # Modify as appropriate.
22 _require_scratch_reflink
27 du_total="$(du -ksc $SCRATCH_MNT/a $SCRATCH_MNT/b | tail -n 1 | awk '{print $1}')"
28 qu_total="$(_report_quota_blocks "-u $SCRATCH_MNT" | grep $qa_user | awk '{print $2}')"
29 echo "du: $du_total; quota: $qu_total"
32 echo "Format and mount (noquota)"
33 _scratch_mkfs > "$seqres.full" 2>&1
34 _scratch_mount "-o noquota" >> $seqres.full 2>&1
37 _pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
38 _pwrite_byte 0x58 0 1m $SCRATCH_MNT/b >> $seqres.full
39 chown $qa_user $SCRATCH_MNT/a $SCRATCH_MNT/b
40 check_quota 2>&1 | _filter_scratch
42 echo "Mount (usrquota) and check quota"
44 _scratch_mount "-o usrquota,grpquota" >> "$seqres.full" 2>&1
47 echo "Reflink and check quota again"
48 _reflink_range $SCRATCH_MNT/a 256k $SCRATCH_MNT/b 384k 128k >> $seqres.full
49 _reflink_range $SCRATCH_MNT/a 256k $SCRATCH_MNT/b 960k 128k >> $seqres.full
52 echo "Force quotacheck"