xfstests: randholes: clean up readblks()
[xfstests-dev.git] / 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 # creator
28 owner=jack@suse.cz
29
30 seq=`basename $0`
31 echo "QA output created by $seq"
32
33 here=`pwd`
34 tmp=/tmp/$$
35 status=1        # failure is the default!
36 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
37
38 # get standard environment, filters and checks
39 . ./common.rc
40 . ./common.filter
41 . ./common.quota
42
43 filter_scratch()
44 {
45         perl -ne "
46 s,$SCRATCH_MNT,[SCR_MNT],;
47 s,$SCRATCH_DEV,[SCR_DEV],;
48         print;"
49 }
50
51 # real QA test starts here
52 _supported_fs generic
53 _supported_os Linux #IRIX
54 _require_scratch
55 _require_quota
56 _require_user
57 _need_to_be_root
58
59 # real QA test starts here
60 rm -f $seq.full
61
62 _scratch_mkfs >> $seq.full 2>&1
63 _scratch_mount "-o usrquota,grpquota"
64 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
65 quotaon $SCRATCH_MNT 2>/dev/null
66
67 touch $SCRATCH_MNT/testfile
68 chown $qa_user:$qa_user $SCRATCH_MNT/testfile
69
70 repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch
71
72 mount -o remount,ro $SCRATCH_DEV 2>&1 | tee -a $seq.full | filter_scratch
73 touch $SCRATCH_MNT/failed 2>&1 | tee -a $seq.full | filter_scratch
74 mount -o remount,rw $SCRATCH_DEV 2>&1 | tee -a $seq.full | filter_scratch
75
76 $XFS_IO_PROG -F -c 'pwrite 0 16k' -c 'fsync' \
77                         $SCRATCH_MNT/testfile >>$seq.full 2>&1
78 repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch
79
80 umount $SCRATCH_DEV 2>/dev/null
81
82 status=0
83 exit