2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2021 Oracle. All Rights Reserved.
7 # Check that quota softlimit warnings work the way they should. This means
8 # that we can disobey the softlimit up to warnlimit times before it turns into
9 # hard(er) enforcement. This is a functional test for quota warnings, but
10 # since the functionality has been broken for decades, this is also a
11 # regression test for commit 4b8628d57b72 ("xfs: actually bump warning counts
12 # when we send warnings").
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
20 status=1 # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
29 # get standard environment, filters and checks
34 # real QA test starts here
42 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
43 cat $tmp.mkfs >>$seqres.full
45 # keep the blocksize and data size for dd later
52 echo "Using type=$type id=$id" >>$seqres.full
55 echo "*** report initial settings" | tee -a $seqres.full
57 -c "limit -$type isoft=3 ihard=500000 $id" \
58 -c "warn -$type -i -d 13" \
61 -c "state -$type" >> $seqres.full
63 -c "repquota -birnN -$type" $SCRATCH_DEV |
64 _filter_quota_report | LC_COLLATE=POSIX sort -ru
67 echo "*** push past the soft inode limit" | tee -a $seqres.full
68 _file_as_id $SCRATCH_MNT/softok1 $id $type $bsize 0
69 _file_as_id $SCRATCH_MNT/softok2 $id $type $bsize 0
70 _file_as_id $SCRATCH_MNT/softok3 $id $type $bsize 0
71 _file_as_id $SCRATCH_MNT/softwarn1 $id $type $bsize 0
72 $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
73 -c "repquota -birnN -$type" $SCRATCH_DEV |
74 _filter_quota_report | LC_COLLATE=POSIX sort -ru
77 echo "*** push further past the soft inode limit" | tee -a $seqres.full
78 for warn_nr in $(seq 2 5); do
79 _file_as_id $SCRATCH_MNT/softwarn$warn_nr $id $type $bsize 0
81 $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
82 -c "repquota -birnN -$type" $SCRATCH_DEV |
83 _filter_quota_report | LC_COLLATE=POSIX sort -ru
86 echo "*** push past the soft inode warning limit" | tee -a $seqres.full
87 for warn_nr in $(seq 6 15); do
88 _file_as_id $SCRATCH_MNT/softwarn$warn_nr $id $type $bsize 0
90 $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
91 -c "repquota -birnN -$type" $SCRATCH_DEV |
92 _filter_quota_report | LC_COLLATE=POSIX sort -ru
99 _scratch_mkfs > $seqres.full
100 _scratch_mount >> $seqres.full
102 chmod a+rwx $SCRATCH_MNT $seqres.full # arbitrary users will write here
103 bsize=$(_get_file_block_size $SCRATCH_MNT)
106 cat >$tmp.projects <<EOF
110 cat >$tmp.projid <<EOF
115 projid_file="$tmp.projid"
118 _qmount_option "uquota"
122 _qmount_option "gquota"
125 echo "*** uqnoenforce"
126 _qmount_option "uqnoenforce"
129 echo "*** gqnoenforce"
130 _qmount_option "gqnoenforce"
134 _qmount_option "pquota"
137 echo "*** pqnoenforce"
138 _qmount_option "pqnoenforce"