generic/405: test mkfs against thin provision device
[xfstests-dev.git] / tests / generic / 082
1 #! /bin/bash
2 # FS QA Test No. 082
3 #
4 # Test quota handling on remount ro failure
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2015 Red Hat Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #-----------------------------------------------------------------------
22 #
23
24 seq=`basename $0`
25 seqres=$RESULT_DIR/$seq
26 echo "QA output created by $seq"
27
28 here=`pwd`
29 tmp=/tmp/$$
30 status=1        # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
32
33 _cleanup()
34 {
35         cd /
36         rm -f $tmp.*
37 }
38
39 filter_project_quota_line()
40 {
41         grep -v "^project quota on"
42 }
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 generic
51 _supported_os Linux
52 _require_test
53 _require_scratch
54 _require_quota
55
56 rm -f $seqres.full
57
58 _scratch_mkfs >>$seqres.full 2>&1
59 _scratch_mount "-o usrquota,grpquota"
60
61 # xfs doesn't need these setups and quotacheck even fails on xfs, so just
62 # redirect the output to $seqres.full for debug purpose and ignore the results,
63 # as we check the quota status later anyway.
64 quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1
65 quotaon $SCRATCH_MNT >>$seqres.full 2>&1
66
67 # first remount ro with a bad option, a failed remount ro should not disable
68 # quota, but currently xfs doesn't fail in this case, the unknown option is
69 # just ignored, but quota is still on. This may change in future, let's
70 # re-consider the case then.
71 _scratch_mount "-o remount,ro,nosuchopt" >>$seqres.full 2>&1
72 quotaon -p $SCRATCH_MNT | _filter_scratch | filter_project_quota_line
73 # second remount should succeed, no oops or hang expected
74 _scratch_mount "-o remount,ro" || _fail "second remount,ro failed"
75
76 # success, all done
77 status=0
78 exit