38d556cf6e3d953f65a7c807289b9560a7077101
[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 echo "QA output created by $seq"
32
33 _cleanup()
34 {
35     rm -f $tmp.*
36     [ -n "$pid" ] && kill $pid
37 }
38
39 pid=""
40 here=`pwd`
41 tmp=/tmp/$$
42 status=1        # failure is the default!
43 trap "_cleanup; exit \$status" 0 1 2 3 15
44
45 # get standard environment, filters and checks
46 . ./common/rc
47 . ./common/filter
48 . ./common/log
49
50 # real QA test starts here
51 _supported_fs xfs
52 _supported_os IRIX Linux
53
54 rm -f $seqres.full
55 rm -f $tmp.log
56
57 _require_scratch
58
59 echo "mkfs"
60 _scratch_mkfs_xfs >>$seqres.full 2>&1 \
61     || _fail "mkfs scratch failed"
62
63 echo "mount"
64 _scratch_mount >>$seqres.full 2>&1 \
65     || _fail "mount failed: $MOUNT_OPTIONS"
66
67 # num_files must be greater than 64 (XFS_AGI_UNLINKED_BUCKETS)
68 # so that there will be at least one linked list from one of
69 # the 64 buckets, so that we can decode a di_next_unlinked field
70 num_files=200
71 num_eas=1
72 ea_val_size=`expr 32 \* 1024`
73
74 # sleep for ages and we will kill this pid when we are ready
75 delay=100
76
77 echo "open and unlink $num_files files with EAs"
78 src/multi_open_unlink -f $SCRATCH_MNT/test_file -n $num_files -s $delay -e $num_eas -v $ea_val_size &
79 pid=$!
80
81 # time to create and unlink all the files
82 sleep 10
83
84 echo "godown"
85 src/godown -v -f $SCRATCH_MNT >> $seqres.full
86
87 # kill the multi_open_unlink
88 kill $pid 2>/dev/null
89 wait $pid 2>/dev/null
90 pid=""
91
92 echo "unmount"
93 umount $SCRATCH_MNT
94
95 echo "logprint after going down..."
96 _print_logstate
97
98 echo "mount with replay"
99 _scratch_mount $mnt >>$seqres.full 2>&1 \
100     || _fail "mount failed: $mnt $MOUNT_OPTIONS"
101
102 echo "godown"
103 src/godown -v -f $SCRATCH_MNT >> $seqres.full
104
105 echo "unmount"
106 umount $SCRATCH_MNT
107
108 echo "logprint after going down..."
109 _print_logstate
110
111 echo "logprint to check for CLEAR_AGI_BUCKET..."
112 if _scratch_xfs_logprint -t | tee -a $seqres.full | grep CLEAR; then
113         echo 'CLEAR_AGI_BUCKET transactions found!!'
114         echo 'Are you running with an old xfs kernel - where the bug still exists?'
115 else
116         echo 'No CLEAR_AGI_BUCKET found in transactions - great - test passed :)'
117 fi
118
119 # clean up dirty log with log recovery on mount
120 _scratch_mount >> $seqres.full 2>&1 \
121     || _fail "mount failed"
122
123 # should now be peaches
124 _check_scratch_fs
125
126 # success, all done
127 status=0
128 exit