Add a test for ENOSPC when fallocating.
[xfstests-dev.git] / 220
1 #! /bin/sh
2 # FS QA Test No. 220
3 #
4 # Test quota off handling.
5 #
6 # Based on bug reports from Utako Kusaka <u-kusaka@wm.jp.nec.com> and
7 # Ryota Yamauchi <r-yamauchi@vf.jp.nec.com>.
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2009 Christoph Hellwig.  All Rights Reserved.
11 #
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
15 #
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24 #
25 #-----------------------------------------------------------------------
26 #
27 # creator
28 owner=hch@lst.de
29
30 seq=`basename $0`
31 echo "QA output created by $seq"
32
33 here=`pwd`
34 tmp=/tmp/$$
35 status=1        # failure is the default!
36
37 _cleanup()
38 {
39         cd /
40         umount $SCRATCH_DEV >/dev/null 2>&1
41 }
42 trap "_cleanup; exit \$status" 0 1 2 3 15
43
44 # get standard environment, filters and checks
45 . ./common.rc
46 . ./common.filter
47 . ./common.quota
48
49 # real QA test starts here
50 _supported_fs xfs
51 _supported_os Linux
52
53 _require_scratch
54 _require_quota
55
56 echo "Silence is golden."
57
58 # create scratch filesystem
59 _scratch_mkfs_xfs >/dev/null 2>&1
60
61 # mount  with quotas enabled
62 _scratch_mount -o uquota
63
64 # turn off quota
65 xfs_quota -x -c off $SCRATCH_DEV
66
67 # and unmount (this used to crash)
68 umount $SCRATCH_DEV
69
70
71 # create scratch filesystem
72 _scratch_mkfs_xfs >/dev/null 2>&1
73
74 # mount  with quotas enabled
75 _scratch_mount -o uquota
76
77 # turn off quota and remove space allocated to the quota files
78 # (this used to give wrong ENOSYS returns in 2.6.31)
79 xfs_quota -x -c off -c remove $SCRATCH_DEV
80
81 # and unmount again
82 umount $SCRATCH_DEV
83
84 status=0
85 exit $status