830674e0fc50d1d2279a16a35b36f611652e6e32
[xfstests-dev.git] / tests / xfs / 181
1 #! /bin/bash
2 # FS QA Test No. 181
3 #
4 # Like 121 only creating large EAs
5 # As part of the iunlink processing in recovery it will call VN_RELE
6 # which will inactivate the inodes and if they have EAs (which they
7 # will here) also call xfs_inactive_attrs.
8 # We want to test out this xfs_inactive_attrs code being called in recovery.
9 #
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
12 #
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
16 #
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
25 #
26 #-----------------------------------------------------------------------
27 #
28
29 seq=`basename $0`
30 seqres=$RESULT_DIR/$seq
31 seqres=$RESULT_DIR/$seq
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
34
35 _cleanup()
36 {
37     rm -f $tmp.*
38     [ -n "$pid" ] && kill $pid
39 }
40
41 pid=""
42 here=`pwd`
43 tmp=/tmp/$$
44 status=1        # failure is the default!
45 trap "_cleanup; exit \$status" 0 1 2 3 15
46
47 # get standard environment, filters and checks
48 . ./common/rc
49 . ./common/filter
50 . ./common/log
51
52 # real QA test starts here
53 _supported_fs xfs
54 _supported_os IRIX Linux
55
56 rm -f $seqres.full
57 rm -f $tmp.log
58
59 _require_scratch
60
61 echo "mkfs"
62 _scratch_mkfs_xfs >>$seqres.full 2>&1 \
63     || _fail "mkfs scratch failed"
64
65 echo "mount"
66 _scratch_mount >>$seqres.full 2>&1 \
67     || _fail "mount failed: $MOUNT_OPTIONS"
68
69 # num_files must be greater than 64 (XFS_AGI_UNLINKED_BUCKETS)
70 # so that there will be at least one linked list from one of
71 # the 64 buckets, so that we can decode a di_next_unlinked field
72 num_files=200
73 num_eas=1
74 ea_val_size=`expr 32 \* 1024`
75
76 # sleep for ages and we will kill this pid when we are ready
77 delay=100
78
79 echo "open and unlink $num_files files with EAs"
80 src/multi_open_unlink -f $SCRATCH_MNT/test_file -n $num_files -s $delay -e $num_eas -v $ea_val_size &
81 pid=$!
82
83 # time to create and unlink all the files
84 sleep 10
85
86 echo "godown"
87 src/godown -v -f $SCRATCH_MNT >> $seqres.full
88
89 # kill the multi_open_unlink
90 kill $pid 2>/dev/null
91 wait $pid 2>/dev/null
92 pid=""
93
94 echo "unmount"
95 umount $SCRATCH_MNT
96
97 echo "logprint after going down..."
98 _print_logstate
99
100 echo "mount with replay"
101 _scratch_mount $mnt >>$seqres.full 2>&1 \
102     || _fail "mount failed: $mnt $MOUNT_OPTIONS"
103
104 echo "godown"
105 src/godown -v -f $SCRATCH_MNT >> $seqres.full
106
107 echo "unmount"
108 umount $SCRATCH_MNT
109
110 echo "logprint after going down..."
111 _print_logstate
112
113 echo "logprint to check for CLEAR_AGI_BUCKET..."
114 if _scratch_xfs_logprint -t | tee -a $seqres.full | grep CLEAR; then
115         echo 'CLEAR_AGI_BUCKET transactions found!!'
116         echo 'Are you running with an old xfs kernel - where the bug still exists?'
117 else
118         echo 'No CLEAR_AGI_BUCKET found in transactions - great - test passed :)'
119 fi
120
121 # clean up dirty log with log recovery on mount
122 _scratch_mount >> $seqres.full 2>&1 \
123     || _fail "mount failed"
124
125 # should now be peaches
126 _check_scratch_fs
127
128 # success, all done
129 status=0
130 exit