4 # Exercise basic xfs_quota functionality (user/group/project quota)
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or modify it
10 # under the terms of version 2 of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 # Further, this software is distributed without any warranty that it is
18 # free of the rightful claim of any third person regarding infringement
19 # or the like. Any license provided herein, whether implied or
20 # otherwise, applies only to this software file. Patent licenses, if
21 # any, provided herein do not apply to combinations of this program with
22 # other software, or any other product whatsoever.
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write the Free Software Foundation, Inc., 59
26 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
28 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
29 # Mountain View, CA 94043, or:
33 # For further information regarding this notice, see:
35 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 #-----------------------------------------------------------------------
42 echo "QA output created by $seq"
46 status=1 # failure is the default!
47 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
49 # get standard environment, filters and checks
55 _supported_os Linux #IRIX
59 # real QA test starts here
60 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
61 cat $tmp.mkfs >$seq.full
65 [ -z "$MOUNT_OPTIONS" ] && export MOUNT_OPTIONS="-o uquota"
69 target=$SCRATCH_MNT/target
70 ltp/fsstress -s 0xdeed -m8 -w -p4 -n1000 $FSSTRESS_AVOID -d $target
71 ltp/fsstress -s 0xdeed -m8 -z -p4 -n1000 -fchproj=500 -fchown=500 -d $target
73 # also use space, to be able to go over/under limits easily
77 rm -f $SCRATCH_MNT/resv
78 $XFS_IO_PROG -fc "resvsp 0 200m" -c "chproj $prid" $SCRATCH_MNT/resv
79 chown $uid $SCRATCH_MNT/resv
80 chgrp $gid $SCRATCH_MNT/resv
87 s,$SCRATCH_MNT,[SCR_MNT],;
88 s,$SCRATCH_DEV,[SCR_DEV],;
89 s/Inode: \#\d+ \(0 blocks, 0 extents\)/Inode: #[INO] (0 blocks, 0 extents)/;
90 s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
96 echo "checking quot command (type=$type)" # not deterministic on blks
97 xfs_quota -x -c "quot -n -$type" $SCRATCH_MNT >>$seq.full 2>&1
102 echo "checking report command (type=$type)"
103 xfs_quota -x -c "report -h -$type -U 256" $SCRATCH_MNT
108 echo "checking limit command, pass 1 (type=$type)"
109 xfs_quota -x -c "limit -$type bsoft=100m bhard=100m ihard=2 $id" \
111 xfs_quota -x -c "limit -$type isoft=1 rtbsoft=100m rtbhard=110m $id"\
113 sleep 2 # let the timer day transition happen
114 xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
115 xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
116 #xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
121 # push limits up high, so that timers are cleared, etc. (for later)
122 echo "checking limit command, pass2 (type=$type)"
123 xfs_quota -x -c "limit -$type bsoft=300m bhard=400m ihard=8800 $id" \
125 xfs_quota -x -c "limit -$type isoft=8000 rtbsoft=310m rtbhard=410m $id"\
127 xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
128 xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
129 #xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
134 echo "checking warn command (type=$type)"
135 xfs_quota -x -c "warn -$type -b 4 $id" $SCRATCH_MNT
136 xfs_quota -x -c "warn -$type -i 3 $id" $SCRATCH_MNT
137 #xfs_quota -x -c "warn -$type -r 2 $id" $SCRATCH_MNT
138 xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
139 xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
140 #xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
145 echo "checking timer command (type=$type)"
146 xfs_quota -x -c "timer -$type -b 3days" $SCRATCH_MNT
147 xfs_quota -x -c "timer -$type -i 2days" $SCRATCH_MNT
148 #xfs_quota -x -c "timer -$type -r 1day" $SCRATCH_MNT
153 echo "checking state command (type=$type)"
154 xfs_quota -x -c "state -$type" $SCRATCH_MNT
155 # not yet working properly?
156 #echo "checking disable command (type=$type)"
157 #xfs_quota -x -c "disable -$type -v" $SCRATCH_MNT
158 #echo "checking enable command (type=$type)"
159 #xfs_quota -x -c "enable -$type -v" $SCRATCH_MNT
160 #echo "checking off command (type=$type)"
161 #xfs_quota -x -c "off -$type -v" $SCRATCH_MNT
162 #echo "checking remove command (type=$type)"
163 #xfs_quota -x -c "remove -$type -v" $SCRATCH_MNT
168 echo "checking dump command (type=$type)"
170 xfs_quota -x -c "dump -$type -f $tmp.backup -U 256" $SCRATCH_MNT
173 echo "changing limits (type=$type)"
174 xfs_quota -x -c "limit -$type isoft=1000 ihard=1100 $id" $SCRATCH_MNT
175 xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
177 echo "checking restore command (type=$type)"
178 xfs_quota -x -c "restore -$type -f $tmp.backup" $SCRATCH_MNT
179 xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
196 # real QA test starts here
197 export MOUNT_OPTIONS="-ouquota"
201 test_xfs_quota | filter_xfs_quota
203 export MOUNT_OPTIONS="-ogquota"
207 test_xfs_quota | filter_xfs_quota
209 export MOUNT_OPTIONS="-opquota"
213 test_xfs_quota | filter_xfs_quota