b2c00d0674bb4c315b9905f6eee1c39afa848cc0
[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
61 # real QA test starts here
62
63 # Modify as appropriate.
64 _supported_fs xfs
65 _supported_os IRIX Linux
66
67 _require_scratch
68
69 _chowning_file()
70 {
71         file=file.chown
72         let start=$1
73         let limit=$2
74         let delta=$3
75
76         cd $SCRATCH_MNT
77         let count=$start
78         while (( count < limit )); do
79             touch $file
80             chown $count.$count $file
81             echo -n "."
82             let count=count+delta
83         done
84         echo ""
85 }
86
87
88 echo "mkfs on scratch"
89 _scratch_mkfs_xfs >$seq.full
90
91 echo "mount with quotas"
92 export MOUNT_OPTIONS="-o uquota"
93 _scratch_mount
94
95 echo "creating quota file with holes"
96 _chowning_file 1000 2000 100
97
98 echo "now fill in the holes"
99 _chowning_file 1000 2000 1
100
101 echo "look at the final file ownership for fun"
102 stat -ug $SCRATCH_MNT/* | sed "s#$SCRATCH_MNT#SCRATCH_MNT#g"
103
104 # success, all done
105 status=0
106 exit