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 _begin_fstest auto quick quota
17 # Import common functions.
21 # real QA test starts here
27 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
28 cat $tmp.mkfs >>$seqres.full
30 # keep the blocksize and data size for dd later
37 echo "Using type=$type id=$id" >>$seqres.full
40 echo "*** report initial settings" | tee -a $seqres.full
42 -c "limit -$type isoft=3 ihard=500000 $id" \
43 -c "warn -$type -i -d 13" \
46 -c "state -$type" >> $seqres.full
48 -c "repquota -birnN -$type" $SCRATCH_DEV |
49 _filter_quota_report | LC_COLLATE=POSIX sort -ru
52 echo "*** push past the soft inode limit" | tee -a $seqres.full
53 _file_as_id $SCRATCH_MNT/softok1 $id $type $bsize 0
54 _file_as_id $SCRATCH_MNT/softok2 $id $type $bsize 0
55 _file_as_id $SCRATCH_MNT/softok3 $id $type $bsize 0
56 _file_as_id $SCRATCH_MNT/softwarn1 $id $type $bsize 0
57 $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
58 -c "repquota -birnN -$type" $SCRATCH_DEV |
59 _filter_quota_report | LC_COLLATE=POSIX sort -ru
62 echo "*** push further past the soft inode limit" | tee -a $seqres.full
63 for warn_nr in $(seq 2 5); do
64 _file_as_id $SCRATCH_MNT/softwarn$warn_nr $id $type $bsize 0
66 $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
67 -c "repquota -birnN -$type" $SCRATCH_DEV |
68 _filter_quota_report | LC_COLLATE=POSIX sort -ru
71 echo "*** push past the soft inode warning limit" | tee -a $seqres.full
72 for warn_nr in $(seq 6 15); do
73 _file_as_id $SCRATCH_MNT/softwarn$warn_nr $id $type $bsize 0
75 $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
76 -c "repquota -birnN -$type" $SCRATCH_DEV |
77 _filter_quota_report | LC_COLLATE=POSIX sort -ru
84 _scratch_mkfs > $seqres.full
85 _scratch_mount >> $seqres.full
87 chmod a+rwx $SCRATCH_MNT $seqres.full # arbitrary users will write here
88 bsize=$(_get_file_block_size $SCRATCH_MNT)
91 cat >$tmp.projects <<EOF
95 cat >$tmp.projid <<EOF
100 projid_file="$tmp.projid"
103 _qmount_option "uquota"
107 _qmount_option "gquota"
110 echo "*** uqnoenforce"
111 _qmount_option "uqnoenforce"
114 echo "*** gqnoenforce"
115 _qmount_option "gqnoenforce"
119 _qmount_option "pquota"
122 echo "*** pqnoenforce"
123 _qmount_option "pqnoenforce"