generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 384
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 384
6 #
7 # test to reproduce PV951636:
8 #   project quotas not updated if a file is mv'd into that directory
9 #
10 . ./common/preamble
11 _begin_fstest quota auto quick
12
13 # Import common functions.
14 . ./common/filter
15 . ./common/quota
16
17 # Override the default cleanup function.
18 _cleanup()
19 {
20         cd /
21         _scratch_unmount 2>/dev/null
22         rm -f $tmp.*
23 }
24
25 # real QA test starts here
26 _supported_fs generic
27
28 _require_test
29 _require_quota
30 _require_xfs_quota_foreign
31 _require_xfs_io_command "chproj"
32
33 # we can't run with group quotas (on v4 xfs); the mount options for group
34 # quotas will be filtered out by _qmount_option below.
35
36 dir=$SCRATCH_MNT/project
37
38 #project quota files
39 cat >$tmp.projects <<EOF
40 1:$dir
41 EOF
42
43 cat >$tmp.projid <<EOF
44 test:1
45 EOF
46
47 cp /dev/null $seqres.full
48 chmod a+rwx $seqres.full        # arbitrary users will write here
49
50 _require_scratch
51 _scratch_mkfs >/dev/null 2>&1
52 _scratch_enable_pquota
53
54 _qmount_option "prjquota"
55 _qmount
56 _require_prjquota $SCRATCH_DEV
57
58 report_quota()
59 {
60     $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
61                     -c "repquota -inN -p" $SCRATCH_DEV | \
62                     tr -s '[:space:]' | _filter_project_quota
63 }
64
65 mkdir $dir
66 $XFS_IO_PROG -r -c "chproj -R 1" -c "chattr -R +P" $dir
67
68 $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
69     -c "limit -p bsoft=100m bhard=100m 1" $SCRATCH_DEV
70 report_quota
71
72 touch $dir/1
73 touch $dir/2
74 cp $dir/2 $dir/3
75 report_quota
76
77 xfs_mkfile 1M $TEST_DIR/6
78
79 #try cp to dir
80 cp $TEST_DIR/6 $dir/6
81 report_quota
82
83 #try mv to dir
84 mv $TEST_DIR/6 $dir/7
85 report_quota
86
87 # success, all done
88 status=0
89 exit