mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
777e98ec57
Test generic/382 depends on filesystem allocating exactly 30M of blocks when writing 30M file. This is not true for some filesystems - e.g. for ext2 due to indirect blocks - while leads to false positive failures. In this case, the test is not actually interested in comparing exact usage, rather in verifying the ability to write 30M worth of data. So instead of comparing 'xfs_quota report' output, just depend on detecting error when writing files. Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
101 lines
2.2 KiB
Bash
Executable File
101 lines
2.2 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
|
|
#
|
|
# FS QA Test 382
|
|
#
|
|
# When default quota is set, all different quota types inherits the
|
|
# same default value, include group quota. So if a user quota limit
|
|
# larger than the default user quota value, it will still be limited
|
|
# by the group default quota value.
|
|
#
|
|
# There's a patch from Upstream can fix this bug:
|
|
#
|
|
# [PATCH] xfs: Split default quota limits by quota type V4
|
|
#
|
|
seq=`basename $0`
|
|
seqres=$RESULT_DIR/$seq
|
|
echo "QA output created by $seq"
|
|
|
|
here=`pwd`
|
|
tmp=/tmp/$$
|
|
status=1 # failure is the default!
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
_cleanup()
|
|
{
|
|
cd /
|
|
rm -f $tmp.*
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
. ./common/quota
|
|
|
|
# remove previous $seqres.full before test
|
|
rm -f $seqres.full
|
|
|
|
# real QA test starts here
|
|
_supported_fs generic
|
|
_supported_os Linux
|
|
_require_scratch
|
|
_require_quota
|
|
_require_xfs_quota_foreign
|
|
_require_user
|
|
_require_group
|
|
|
|
do_test()
|
|
{
|
|
local qname=$1
|
|
local type
|
|
|
|
if [ "$qname" = "user" ];then
|
|
type="-u"
|
|
echo "=== user quota test ==="
|
|
elif [ "$qname" = "group" ];then
|
|
type="-g"
|
|
echo "=== group quota test ==="
|
|
else
|
|
echo "wrong quota type name - $qname"
|
|
return 1
|
|
fi
|
|
|
|
$XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
|
|
$XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
|
|
echo "$qname blocks and inode limit"
|
|
$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
|
|
|
|
## blocks default quota test ##
|
|
_user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
|
|
|
|
rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
|
|
|
|
## inode default quota test ##
|
|
for ((i=0; i<30; i++));do
|
|
_user_do "echo -n > ${SCRATCH_MNT}/file${i}"
|
|
done
|
|
sync
|
|
|
|
rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
|
|
}
|
|
|
|
### user default quota test ###
|
|
_scratch_mkfs >/dev/null 2>&1
|
|
_qmount_option "usrquota,grpquota"
|
|
_qmount
|
|
|
|
do_test user
|
|
|
|
### group default quota test ###
|
|
_scratch_unmount
|
|
_scratch_mkfs >/dev/null 2>&1
|
|
_qmount_option "grpquota,usrquota"
|
|
_qmount
|
|
|
|
do_test group
|
|
|
|
# success, all done
|
|
status=0
|
|
exit
|