Add GPL license plate to SGI's test files.
[xfstests-dev.git] / 083
1 #! /bin/sh
2 #
3 #-----------------------------------------------------------------------
4 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation.
9 #
10 # This program is distributed in the hope that it would be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write the Free Software Foundation,
17 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 #
19 #-----------------------------------------------------------------------
20 #
21 # FS QA Test No. 083
22 #
23 # Exercise filesystem full behaviour - run numerous fsstress
24 # processes in write mode on a small filesystem.  NB: delayed
25 # allocate flushing is quite deadlock prone at the filesystem
26 # full boundary due to the fact that we will retry allocation
27 # several times after flushing, before giving back ENOSPC.
28 #
29 # Note that this test will intentionally cause console msgs of form:
30 #     dksc0d1s4: Process [fsstress] ran out of disk space
31 #     dksc0d1s4: Process [fsstress] ran out of disk space
32 #     dksc0d1s4: Process [fsstress] ran out of disk space
33 #
34
35 # creator
36 owner=nathans@sgi.com
37
38 seq=`basename $0`
39 echo "QA output created by $seq"
40
41 here=`pwd`
42 tmp=/tmp/$$
43 status=1
44
45 _cleanup()
46 {
47         echo "*** unmount"
48         umount $SCRATCH_MNT 2>/dev/null
49         rm -f $tmp.*
50 }
51 trap "_cleanup; exit \$status" 0 1 2 3 15
52
53 # get standard environment, filters and checks
54 . ./common.rc
55 . ./common.filter
56
57 # real QA test starts here
58 _supported_fs xfs
59 _supported_os IRIX Linux
60
61 _require_scratch
62 _require_nobigloopfs
63
64 rm -f $seq.full
65
66 workout()
67 {
68         fsz=$1
69         ags=$2
70         procs=$3
71         nops=$4
72
73         umount $SCRATCH_DEV >/dev/null 2>&1
74         echo "*** mkfs -dsize=$fsz,agcount=$ags"    >>$seq.full
75         echo ""                                     >>$seq.full
76         _scratch_mkfs_xfs -dsize=$fsz,agcount=$ags  >>$seq.full 2>&1 \
77                 || _fail "size=$fsz,agcount=$ags mkfs failed"
78         _scratch_mount                              >>$seq.full 2>&1 \
79                 || _fail "mount failed"
80
81         # -w ensures that the only ops are ones which cause write I/O
82         $FSSTRESS_PROG -d $SCRATCH_MNT -w -p $procs -n $nops $FSSTRESS_AVOID \
83                 >>$seq.full
84         _check_scratch_fs
85 }
86
87 echo "*** test out-of-space handling for random write operations"
88
89 filesize=100m
90 agcount=6
91 numprocs=15
92 numops=1500
93
94 workout $filesize $agcount $numprocs $numops
95
96 echo "*** done"
97 status=0
98 exit