generic/077: fall back to /usr if /lib/modules doesn't exist
[xfstests-dev.git] / tests / xfs / 220
1 #! /bin/bash
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
28 seq=`basename $0`
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 tmp=/tmp/$$
34 status=1        # failure is the default!
35
36 _cleanup()
37 {
38         cd /
39         umount $SCRATCH_DEV >/dev/null 2>&1
40 }
41 trap "_cleanup; exit \$status" 0 1 2 3 15
42
43 # get standard environment, filters and checks
44 . ./common/rc
45 . ./common/filter
46 . ./common/quota
47
48 # real QA test starts here
49 _supported_fs xfs
50 _supported_os Linux
51
52 _require_scratch
53 _require_quota
54
55 echo "Silence is golden."
56
57 # create scratch filesystem
58 _scratch_mkfs_xfs >/dev/null 2>&1
59
60 # mount  with quotas enabled
61 _scratch_mount -o uquota
62
63 # turn off quota
64 xfs_quota -x -c off $SCRATCH_DEV
65
66 # and unmount (this used to crash)
67 umount $SCRATCH_DEV
68
69 # create scratch filesystem
70 _scratch_mkfs_xfs >/dev/null 2>&1
71
72 # mount  with quotas enabled
73 _scratch_mount -o uquota
74
75 # turn off quota and remove space allocated to the quota files
76 # (this used to give wrong ENOSYS returns in 2.6.31)
77 xfs_quota -x -c off -c remove $SCRATCH_DEV
78
79 # and unmount again
80 umount $SCRATCH_DEV
81
82 status=0
83 exit $status