4 # Check if there are two threads,one keeps calling read() or lseek(), and
5 # the other calling readdir(), both on the same directory fd.
7 # Testing on ext3: with dir_index disabled results in the following
8 # dmesg output: (also occurs when testing ext2 and ext4)
10 # EXT3-fs error (device sdb): ext3_readdir: bad entry in directory #1134241:
11 # rec_len % 4 != 0 - offset=2704, inode=16973836, rec_len=12850, name_len=52
12 # EXT3-fs error (device sdb): ext3_readdir: bad entry in directory #1134241:
13 # directory entry across blocks - offset=1672, inode=16973836, rec_len=14132,
16 # The filesystem mount option 'errors=' will define the behavior
17 # when an error is encountered. (see mount manpage)
19 # The test is based on a testcase from Li Zefan <lizefan@huawei.com>.
21 # http://marc.info/?l=linux-kernel&m=136123703211869&w=2
23 #-----------------------------------------------------------------------
24 # Copyright (c) 2013 HuaWei. All Rights Reserved.
26 # This program is free software; you can redistribute it and/or
27 # modify it under the terms of the GNU General Public License as
28 # published by the Free Software Foundation.
30 # This program is distributed in the hope that it would be useful,
31 # but WITHOUT ANY WARRANTY; without even the implied warranty of
32 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 # GNU General Public License for more details.
35 # You should have received a copy of the GNU General Public License
36 # along with this program; if not, write the Free Software Foundation,
37 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
38 #-----------------------------------------------------------------------
42 seqres=$RESULT_DIR/$seq
43 echo "QA output created by $seq"
45 status=1 # failure is the default!
51 trap "_cleanup; exit \$status" 0 1 2 3 15
53 # get standard environment, filters and checks
57 # real QA test starts here
64 nr_bug=`dmesg | grep -c "kernel BUG"`
65 nr_error=`dmesg | grep -c "error"`
66 nr_null=`dmesg | grep -c "kernel NULL pointer dereference"`
67 nr_warning=`dmesg | grep -c "^WARNING"`
68 nr_lockdep=`dmesg | grep -c "possible recursive locking detected"`
70 #check if some kind of kernel bug happened
73 new_bug=`dmesg | grep -c "kernel BUG"`
74 new_error=`dmesg | grep -c "error"`
75 new_null=`dmesg | grep -c "kernel NULL pointer dereference"`
76 new_warning=`dmesg | grep -c "^WARNING"`
77 new_lockdep=`dmesg | grep -c "possible recursive locking detected"`
79 # no kernel bug is detected
80 if [ $new_bug -eq $nr_bug -a $new_error -eq $nr_error -a \
81 $new_null -eq $nr_null -a $new_warning -eq $nr_warning -a \
82 $new_lockdep -eq $nr_lockdep ]; then
89 nr_warning=$new_warning
90 nr_lockdep=$new_lockdep
94 RUN_TIME=$((30 * $TIME_FACTOR))
96 SEQ_DIR=$TEST_DIR/$seq
98 for n in {1..4096}; do
104 src/t_readdir_1 $SEQ_DIR &
108 if [ $? -ne 0 ]; then
109 _fatal "kernel bug detected, check dmesg for more infomation."
115 src/t_readdir_2 $SEQ_DIR &
119 if [ $? -ne 0 ]; then
120 _fatal "kernel bug detected, check dmesg for more infomation."