generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / xfs / 181
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 181
6 #
7 # Like 121 only creating large EAs
8 # As part of the iunlink processing in recovery it will call VN_RELE
9 # which will inactivate the inodes and if they have EAs (which they
10 # will here) also call xfs_inactive_attrs.
11 # We want to test out this xfs_inactive_attrs code being called in recovery.
12 #
13 . ./common/preamble
14 _begin_fstest shutdown log auto quick
15
16 # Override the default cleanup function.
17 _cleanup()
18 {
19     rm -f $tmp.*
20     [ -n "$pid" ] && kill $pid
21 }
22
23 pid=""
24
25 # Import common functions.
26 . ./common/filter
27 . ./common/log
28
29 # real QA test starts here
30 _supported_fs xfs
31
32 rm -f $tmp.log
33
34 _require_scratch
35
36 echo "mkfs"
37 _scratch_mkfs_xfs >>$seqres.full 2>&1 \
38     || _fail "mkfs scratch failed"
39
40 echo "mount"
41 _scratch_mount
42
43 # num_files must be greater than 64 (XFS_AGI_UNLINKED_BUCKETS)
44 # so that there will be at least one linked list from one of
45 # the 64 buckets, so that we can decode a di_next_unlinked field
46 num_files=200
47 num_eas=1
48 ea_val_size=`expr 32 \* 1024`
49
50 # sleep for ages and we will kill this pid when we are ready
51 delay=100
52
53 echo "open and unlink $num_files files with EAs"
54 $here/src/multi_open_unlink -f $SCRATCH_MNT/test_file -n $num_files -s $delay -e $num_eas -v $ea_val_size &
55 pid=$!
56
57 # time to create and unlink all the files
58 sleep 10
59
60 echo "godown"
61 _scratch_shutdown -v -f >> $seqres.full
62
63 # kill the multi_open_unlink
64 kill $pid 2>/dev/null
65 wait $pid 2>/dev/null
66 pid=""
67
68 echo "unmount"
69 _scratch_unmount
70
71 echo "logprint after going down..."
72 _print_logstate
73
74 echo "mount with replay"
75 _scratch_mount $mnt >>$seqres.full 2>&1 \
76     || _fail "mount failed: $mnt $MOUNT_OPTIONS"
77
78 echo "godown"
79 _scratch_shutdown -v -f >> $seqres.full
80
81 echo "unmount"
82 _scratch_unmount
83
84 echo "logprint after going down..."
85 _print_logstate
86
87 echo "logprint to check for CLEAR_AGI_BUCKET..."
88 if _scratch_xfs_logprint -t | tee -a $seqres.full | grep CLEAR; then
89         echo 'CLEAR_AGI_BUCKET transactions found!!'
90         echo 'Are you running with an old xfs kernel - where the bug still exists?'
91 else
92         echo 'No CLEAR_AGI_BUCKET found in transactions - great - test passed :)'
93 fi
94
95 # clean up dirty log with log recovery on mount
96 _scratch_mount >> $seqres.full 2>&1 \
97     || _fail "mount failed"
98
99 # success, all done
100 status=0
101 exit