generic: test for creating duplicate filenames in encrypted dir
[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 _require_test
37 _require_scratch
38 _require_quota
39
40 rm -f $seqres.full
41
42 _scratch_mkfs >>$seqres.full 2>&1
43 _scratch_mount "-o usrquota,grpquota"
44
45 # xfs doesn't need these setups and quotacheck even fails on xfs, so just
46 # redirect the output to $seqres.full for debug purpose and ignore the results,
47 # as we check the quota status later anyway.
48 quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1
49 quotaon $SCRATCH_MNT >>$seqres.full 2>&1
50
51 # first remount ro with a bad option, a failed remount ro should not disable
52 # quota, but currently xfs doesn't fail in this case, the unknown option is
53 # just ignored, but quota is still on. This may change in future, let's
54 # re-consider the case then.
55 _try_scratch_mount "-o remount,ro,nosuchopt" >>$seqres.full 2>&1
56 quotaon -p $SCRATCH_MNT | _filter_scratch | filter_project_quota_line
57 # second remount should succeed, no oops or hang expected
58 _try_scratch_mount "-o remount,ro" || _fail "second remount,ro failed"
59
60 # success, all done
61 status=0
62 exit