4 # When default quota is set, all different quota types inherits the
5 # same default value, include group quota. So if a user quota limit
6 # larger than the default user quota value, it will still be limited
7 # by the group default quota value.
9 # There's a patch from Upstream can fix this bug:
11 # [PATCH] xfs: Split default quota limits by quota type V4
13 #-----------------------------------------------------------------------
14 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License as
18 # published by the Free Software Foundation.
20 # This program is distributed in the hope that it would be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write the Free Software Foundation,
27 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #-----------------------------------------------------------------------
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
37 status=1 # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
46 # get standard environment, filters and checks
51 # remove previous $seqres.full before test
54 # real QA test starts here
67 if [ "$qname" = "user" ];then
69 echo "=== user quota test ==="
70 elif [ "$qname" = "group" ];then
72 echo "=== group quota test ==="
74 echo "wrong quota type name - $qname"
78 $XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
79 $XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
80 echo "$qname blocks and inode limit"
81 $XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | _filter_spaces
83 ## blocks default quota test ##
84 _user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
85 echo "$qname blocks quota after write 30M data"
86 $XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | _filter_spaces
88 rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
90 ## inode default quota test ##
91 for ((i=0; i<30; i++));do
92 _user_do "echo -n > ${SCRATCH_MNT}/file${i}"
96 echo "$qname inode quota after create 300 inodes"
97 $XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | _filter_spaces
99 rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
102 ### user default quota test ###
103 _scratch_mkfs_xfs >/dev/null 2>&1
104 _qmount_option "uquota,gquota"
109 ### group default quota test ###
111 _scratch_mkfs_xfs >/dev/null 2>&1
112 _qmount_option "gquota,uquota"