generic: shutdown fs after log recovery
[xfstests-dev.git] / tests / generic / 235
1 #! /bin/bash
2 # FS QA Test No. 235
3 #
4 # Test whether quota gets properly reenabled after remount read-write
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2010 Jan Kara.  All Rights Reserved.
8 #
9 # Based on test 219,
10 # Copyright (c) 2005 Silicon Graphics, Inc.  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 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
36
37 # get standard environment, filters and checks
38 . ./common/rc
39 . ./common/filter
40 . ./common/quota
41
42 # real QA test starts here
43 _supported_fs generic
44 _supported_os Linux #IRIX
45 _require_scratch
46 _require_quota
47 _require_user
48
49 do_repquota()
50 {
51         repquota -u -g $SCRATCH_MNT  | grep -v -E '^root|^$' | _filter_scratch
52 }
53
54 # real QA test starts here
55 rm -f $seqres.full
56
57 _scratch_mkfs >> $seqres.full 2>&1
58 _scratch_mount "-o usrquota,grpquota"
59 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
60 quotaon $SCRATCH_MNT 2>/dev/null
61
62 touch $SCRATCH_MNT/testfile
63 chown $qa_user:$qa_user $SCRATCH_MNT/testfile
64
65 do_repquota
66
67 # If remount fails with this problem:
68 #
69 # https://bugzilla.redhat.com/show_bug.cgi?id=563267
70 #
71 # then you need a more recent mount binary.
72 _scratch_mount "-o remount,ro" 2>&1 | tee -a $seqres.full | _filter_scratch
73 touch $SCRATCH_MNT/failed 2>&1 | tee -a $seqres.full | _filter_scratch
74 _scratch_mount "-o remount,rw" 2>&1 | tee -a $seqres.full | _filter_scratch
75
76 $XFS_IO_PROG -c 'pwrite 0 8k' -c 'fsync' \
77                         $SCRATCH_MNT/testfile >>$seqres.full 2>&1
78 do_repquota
79
80 _scratch_unmount 2>/dev/null
81
82 status=0
83 exit