generic: test for file loss after mix of rename, fsync and inode eviction
[xfstests-dev.git] / tests / generic / 235
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2010 Jan Kara.  All Rights Reserved.
4 # Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
5 #
6 # FS QA Test No. 235
7 #
8 # Test whether quota gets properly reenabled after remount read-write
9 #
10 . ./common/preamble
11 _begin_fstest auto quota quick
12
13 # Import common functions.
14 . ./common/filter
15 . ./common/quota
16
17 # real QA test starts here
18 _supported_fs generic
19 _require_scratch
20 _require_quota
21 _require_user
22
23 do_repquota()
24 {
25         repquota -u -g $SCRATCH_MNT  | grep -v -E '^root|^$' | _filter_scratch
26 }
27
28 # real QA test starts here
29
30 _scratch_mkfs >> $seqres.full 2>&1
31 _scratch_mount "-o usrquota,grpquota"
32 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
33 quotaon $SCRATCH_MNT 2>/dev/null
34
35 touch $SCRATCH_MNT/testfile
36 chown $qa_user:$qa_user $SCRATCH_MNT/testfile
37
38 do_repquota
39
40 # If remount fails with this problem:
41 #
42 # https://bugzilla.redhat.com/show_bug.cgi?id=563267
43 #
44 # then you need a more recent mount binary.
45 _try_scratch_mount "-o remount,ro" 2>&1 | tee -a $seqres.full | _filter_scratch
46 touch $SCRATCH_MNT/failed 2>&1 | tee -a $seqres.full | _filter_scratch
47 _try_scratch_mount "-o remount,rw" 2>&1 | tee -a $seqres.full | _filter_scratch
48
49 touch $SCRATCH_MNT/testfile2
50 chown $qa_user:$qa_user $SCRATCH_MNT/testfile2
51
52 do_repquota
53
54 _scratch_unmount 2>/dev/null
55
56 status=0
57 exit