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
59 _require_xfs_quota_foreign
68 if [ "$qname" = "user" ];then
70 echo "=== user quota test ==="
71 elif [ "$qname" = "group" ];then
73 echo "=== group quota test ==="
75 echo "wrong quota type name - $qname"
79 $XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
80 $XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
81 echo "$qname blocks and inode limit"
82 $XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
84 ## blocks default quota test ##
85 _user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
86 echo "$qname blocks quota after write 30M data"
87 $XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | grep -v ^root | _filter_spaces
89 rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
91 ## inode default quota test ##
92 for ((i=0; i<30; i++));do
93 _user_do "echo -n > ${SCRATCH_MNT}/file${i}"
97 echo "$qname inode quota after creating 30 inodes"
98 $XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | grep -v ^root | _filter_spaces
100 rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
103 ### user default quota test ###
104 _scratch_mkfs >/dev/null 2>&1
105 _qmount_option "usrquota,grpquota"
110 ### group default quota test ###
112 _scratch_mkfs >/dev/null 2>&1
113 _qmount_option "grpquota,usrquota"