5 # Exercises basic XFS quota functionality
6 # MOUNT_OPTIONS env var switches the test type (uid/gid/acct/enfd)
7 # options are: (-o) usrquota, grpquota, uqnoenforce, gqnoenforce
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
13 # This program is free software; you can redistribute it and/or modify it
14 # under the terms of version 2 of the GNU General Public License as
15 # published by the Free Software Foundation.
17 # This program is distributed in the hope that it would be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 # Further, this software is distributed without any warranty that it is
22 # free of the rightful claim of any third person regarding infringement
23 # or the like. Any license provided herein, whether implied or
24 # otherwise, applies only to this software file. Patent licenses, if
25 # any, provided herein do not apply to combinations of this program with
26 # other software, or any other product whatsoever.
28 # You should have received a copy of the GNU General Public License along
29 # with this program; if not, write the Free Software Foundation, Inc., 59
30 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
32 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
33 # Mountain View, CA 94043, or:
37 # For further information regarding this notice, see:
39 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
40 #-----------------------------------------------------------------------
46 echo "QA output created by $seq"
50 status=1 # failure is the default!
52 # get standard environment, filters and checks
59 echo; echo "*** unmount"
60 umount $SCRATCH_MNT 2>/dev/null
63 trap "_cleanup; exit \$status" 0 1 2 3 15
64 rm -f $seq.full $seq.out
70 if [ -z "$MOUNT_OPTIONS" ]; then
71 MOUNT_OPTIONS="-o usrquota"; export MOUNT_OPTIONS
74 # real QA test starts here
75 mkfs -t xfs -f $SCRATCH_DEV | _filter_mkfs 2>$tmp.mkfs
76 cat $tmp.mkfs >>$seq.full
77 chmod a+w $seq.full # arbitrary users will write here
79 # keep the blocksize and data size for dd later
84 # setup exactly what it is we'll be testing
85 if src/feature -u $SCRATCH_DEV
87 type=u ; id=`_choose_uid`; ln $seq.usrquota $seq.out
88 elif src/feature -g $SCRATCH_DEV
90 type=g ; id=`_choose_gid`; ln $seq.grpquota $seq.out
91 elif src/feature -U $SCRATCH_DEV
93 type=u ; id=`_choose_uid`; ln $seq.uqnoenforce $seq.out
94 elif src/feature -G $SCRATCH_DEV
96 type=g ; id=`_choose_gid`; ln $seq.gqnoenforce $seq.out
98 _notrun "No quota support at mount time"
101 echo "Using output from '" `ls -l $seq.out` "'" >>$seq.full
102 echo "and using type=$type id=$id" >>$seq.full
105 echo "*** report no quota settings" | tee -a $seq.full
106 repquota -m -$type $SCRATCH_DEV | _filter_repquota
109 echo "*** report initial settings" | tee -a $seq.full
110 setquota -n -$type $id $SCRATCH_DEV 100 500 4 10
111 _file_as_id $SCRATCH_MNT/initme $id $type $dbsize 0
112 repquota -m -$type $SCRATCH_DEV | _filter_repquota
115 echo "*** push past the soft inode limit" | tee -a $seq.full
116 _file_as_id $SCRATCH_MNT/softie1 $id $type $dbsize 0
117 _file_as_id $SCRATCH_MNT/softie2 $id $type $dbsize 0
119 repquota -m -$type $SCRATCH_DEV | _filter_repquota
122 echo "*** push past the soft block limit" | tee -a $seq.full
123 _file_as_id $SCRATCH_MNT/softie $id $type $dbsize 140
125 repquota -m -$type $SCRATCH_DEV | _filter_repquota
128 echo "*** push past the hard inode limit (expect EDQUOT)" | tee -a $seq.full
129 for i in 1 2 3 4 5 6 7 8 9 10 11 12
131 _file_as_id $SCRATCH_MNT/hard$i $id $type $dbsize 0
134 repquota -m -$type $SCRATCH_DEV | _filter_repquota
137 echo "*** push past the hard block limit (expect EDQUOT)" | tee -a $seq.full
138 _file_as_id $SCRATCH_MNT/softie $id $type $dbsize 540
140 repquota -m -$type $SCRATCH_DEV | _filter_repquota