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 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
31 # Modify as appropriate.
36 _require_scratch_reflink
43 du_total="$(du -ksc $SCRATCH_MNT/a $SCRATCH_MNT/b | tail -n 1 | awk '{print $1}')"
44 qu_total="$(_report_quota_blocks "-u $SCRATCH_MNT" | grep $qa_user | awk '{print $2}')"
45 echo "du: $du_total; quota: $qu_total"
48 echo "Format and mount (noquota)"
49 _scratch_mkfs > "$seqres.full" 2>&1
50 _scratch_mount "-o noquota" >> $seqres.full 2>&1
53 _pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
54 _pwrite_byte 0x58 0 1m $SCRATCH_MNT/b >> $seqres.full
55 chown $qa_user $SCRATCH_MNT/a $SCRATCH_MNT/b
56 check_quota 2>&1 | _filter_scratch
58 echo "Mount (usrquota) and check quota"
60 _scratch_mount "-o usrquota,grpquota" >> "$seqres.full" 2>&1
63 echo "Reflink and check quota again"
64 _reflink_range $SCRATCH_MNT/a 256k $SCRATCH_MNT/b 384k 128k >> $seqres.full
65 _reflink_range $SCRATCH_MNT/a 256k $SCRATCH_MNT/b 960k 128k >> $seqres.full
68 echo "Force quotacheck"