Add three additional quota tests - 106/107/108.

Merge of master-melb:xfs-cmds:22775a by kenmcd.
This commit is contained in:
Nathan Scott
2005-06-02 06:02:53 +00:00
parent f5a18fe143
commit e52c143e3c
8 changed files with 2518 additions and 3 deletions
Executable
+217
View File
@@ -0,0 +1,217 @@
#! /bin/sh
# FS QA Test No. 106
#
# Exercise basic xfs_quota functionality (user/group/project quota)
#
#-----------------------------------------------------------------------
# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like. Any license provided herein, whether implied or
# otherwise, applies only to this software file. Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston MA 02111-1307, USA.
#
# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
# Mountain View, CA 94043, or:
#
# http://www.sgi.com
#
# For further information regarding this notice, see:
#
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
#-----------------------------------------------------------------------
#
# creator
owner=nathans@sgi.com
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.quota
_supported_fs xfs
_supported_os Linux #IRIX
_require_scratch
_require_quota
# real QA test starts here
_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
cat $tmp.mkfs >>$seq.full
. $tmp.mkfs
# setup a default run
[ -z "$MOUNT_OPTIONS" ] && export MOUNT_OPTIONS="-o uquota"
# initial populate
_qmount
target=$SCRATCH_MNT/target
ltp/fsstress -s 0xdeed -m8 -w -p4 -n1000 $FSSTRESS_AVOID -d $target
ltp/fsstress -s 0xdeed -m8 -z -p4 -n1000 -fchproj=500 -fchown=500 -d $target
# also use space, to be able to go over/under limits easily
uid=255
gid=254
prid=253
rm -f $SCRATCH_MNT/resv
xfs_io -fc "resvsp 0 200m" -c "chproj $prid" $SCRATCH_MNT/resv
chown $uid $SCRATCH_MNT/resv
chgrp $gid $SCRATCH_MNT/resv
_qmount
filter_xfs_quota()
{
perl -ne "
s,$SCRATCH_MNT,[SCR_MNT],;
s,$SCRATCH_DEV,[SCR_DEV],;
s/Inode: \#\d+ \(0 blocks, 0 extents\)/Inode: #[INO] (0 blocks, 0 extents)/;
s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
print;"
}
test_quot()
{
echo "checking quot command (type=$type)" # not deterministic on blks
xfs_quota -x -c "quot -n -$type" $SCRATCH_MNT >>$seq.full 2>&1
}
test_report()
{
echo "checking report command (type=$type)"
xfs_quota -x -c "report -h -$type -U 256" $SCRATCH_MNT
}
test_limit1()
{
echo "checking limit command, pass 1 (type=$type)"
xfs_quota -x -c "limit -$type bsoft=100m bhard=100m ihard=2 $id" \
$SCRATCH_MNT
xfs_quota -x -c "limit -$type isoft=1 rtbsoft=100m rtbhard=110m $id"\
$SCRATCH_MNT
sleep 2 # let the timer day transition happen
xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
#xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
}
test_limit2()
{
# push limits up high, so that timers are cleared, etc. (for later)
echo "checking limit command, pass2 (type=$type)"
xfs_quota -x -c "limit -$type bsoft=300m bhard=400m ihard=8800 $id" \
$SCRATCH_MNT
xfs_quota -x -c "limit -$type isoft=8000 rtbsoft=310m rtbhard=410m $id"\
$SCRATCH_MNT
xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
#xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
}
test_warn()
{
echo "checking warn command (type=$type)"
xfs_quota -x -c "warn -$type -b 4 $id" $SCRATCH_MNT
xfs_quota -x -c "warn -$type -i 3 $id" $SCRATCH_MNT
#xfs_quota -x -c "warn -$type -r 2 $id" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
#xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
}
test_timer()
{
echo "checking timer command (type=$type)"
xfs_quota -x -c "timer -$type -b 3days" $SCRATCH_MNT
xfs_quota -x -c "timer -$type -i 2days" $SCRATCH_MNT
#xfs_quota -x -c "timer -$type -r 1day" $SCRATCH_MNT
}
test_state()
{
echo "checking state command (type=$type)"
xfs_quota -x -c "state -$type" $SCRATCH_MNT
# not yet working properly?
#echo "checking disable command (type=$type)"
#xfs_quota -x -c "disable -$type -v" $SCRATCH_MNT
#echo "checking enable command (type=$type)"
#xfs_quota -x -c "enable -$type -v" $SCRATCH_MNT
#echo "checking off command (type=$type)"
#xfs_quota -x -c "off -$type -v" $SCRATCH_MNT
#echo "checking remove command (type=$type)"
#xfs_quota -x -c "remove -$type -v" $SCRATCH_MNT
}
test_backup()
{
echo "checking dump command (type=$type)"
rm -f $tmp.backup
xfs_quota -x -c "dump -$type -f $tmp.backup -U 256" $SCRATCH_MNT
cat $tmp.backup
echo "changing limits (type=$type)"
xfs_quota -x -c "limit -$type isoft=1000 ihard=1100 $id" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
echo "checking restore command (type=$type)"
xfs_quota -x -c "restore -$type -f $tmp.backup" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
rm -f $tmp.backup
}
test_xfs_quota()
{
test_quot ; echo
test_report ; echo
test_timer ; echo
test_limit1 ; echo
test_warn ; echo
test_limit2 ; echo
test_backup ; echo
test_state ; echo
echo ; echo
}
# real QA test starts here
export MOUNT_OPTIONS="-ouquota"
_qmount
type=u
id=$uid
test_xfs_quota | filter_xfs_quota
export MOUNT_OPTIONS="-ogquota"
_qmount
type=g
id=$gid
test_xfs_quota | filter_xfs_quota
export MOUNT_OPTIONS="-opquota"
_qmount
type=p
id=$prid
test_xfs_quota | filter_xfs_quota
umount $SCRATCH_DEV
status=0
exit
+379
View File
@@ -0,0 +1,379 @@
QA output created by 106
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
naming =VERN bsize=XXX
log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
checking quot command (type=u)
checking report command (type=u)
User quota on [SCR_MNT] ([SCR_DEV])
Blocks
User ID Used Soft Hard Warn/Grace
---------- ---------------------------------
#0 84.4M 0 0 00 [------]
#1 5.5M 0 0 00 [------]
#2 1.2M 0 0 00 [------]
#3 1.2M 0 0 00 [------]
#4 2.3M 0 0 00 [------]
#5 1004K 0 0 00 [------]
#6 2.1M 0 0 00 [------]
#7 1.0M 0 0 00 [------]
#8 0 0 0 00 [------]
#9 0 0 0 00 [------]
#10 0 0 0 00 [------]
#11 0 0 0 00 [------]
#12 8K 0 0 00 [------]
#13 228K 0 0 00 [------]
#14 0 0 0 00 [------]
#15 696K 0 0 00 [------]
#16 0 0 0 00 [------]
#17 300K 0 0 00 [------]
#18 0 0 0 00 [------]
#20 40K 0 0 00 [------]
#22 256K 0 0 00 [------]
#23 128K 0 0 00 [------]
#24 1.9M 0 0 00 [------]
#25 0 0 0 00 [------]
#26 176K 0 0 00 [------]
#27 0 0 0 00 [------]
#28 0 0 0 00 [------]
#29 0 0 0 00 [------]
#31 616K 0 0 00 [------]
#32 0 0 0 00 [------]
#35 128K 0 0 00 [------]
#37 0 0 0 00 [------]
#38 100K 0 0 00 [------]
#40 0 0 0 00 [------]
#42 412K 0 0 00 [------]
#44 0 0 0 00 [------]
#48 0 0 0 00 [------]
#50 0 0 0 00 [------]
#53 288K 0 0 00 [------]
#54 0 0 0 00 [------]
#55 0 0 0 00 [------]
#56 400K 0 0 00 [------]
#58 0 0 0 00 [------]
#61 0 0 0 00 [------]
#63 528K 0 0 00 [------]
#69 0 0 0 00 [------]
#70 1.2M 0 0 00 [------]
#72 32K 0 0 00 [------]
#75 248K 0 0 00 [------]
#76 0 0 0 00 [------]
#77 0 0 0 00 [------]
#78 632K 0 0 00 [------]
#83 296K 0 0 00 [------]
#89 0 0 0 00 [------]
#91 4K 0 0 00 [------]
#95 0 0 0 00 [------]
#96 0 0 0 00 [------]
#105 0 0 0 00 [------]
#113 0 0 0 00 [------]
#118 0 0 0 00 [------]
#127 0 0 0 00 [------]
#255 200M 0 0 00 [------]
checking timer command (type=u)
checking limit command, pass 1 (type=u)
Disk quotas for User #255 (255)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 200M 100M 100M 00 [-none-] [SCR_MNT]
Disk quotas for User #255 (255)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 1 1 2 00 [1 day] [SCR_MNT]
checking warn command (type=u)
Disk quotas for User #255 (255)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 200M 100M 100M 04 [-none-] [SCR_MNT]
Disk quotas for User #255 (255)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 1 1 2 03 [1 day] [SCR_MNT]
checking limit command, pass2 (type=u)
Disk quotas for User #255 (255)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 200M 300M 400M 00 [------] [SCR_MNT]
Disk quotas for User #255 (255)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 1 8k 8.8k 03 [------] [SCR_MNT]
checking dump command (type=u)
fs = [SCR_DEV]
255 614400 819200 8000 8800 634880 839680
changing limits (type=u)
Disk quotas for User #255 (255)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 1 1000 1.1k 00 [------] [SCR_MNT]
checking restore command (type=u)
Disk quotas for User #255 (255)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 1 8k 8.8k 00 [------] [SCR_MNT]
checking state command (type=u)
User quota state on [SCR_MNT] ([SCR_DEV])
Accounting: ON
Enforcement: ON
Inode: #[INO] (X blocks, Y extents)
Blocks grace time: [3 days]
Inodes grace time: [2 days]
Realtime Blocks grace time: [7 days]
checking quot command (type=g)
checking report command (type=g)
Group quota on [SCR_MNT] ([SCR_DEV])
Blocks
Group ID Used Soft Hard Warn/Grace
---------- ---------------------------------
#0 85.0M 0 0 00 [------]
#1 6.1M 0 0 00 [------]
#2 676K 0 0 00 [------]
#3 1.9M 0 0 00 [------]
#4 604K 0 0 00 [------]
#5 224K 0 0 00 [------]
#6 504K 0 0 00 [------]
#7 4K 0 0 00 [------]
#8 400K 0 0 00 [------]
#9 0 0 0 00 [------]
#10 56K 0 0 00 [------]
#11 2.6M 0 0 00 [------]
#12 892K 0 0 00 [------]
#13 0 0 0 00 [------]
#14 0 0 0 00 [------]
#15 0 0 0 00 [------]
#17 0 0 0 00 [------]
#20 0 0 0 00 [------]
#21 616K 0 0 00 [------]
#22 0 0 0 00 [------]
#23 472K 0 0 00 [------]
#24 0 0 0 00 [------]
#25 36K 0 0 00 [------]
#26 1.1M 0 0 00 [------]
#27 128K 0 0 00 [------]
#28 0 0 0 00 [------]
#30 248K 0 0 00 [------]
#31 1.0M 0 0 00 [------]
#33 0 0 0 00 [------]
#34 0 0 0 00 [------]
#35 0 0 0 00 [------]
#36 0 0 0 00 [------]
#37 0 0 0 00 [------]
#38 240K 0 0 00 [------]
#41 412K 0 0 00 [------]
#43 32K 0 0 00 [------]
#44 0 0 0 00 [------]
#45 0 0 0 00 [------]
#46 0 0 0 00 [------]
#49 0 0 0 00 [------]
#51 124K 0 0 00 [------]
#53 0 0 0 00 [------]
#55 0 0 0 00 [------]
#56 176K 0 0 00 [------]
#57 288K 0 0 00 [------]
#58 528K 0 0 00 [------]
#59 0 0 0 00 [------]
#67 4K 0 0 00 [------]
#69 624K 0 0 00 [------]
#70 0 0 0 00 [------]
#71 0 0 0 00 [------]
#72 632K 0 0 00 [------]
#73 0 0 0 00 [------]
#75 0 0 0 00 [------]
#79 100K 0 0 00 [------]
#87 1.2M 0 0 00 [------]
#88 0 0 0 00 [------]
#91 0 0 0 00 [------]
#94 4K 0 0 00 [------]
#99 248K 0 0 00 [------]
#101 0 0 0 00 [------]
#108 0 0 0 00 [------]
#112 64K 0 0 00 [------]
#115 296K 0 0 00 [------]
#121 0 0 0 00 [------]
#127 0 0 0 00 [------]
#254 200M 0 0 00 [------]
checking timer command (type=g)
checking limit command, pass 1 (type=g)
Disk quotas for Group #254 (254)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 200M 100M 100M 00 [-none-] [SCR_MNT]
Disk quotas for Group #254 (254)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 1 1 2 00 [1 day] [SCR_MNT]
checking warn command (type=g)
Disk quotas for Group #254 (254)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 200M 100M 100M 04 [-none-] [SCR_MNT]
Disk quotas for Group #254 (254)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 1 1 2 03 [1 day] [SCR_MNT]
checking limit command, pass2 (type=g)
Disk quotas for Group #254 (254)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 200M 300M 400M 00 [------] [SCR_MNT]
Disk quotas for Group #254 (254)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 1 8k 8.8k 03 [------] [SCR_MNT]
checking dump command (type=g)
fs = [SCR_DEV]
254 614400 819200 8000 8800 634880 839680
changing limits (type=g)
Disk quotas for Group #254 (254)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 1 1000 1.1k 00 [------] [SCR_MNT]
checking restore command (type=g)
Disk quotas for Group #254 (254)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 1 8k 8.8k 00 [------] [SCR_MNT]
checking state command (type=g)
Group quota state on [SCR_MNT] ([SCR_DEV])
Accounting: ON
Enforcement: ON
Inode: #[INO] (X blocks, Y extents)
Blocks grace time: [3 days]
Inodes grace time: [2 days]
Realtime Blocks grace time: [7 days]
checking quot command (type=p)
checking report command (type=p)
Project quota on [SCR_MNT] ([SCR_DEV])
Blocks
Project ID Used Soft Hard Warn/Grace
---------- ---------------------------------
#0 85.0M 0 0 00 [------]
#1 6.1M 0 0 00 [------]
#2 676K 0 0 00 [------]
#3 1.9M 0 0 00 [------]
#4 604K 0 0 00 [------]
#5 224K 0 0 00 [------]
#6 504K 0 0 00 [------]
#7 4K 0 0 00 [------]
#8 400K 0 0 00 [------]
#9 0 0 0 00 [------]
#10 56K 0 0 00 [------]
#11 2.6M 0 0 00 [------]
#12 892K 0 0 00 [------]
#13 0 0 0 00 [------]
#14 0 0 0 00 [------]
#15 0 0 0 00 [------]
#17 0 0 0 00 [------]
#20 0 0 0 00 [------]
#21 616K 0 0 00 [------]
#22 0 0 0 00 [------]
#23 472K 0 0 00 [------]
#24 0 0 0 00 [------]
#25 36K 0 0 00 [------]
#26 1.1M 0 0 00 [------]
#27 128K 0 0 00 [------]
#28 0 0 0 00 [------]
#30 248K 0 0 00 [------]
#31 1.0M 0 0 00 [------]
#33 0 0 0 00 [------]
#34 0 0 0 00 [------]
#35 0 0 0 00 [------]
#36 0 0 0 00 [------]
#37 0 0 0 00 [------]
#38 240K 0 0 00 [------]
#41 412K 0 0 00 [------]
#43 32K 0 0 00 [------]
#44 0 0 0 00 [------]
#45 0 0 0 00 [------]
#46 0 0 0 00 [------]
#49 0 0 0 00 [------]
#51 124K 0 0 00 [------]
#53 0 0 0 00 [------]
#55 0 0 0 00 [------]
#56 176K 0 0 00 [------]
#57 288K 0 0 00 [------]
#58 528K 0 0 00 [------]
#59 0 0 0 00 [------]
#67 4K 0 0 00 [------]
#69 624K 0 0 00 [------]
#70 0 0 0 00 [------]
#71 0 0 0 00 [------]
#72 632K 0 0 00 [------]
#73 0 0 0 00 [------]
#75 0 0 0 00 [------]
#79 100K 0 0 00 [------]
#87 1.2M 0 0 00 [------]
#88 0 0 0 00 [------]
#91 0 0 0 00 [------]
#94 4K 0 0 00 [------]
#99 248K 0 0 00 [------]
#101 0 0 0 00 [------]
#108 0 0 0 00 [------]
#112 64K 0 0 00 [------]
#115 296K 0 0 00 [------]
#121 0 0 0 00 [------]
#127 0 0 0 00 [------]
#254 200M 300M 400M 00 [------]
checking timer command (type=p)
checking limit command, pass 1 (type=p)
Disk quotas for Project #253 (253)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 0 100M 100M 00 [------] [SCR_MNT]
Disk quotas for Project #253 (253)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 0 1 2 00 [------] [SCR_MNT]
checking warn command (type=p)
Disk quotas for Project #253 (253)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 0 100M 100M 00 [------] [SCR_MNT]
Disk quotas for Project #253 (253)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 0 1 2 00 [------] [SCR_MNT]
checking limit command, pass2 (type=p)
Disk quotas for Project #253 (253)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 0 300M 400M 00 [------] [SCR_MNT]
Disk quotas for Project #253 (253)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 0 8k 8.8k 00 [------] [SCR_MNT]
checking dump command (type=p)
fs = [SCR_DEV]
253 614400 819200 8000 8800 634880 839680
fs = [SCR_DEV]
254 614400 819200 8000 8800 634880 839680
changing limits (type=p)
Disk quotas for Project #253 (253)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 0 1000 1.1k 00 [------] [SCR_MNT]
checking restore command (type=p)
Disk quotas for Project #253 (253)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 0 8k 8.8k 00 [------] [SCR_MNT]
checking state command (type=p)
Project quota state on [SCR_MNT] ([SCR_DEV])
Accounting: ON
Enforcement: ON
Inode: #[INO] (X blocks, Y extents)
Blocks grace time: [3 days]
Inodes grace time: [2 days]
Realtime Blocks grace time: [7 days]
Executable
+137
View File
@@ -0,0 +1,137 @@
#! /bin/sh
# FS QA Test No. 107
#
# Project quota
#
#-----------------------------------------------------------------------
# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like. Any license provided herein, whether implied or
# otherwise, applies only to this software file. Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston MA 02111-1307, USA.
#
# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
# Mountain View, CA 94043, or:
#
# http://www.sgi.com
#
# For further information regarding this notice, see:
#
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
#-----------------------------------------------------------------------
#
# creator
owner=nathans@sgi.com
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.quota
filter_xfs_quota()
{
perl -ne "
s,$target,[TARGET],;
s,$tmp.projects,[PROJECTS_FILE],;
s,$SCRATCH_MNT,[SCR_MNT],;
s,$SCRATCH_DEV,[SCR_DEV],;
s/Inode: \#\d+ \(0 blocks, 0 extents\)/Inode: #[INO] (0 blocks, 0 extents)/;
s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
print;"
}
_supported_fs xfs
_supported_os Linux #IRIX
_require_scratch
_require_quota
# real QA test starts here
_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
cat $tmp.mkfs >$seq.full
. $tmp.mkfs
# setup a default run
[ -z "$MOUNT_OPTIONS" ] && export MOUNT_OPTIONS="-o pquota"
_qmount
src/feature -p $SCRATCH_MNT && _notrun "Cannot run without project quota"
echo "### create projects file"
rm -f $tmp.projects
target=$SCRATCH_MNT/project
echo "6:$target" | tee -a $seq.full > $tmp.projects
echo "### populate filesystem"
mkdir $target || exit
FSSTRESS_AVOID="$FSSTRESS_AVOID -fmknod=0 -fsymlink=0"
ltp/fsstress -s 0xfeed -m8 -w -p4 -n1000 $FSSTRESS_AVOID -d $target
ltp/fsstress -s 0xbabe -m8 -z -p4 -n500 -fchproj=250 -fchown=250 -d $target
QARGS="-x -D $tmp.projects -P /dev/null $SCRATCH_MNT"
echo "### initial report"
xfs_quota -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
echo "### check the project, should give warnings"
xfs_quota -c 'project -c 6' $QARGS | filter_xfs_quota
echo "### recursively setup the project"
xfs_quota -c 'project -s 6' $QARGS | filter_xfs_quota
xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
echo "### check the project, should give no warnings now"
xfs_quota -c 'project -c 6' $QARGS | filter_xfs_quota
echo "### deny a hard link - wrong project ID"
rm -f $SCRATCH_MNT/outer $target/inner
xfs_io -f -c 'chproj 789' $SCRATCH_MNT/outer
ln $SCRATCH_MNT/outer $target/inner 2>/dev/null
if [ $? -eq 0 ]; then
echo hard link succeeded
ls -ld $SCRATCH_MNT/outer $target/inner
else
echo hard link failed
fi
xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
echo "### allow a hard link - right project ID"
xfs_io -c 'chproj 6' $SCRATCH_MNT/outer
ln $SCRATCH_MNT/outer $target/inner
if [ $? -eq 0 ]; then
echo hard link succeeded
else
echo hard link failed
ls -ld $SCRATCH_MNT/outer $target/inner
fi
xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
echo "### recursively clear the project"
xfs_quota -c 'project -C 6' $QARGS | filter_xfs_quota
#no output...
xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
status=0
exit
+1550
View File
File diff suppressed because it is too large Load Diff
Executable
+143
View File
@@ -0,0 +1,143 @@
#! /bin/sh
# FS QA Test No. 108
#
# Simple quota accounting test for direct/buffered/mmap IO.
#
#-----------------------------------------------------------------------
# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like. Any license provided herein, whether implied or
# otherwise, applies only to this software file. Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston MA 02111-1307, USA.
#
# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
# Mountain View, CA 94043, or:
#
# http://www.sgi.com
#
# For further information regarding this notice, see:
#
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
#-----------------------------------------------------------------------
#
# creator
owner=nathans@sgi.com
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.quota
filter_scratch()
{
perl -ne "
s,$SCRATCH_MNT,[SCR_MNT],;
s,$SCRATCH_DEV,[SCR_DEV],;
print;"
}
# real QA test starts here
_supported_fs xfs
_supported_os Linux #IRIX
_require_scratch
_require_quota
test_files()
{
echo; echo "### create files, setting up ownership (type=$type)"
rm -f $SCRATCH_MNT/{buffer,direct,mmap}
xfs_io -fc "chproj $prid" $SCRATCH_MNT/{buffer,direct,mmap}
chown $uid $SCRATCH_MNT/{buffer,direct,mmap}
chgrp $gid $SCRATCH_MNT/{buffer,direct,mmap}
for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
$here/src/lstat64 $file | head -3 | filter_scratch
xfs_io -c lsproj $file
done
}
test_accounting()
{
echo "### some controlled buffered, direct and mmapd IO (type=$type)"
echo "--- initiating parallel IO..." >>$seq.full
xfs_io -c 'pwrite -b 1m 0 16m' -c 'fsync' \
$SCRATCH_MNT/buffer >>$seq.full 2>&1 &
xfs_io -c 'pwrite -b 1m 0 16m' -d \
$SCRATCH_MNT/direct >>$seq.full 2>&1 &
xfs_io -c 't 16m' -c 'mm -rw 0 16m' -c 'mw 0 16m' -c 'ms -s' \
$SCRATCH_MNT/mmap >>$seq.full 2>&1 &
wait
echo "--- completed parallel IO ($type)" >>$seq.full
for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
$here/src/lstat64 $file | head -3 | filter_scratch
done
xfs_quota -c "quota -hnb -$type $id" $QARGS | filter_scratch
xfs_quota -c "quota -hni -$type $id" $QARGS | filter_scratch
xfs_quota -c "quota -hnr -$type $id" $QARGS | filter_scratch
}
# real QA test starts here
rm -f $tmp.projects $seq.full
umount $SCRATCH_DEV 2>/dev/null
_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
cat $tmp.mkfs >>$seq.full
_scratch_mount
uid=1
gid=2
prid=3
export QARGS="-x -D /dev/null -P /dev/null $SCRATCH_MNT"
umount $SCRATCH_DEV
echo; echo "### test user accounting"
export MOUNT_OPTIONS="-ouquota"
_qmount
type=u
id=$uid
test_files
test_accounting
umount $SCRATCH_DEV 2>/dev/null
echo; echo "### test group accounting"
export MOUNT_OPTIONS="-ogquota"
_qmount
type=g
id=$gid
test_files
test_accounting
umount $SCRATCH_DEV 2>/dev/null
#echo; echo "### test project accounting"
export MOUNT_OPTIONS="-opquota"
_qmount
type=p
id=$prid
#test_files
#test_accounting
umount $SCRATCH_DEV 2>/dev/null
status=0
exit
+71
View File
@@ -0,0 +1,71 @@
QA output created by 108
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
naming =VERN bsize=XXX
log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
### test user accounting
### create files, setting up ownership (type=u)
File: "[SCR_MNT]/buffer"
Size: 0 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
projid = 3
File: "[SCR_MNT]/direct"
Size: 0 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
projid = 3
File: "[SCR_MNT]/mmap"
Size: 0 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
projid = 3
### some controlled buffered, direct and mmapd IO (type=u)
File: "[SCR_MNT]/buffer"
Size: 16777216 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
File: "[SCR_MNT]/direct"
Size: 16777216 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
File: "[SCR_MNT]/mmap"
Size: 16777216 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
Disk quotas for User #1 (1)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 48M 0 0 00 [------] [SCR_MNT]
Disk quotas for User #1 (1)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 3 0 0 00 [------] [SCR_MNT]
### test group accounting
### create files, setting up ownership (type=g)
File: "[SCR_MNT]/buffer"
Size: 0 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
projid = 3
File: "[SCR_MNT]/direct"
Size: 0 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
projid = 3
File: "[SCR_MNT]/mmap"
Size: 0 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
projid = 3
### some controlled buffered, direct and mmapd IO (type=g)
File: "[SCR_MNT]/buffer"
Size: 16777216 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
File: "[SCR_MNT]/direct"
Size: 16777216 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
File: "[SCR_MNT]/mmap"
Size: 16777216 Filetype: Regular File
Mode: (0600/-rw-------) Uid: (1) Gid: (2)
Disk quotas for Group #2 (2)
Filesystem Blocks Quota Limit Warn/Time Mounted on
[SCR_DEV] 48M 0 0 00 [------] [SCR_MNT]
Disk quotas for Group #2 (2)
Filesystem Files Quota Limit Warn/Time Mounted on
[SCR_DEV] 3 0 0 00 [------] [SCR_MNT]
+18 -3
View File
@@ -41,8 +41,7 @@ _require_quota()
{
src/feature -q $TEST_DEV
[ $? -ne 0 ] && _notrun "Installed kernel does not support XFS quota"
[ -x /usr/etc/quotaon -o -x /sbin/quotaon -o -x /usr/sbin/quotaon ] || \
_notrun "Quota user tools not installed"
[ -x /usr/sbin/xfs_quota ] || _notrun "Quota user tools not installed"
}
# create a file as a specific user (uid)
@@ -89,6 +88,16 @@ _choose_gid()
/etc/group
}
_choose_prid()
{
if [ ! -f /etc/projid ]; then
echo 0
return
fi
perl -ne '@a = split(/:/); END { printf "id=%d name=%s\n", $a[1],$a[0] }' \
/etc/projid
}
#
# filter to get the guts out
# and make linux and irix similar
@@ -122,7 +131,6 @@ _qmount()
umount $SCRATCH_DEV >/dev/null 2>&1
_scratch_mount || _fail "qmount failed"
chmod ugo+rwx $SCRATCH_MNT
[ -x /usr/sbin/quot ] && quot $SCRATCH_MNT >>$seq.full 2>&1
}
_qsetup()
@@ -135,6 +143,9 @@ _qsetup()
elif src/feature -g $SCRATCH_DEV
then
type=g ; eval `_choose_gid`; ln -s $seq.grpquota $seq.out
elif src/feature -p $SCRATCH_DEV
then
type=p ; eval `_choose_prid`; ln -s $seq.prjquota $seq.out
elif src/feature -U $SCRATCH_DEV
then
type=u ; eval `_choose_uid`; ln -s $seq.uqnoenforce $seq.out
@@ -143,6 +154,10 @@ _qsetup()
then
type=g ; eval `_choose_gid`; ln -s $seq.gqnoenforce $seq.out
enforce=0
elif src/feature -P $SCRATCH_DEV
then
type=p ; eval `_choose_prid`; ln -s $seq.pqnoenforce $seq.out
enforce=0
else
_notrun "No quota support at mount time"
fi
+3
View File
@@ -182,6 +182,9 @@ aio nathans@sgi.com
103 metadata dir ioctl auto
104 growfs ioctl
105 acl auto
106 quota auto
107 quota auto
108 quota auto
112 rw aio auto
113 rw aio
114 parent attr auto