generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 380
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 380
6 #
7 # To test out pv#940675 crash in xfs_trans_brelse + quotas
8 # Without the fix, this will create an ASSERT failure in debug kernels
9 # and crash a non-debug kernel.
10 #
11 . ./common/preamble
12 _begin_fstest quota auto quick
13
14 # Import common functions.
15 . ./common/filter
16 . ./common/quota
17
18 # real QA test starts here
19
20 # Modify as appropriate.
21 _supported_fs generic
22
23 _require_scratch
24 _require_quota
25 _require_xfs_quota_foreign
26
27 _chowning_file()
28 {
29         file=file.chown
30         let start=$1
31         let limit=$2
32         let delta=$3
33
34         cd $SCRATCH_MNT
35         let count=$start
36         while (( count < limit )); do
37             touch $file
38             chown $count:$count $file
39             echo -n "."
40             let count=count+delta
41         done
42         echo ""
43 }
44
45 echo "mkfs on scratch"
46 _scratch_mkfs >$seqres.full 2>&1
47
48 echo "mount with quotas"
49 export MOUNT_OPTIONS="-o usrquota"
50 _scratch_mount
51
52 echo "creating quota file with holes"
53 _chowning_file 1000 2000 100
54
55 echo "now fill in the holes"
56 _chowning_file 1000 2000 1
57
58 echo "look at the final file ownership for fun"
59 ls -l $SCRATCH_MNT/* \
60 | $AWK_PROG 'NF > 2 {print $3, $4, $NF}' \
61 | sed "s#$SCRATCH_MNT#SCRATCH_MNT#g"
62
63 # success, all done
64 status=0
65 exit