4 # Exercise basic xfs_quota functionality (user/group/project quota)
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
8 #-----------------------------------------------------------------------
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
21 # get standard environment, filters and checks
27 _supported_os Linux #IRIX
32 # real QA test starts here
33 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
34 cat $tmp.mkfs >$seq.full
38 [ -z "$MOUNT_OPTIONS" ] && export MOUNT_OPTIONS="-o uquota"
42 target=$SCRATCH_MNT/target
43 ltp/fsstress -s 0xdeed -m8 -w -p4 -n1000 $FSSTRESS_AVOID -d $target
44 ltp/fsstress -s 0xdeed -m8 -z -p4 -n1000 -fchproj=500 -fchown=500 -d $target
46 # also use space, to be able to go over/under limits easily
50 rm -f $SCRATCH_MNT/resv
51 $XFS_IO_PROG -fc "resvsp 0 200m" -c "chproj $prid" $SCRATCH_MNT/resv
52 chown $uid $SCRATCH_MNT/resv
53 chgrp $gid $SCRATCH_MNT/resv
60 s,$SCRATCH_MNT,[SCR_MNT],;
61 s,$SCRATCH_DEV,[SCR_DEV],;
62 s/Inode: \#\d+ \(0 blocks, 0 extents\)/Inode: #[INO] (0 blocks, 0 extents)/;
63 s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
69 echo "checking quot command (type=$type)" # not deterministic on blks
70 xfs_quota -x -c "quot -n -$type" $SCRATCH_MNT >>$seq.full 2>&1
75 echo "checking report command (type=$type)"
76 xfs_quota -x -c "report -h -$type -U 256" $SCRATCH_MNT
81 echo "checking limit command, pass 1 (type=$type)"
82 xfs_quota -x -c "limit -$type bsoft=100m bhard=100m ihard=2 $id" \
84 xfs_quota -x -c "limit -$type isoft=1 rtbsoft=100m rtbhard=110m $id"\
86 sleep 2 # let the timer day transition happen
87 xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
88 xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
89 #xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
94 # push limits up high, so that timers are cleared, etc. (for later)
95 echo "checking limit command, pass2 (type=$type)"
96 xfs_quota -x -c "limit -$type bsoft=300m bhard=400m ihard=8800 $id" \
98 xfs_quota -x -c "limit -$type isoft=8000 rtbsoft=310m rtbhard=410m $id"\
100 xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
101 xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
102 #xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
107 echo "checking warn command (type=$type)"
108 xfs_quota -x -c "warn -$type -b 4 $id" $SCRATCH_MNT
109 xfs_quota -x -c "warn -$type -i 3 $id" $SCRATCH_MNT
110 #xfs_quota -x -c "warn -$type -r 2 $id" $SCRATCH_MNT
111 xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
112 xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
113 #xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
118 echo "checking timer command (type=$type)"
119 xfs_quota -x -c "timer -$type -b 3days" $SCRATCH_MNT
120 xfs_quota -x -c "timer -$type -i 2days" $SCRATCH_MNT
121 #xfs_quota -x -c "timer -$type -r 1day" $SCRATCH_MNT
126 echo "checking state command (type=$type)"
127 xfs_quota -x -c "state -$type" $SCRATCH_MNT
128 # not yet working properly?
129 #echo "checking disable command (type=$type)"
130 #xfs_quota -x -c "disable -$type -v" $SCRATCH_MNT
131 #echo "checking enable command (type=$type)"
132 #xfs_quota -x -c "enable -$type -v" $SCRATCH_MNT
133 #echo "checking off command (type=$type)"
134 #xfs_quota -x -c "off -$type -v" $SCRATCH_MNT
135 #echo "checking remove command (type=$type)"
136 #xfs_quota -x -c "remove -$type -v" $SCRATCH_MNT
141 echo "checking dump command (type=$type)"
143 xfs_quota -x -c "dump -$type -f $tmp.backup -U 256" $SCRATCH_MNT
146 echo "changing limits (type=$type)"
147 xfs_quota -x -c "limit -$type isoft=1000 ihard=1100 $id" $SCRATCH_MNT
148 xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
150 echo "checking restore command (type=$type)"
151 xfs_quota -x -c "restore -$type -f $tmp.backup" $SCRATCH_MNT
152 xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
169 # real QA test starts here
170 export MOUNT_OPTIONS="-ouquota"
174 test_xfs_quota | filter_xfs_quota
176 export MOUNT_OPTIONS="-ogquota"
180 test_xfs_quota | filter_xfs_quota
182 export MOUNT_OPTIONS="-opquota"
186 test_xfs_quota | filter_xfs_quota