generic: Verify the inheritance behavior of FS_XFLAG_DAX flag in various combinations
[xfstests-dev.git] / tests / generic / 082
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 082
6 #
7 # Test quota handling on remount ro failure
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f $tmp.*
22 }
23
24 filter_project_quota_line()
25 {
26         grep -v "^project quota on"
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32 . ./common/quota
33
34 # real QA test starts here
35 _supported_fs generic
36 _supported_os Linux
37 _require_test
38 _require_scratch
39 _require_quota
40
41 rm -f $seqres.full
42
43 _scratch_mkfs >>$seqres.full 2>&1
44 _scratch_mount "-o usrquota,grpquota"
45
46 # xfs doesn't need these setups and quotacheck even fails on xfs, so just
47 # redirect the output to $seqres.full for debug purpose and ignore the results,
48 # as we check the quota status later anyway.
49 quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1
50 quotaon $SCRATCH_MNT >>$seqres.full 2>&1
51
52 # first remount ro with a bad option, a failed remount ro should not disable
53 # quota, but currently xfs doesn't fail in this case, the unknown option is
54 # just ignored, but quota is still on. This may change in future, let's
55 # re-consider the case then.
56 _try_scratch_mount "-o remount,ro,nosuchopt" >>$seqres.full 2>&1
57 quotaon -p $SCRATCH_MNT | _filter_scratch | filter_project_quota_line
58 # second remount should succeed, no oops or hang expected
59 _try_scratch_mount "-o remount,ro" || _fail "second remount,ro failed"
60
61 # success, all done
62 status=0
63 exit