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
65 cp /dev/null $seq.full
66 chmod a+rwx $seq.full # arbitrary users will write here
72 if [ -z "$MOUNT_OPTIONS" ]; then
73 MOUNT_OPTIONS="-o usrquota"; export MOUNT_OPTIONS
76 # real QA test starts here
77 mkfs_xfs -f $SCRATCH_DEV | _filter_mkfs 2>$tmp.mkfs
78 cat $tmp.mkfs >>$seq.full
80 # keep the blocksize and data size for dd later
85 # setup exactly what it is we'll be testing
86 if src/feature -u $SCRATCH_DEV
88 type=u ; eval `_choose_uid`; ln $seq.usrquota $seq.out
89 elif src/feature -g $SCRATCH_DEV
91 type=g ; eval `_choose_gid`; ln $seq.grpquota $seq.out
92 elif src/feature -U $SCRATCH_DEV
94 type=u ; eval `_choose_uid`; ln $seq.uqnoenforce $seq.out
95 elif src/feature -G $SCRATCH_DEV
97 type=g ; eval `_choose_gid`; ln $seq.gqnoenforce $seq.out
99 _notrun "No quota support at mount time"
102 echo "Using output from '" `ls -l $seq.out` "'" >>$seq.full
103 echo "and using type=$type id=$id" >>$seq.full
106 echo "*** report no quota settings" | tee -a $seq.full
107 repquota -$type $SCRATCH_DEV | _filter_repquota
110 echo "*** report initial settings" | tee -a $seq.full
111 _file_as_id $SCRATCH_MNT/initme $id $type 1024 0
112 setquota -$type $id 100 500 4 10 $SCRATCH_DEV
113 repquota -$type $SCRATCH_DEV | _filter_repquota
116 echo "*** push past the soft inode limit" | tee -a $seq.full
117 _file_as_id $SCRATCH_MNT/softie1 $id $type 1024 0
118 _file_as_id $SCRATCH_MNT/softie2 $id $type 1024 0
120 repquota -$type $SCRATCH_DEV | _filter_repquota
123 echo "*** push past the soft block limit" | tee -a $seq.full
124 _file_as_id $SCRATCH_MNT/softie $id $type 1024 140
126 repquota -$type $SCRATCH_DEV | _filter_repquota
129 echo "*** push past the hard inode limit (expect EDQUOT)" | tee -a $seq.full
130 for i in 1 2 3 4 5 6 7 8 9 10 11 12
132 _file_as_id $SCRATCH_MNT/hard$i $id $type 1024 0
135 repquota -$type $SCRATCH_DEV | _filter_repquota
138 echo "*** push past the hard block limit (expect EDQUOT)" | tee -a $seq.full
139 _file_as_id $SCRATCH_MNT/softie $id $type 1024 540
141 repquota -$type $SCRATCH_DEV | _filter_repquota