4 # Test quota handling on remount ro failure
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
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.
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.
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 #-----------------------------------------------------------------------
25 seqres=$RESULT_DIR/$seq
26 echo "QA output created by $seq"
30 status=1 # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
39 filter_project_quota_line()
41 grep -v "^project quota on"
44 # get standard environment, filters and checks
49 # real QA test starts here
58 _scratch_mkfs >>$seqres.full 2>&1
59 _scratch_mount "-o usrquota,grpquota"
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
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 _try_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 _try_scratch_mount "-o remount,ro" || _fail "second remount,ro failed"