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
43 _require_xfs_quota_foreign
52 if [ "$qname" = "user" ];then
54 echo "=== user quota test ==="
55 elif [ "$qname" = "group" ];then
57 echo "=== group quota test ==="
59 echo "wrong quota type name - $qname"
63 $XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
64 $XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
65 echo "$qname blocks and inode limit"
66 $XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
68 ## blocks default quota test ##
69 _user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
71 rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
73 ## inode default quota test ##
74 for ((i=0; i<30; i++));do
75 _user_do "echo -n > ${SCRATCH_MNT}/file${i}"
79 rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
82 ### user default quota test ###
83 _scratch_mkfs >/dev/null 2>&1
84 _qmount_option "usrquota,grpquota"
89 ### group default quota test ###
91 _scratch_mkfs >/dev/null 2>&1
92 _qmount_option "grpquota,usrquota"