generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / xfs / 121
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. 121
6 #
7 # To test log replay for the unlinked list.
8 # So we create unlinked and still referenced inodes
9 # and make sure that no clearing of the unlinked AGI buckets
10 # are happening.
11 # See pv#953263.
12 #
13 . ./common/preamble
14 _begin_fstest shutdown log auto quick
15
16 # Import common functions.
17 . ./common/filter
18 . ./common/log
19
20 # real QA test starts here
21 _supported_fs xfs
22
23 rm -f $tmp.log
24
25 _require_scratch
26
27 echo "mkfs"
28 _scratch_mkfs_xfs >>$seqres.full 2>&1 \
29     || _fail "mkfs scratch failed"
30
31 echo "mount"
32 _scratch_mount
33
34 # num_files must be greater than 64 (XFS_AGI_UNLINKED_BUCKETS)
35 # so that there will be at least one linked list from one of
36 # the 64 buckets, so that we can decode a di_next_unlinked field
37 num_files=200
38 delay=5
39 echo "open and unlink $num_files files"
40 $here/src/multi_open_unlink -f $SCRATCH_MNT/test_file -n $num_files -s $delay &
41
42 # time to create and unlink all the files
43 sleep 3
44
45 echo "godown"
46 _scratch_shutdown -v -f >> $seqres.full
47
48 # time for multi_open_unlink to exit out after its delay
49 # so we have no references and can unmount
50 wait 2>/dev/null
51
52 echo "unmount"
53 _scratch_unmount
54
55 echo "logprint after going down..."
56 _print_logstate
57
58 echo "mount with replay"
59 _try_scratch_mount $mnt >>$seqres.full 2>&1 \
60     || _fail "mount failed: $mnt $MOUNT_OPTIONS"
61
62 echo "godown"
63 _scratch_shutdown -v -f >> $seqres.full
64
65 echo "unmount"
66 _scratch_unmount
67
68 echo "logprint after going down..."
69 _print_logstate
70
71 echo "logprint to check for CLEAR_AGI_BUCKET..."
72 if _scratch_xfs_logprint -t | tee -a $seqres.full | grep CLEAR; then
73         echo 'CLEAR_AGI_BUCKET transactions found!!'
74         echo 'Are you running with an old xfs kernel - where the bug still exists?'
75 else
76         echo 'No CLEAR_AGI_BUCKET found in transactions - great - test passed :)'
77 fi
78
79 # clean up dirty log with log recovery on mount
80 _scratch_mount
81
82 # success, all done
83 status=0
84 exit