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.
35 _require_scratch_reflink
42 du_total="$(du -ksc $SCRATCH_MNT/a $SCRATCH_MNT/b | tail -n 1 | awk '{print $1}')"
43 qu_total="$(_report_quota_blocks "-u $SCRATCH_MNT" | grep $qa_user | awk '{print $2}')"
44 echo "du: $du_total; quota: $qu_total"
47 echo "Format and mount (noquota)"
48 _scratch_mkfs > "$seqres.full" 2>&1
49 _scratch_mount "-o noquota" >> $seqres.full 2>&1
52 _pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
53 _pwrite_byte 0x58 0 1m $SCRATCH_MNT/b >> $seqres.full
54 chown $qa_user $SCRATCH_MNT/a $SCRATCH_MNT/b
55 check_quota 2>&1 | _filter_scratch
57 echo "Mount (usrquota) and check quota"
59 _scratch_mount "-o usrquota,grpquota" >> "$seqres.full" 2>&1
62 echo "Reflink and check quota again"
63 _reflink_range $SCRATCH_MNT/a 256k $SCRATCH_MNT/b 384k 128k >> $seqres.full
64 _reflink_range $SCRATCH_MNT/a 256k $SCRATCH_MNT/b 960k 128k >> $seqres.full
67 echo "Force quotacheck"