2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
7 # When default quota is set, all different quota types inherits the
8 # same default value, include group quota. So if a user quota limit
9 # larger than the default user quota value, it will still be limited
10 # by the group default quota value.
12 # There's a patch from Upstream can fix this bug:
14 # [PATCH] xfs: Split default quota limits by quota type V4
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
22 status=1 # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
31 # get standard environment, filters and checks
36 # remove previous $seqres.full before test
39 # real QA test starts here
44 _require_xfs_quota_foreign
53 if [ "$qname" = "user" ];then
55 echo "=== user quota test ==="
56 elif [ "$qname" = "group" ];then
58 echo "=== group quota test ==="
60 echo "wrong quota type name - $qname"
64 $XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
65 $XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
66 echo "$qname blocks and inode limit"
67 $XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
69 ## blocks default quota test ##
70 _user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
72 rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
74 ## inode default quota test ##
75 for ((i=0; i<30; i++));do
76 _user_do "echo -n > ${SCRATCH_MNT}/file${i}"
80 rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
83 ### user default quota test ###
84 _scratch_mkfs >/dev/null 2>&1
85 _qmount_option "usrquota,grpquota"
90 ### group default quota test ###
92 _scratch_mkfs >/dev/null 2>&1
93 _qmount_option "grpquota,usrquota"