check we support quotas
[xfstests-dev.git] / 118
1 #! /bin/sh
2 # FS QA Test No. 118
3 #
4 # To test out pv#940675 crash in xfs_trans_brelse + quotas
5 # Without the fix, this will create an ASSERT failure in debug kernels
6 # and crash a non-debug kernel.
7 #
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
10
11 # This program is free software; you can redistribute it and/or modify it
12 # under the terms of version 2 of the GNU General Public License as
13 # published by the Free Software Foundation.
14
15 # This program is distributed in the hope that it would be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
19 # Further, this software is distributed without any warranty that it is
20 # free of the rightful claim of any third person regarding infringement
21 # or the like.  Any license provided herein, whether implied or
22 # otherwise, applies only to this software file.  Patent licenses, if
23 # any, provided herein do not apply to combinations of this program with
24 # other software, or any other product whatsoever.
25
26 # You should have received a copy of the GNU General Public License along
27 # with this program; if not, write the Free Software Foundation, Inc., 59
28 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
29
30 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
31 # Mountain View, CA  94043, or:
32
33 # http://www.sgi.com 
34
35 # For further information regarding this notice, see: 
36
37 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
38 #-----------------------------------------------------------------------
39 #
40 # creator
41 owner=tes@crackle.melbourne.sgi.com
42
43 seq=`basename $0`
44 echo "QA output created by $seq"
45
46 here=`pwd`
47 tmp=/tmp/$$
48 status=1        # failure is the default!
49 trap "_cleanup; exit \$status" 0 1 2 3 15
50
51 _cleanup()
52 {
53     cd /
54     rm -f $tmp.*
55 }
56
57 # get standard environment, filters and checks
58 . ./common.rc
59 . ./common.filter
60 . ./common.quota
61
62 # real QA test starts here
63
64 # Modify as appropriate.
65 _supported_fs xfs
66 _supported_os IRIX Linux
67
68 _require_scratch
69 _require_quota
70
71 _chowning_file()
72 {
73         file=file.chown
74         let start=$1
75         let limit=$2
76         let delta=$3
77
78         cd $SCRATCH_MNT
79         let count=$start
80         while (( count < limit )); do
81             touch $file
82             chown $count.$count $file
83             echo -n "."
84             let count=count+delta
85         done
86         echo ""
87 }
88
89
90 echo "mkfs on scratch"
91 _scratch_mkfs_xfs >$seq.full
92
93 echo "mount with quotas"
94 export MOUNT_OPTIONS="-o uquota"
95 _scratch_mount
96
97 echo "creating quota file with holes"
98 _chowning_file 1000 2000 100
99
100 echo "now fill in the holes"
101 _chowning_file 1000 2000 1
102
103 echo "look at the final file ownership for fun"
104 ls -l $SCRATCH_MNT/* \
105 | $AWK_PROG 'NF > 2 {print $3, $4, $NF}' \
106 | sed "s#$SCRATCH_MNT#SCRATCH_MNT#g"
107
108 # success, all done
109 status=0
110 exit