mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
bbaf78c01b
Check if there are two threads,one keeps calling read() or lseek(), and the other calling readdir(), both on the same directory fd. Based on a testcase from Li Zefan <lizefan@huawei.com>. http://marc.info/?l=linux-kernel&m=136123703211869&w=2 Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com> Reviewed-by: Rich Johnston <rjohnston@sgi.com> [rjohnston@sgi.com minor white space fixes and test renumbering] Signed-off-by: Rich Johnston <rjohnston@sgi.com>
77 lines
1.8 KiB
Bash
77 lines
1.8 KiB
Bash
#! /bin/bash
|
|
# FS QA Test No. 310
|
|
#
|
|
#Check if there are two threads,one keeps calling read() or lseek(), and
|
|
#the other calling readdir(), both on the same directory fd.
|
|
#
|
|
# Based on a testcase from Li Zefan <lizefan@huawei.com>.
|
|
#
|
|
# http://marc.info/?l=linux-kernel&m=136123703211869&w=2
|
|
#
|
|
#-----------------------------------------------------------------------
|
|
# Copyright (c) 2013 HuaWei. All Rights Reserved.
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as
|
|
# published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it would be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write the Free Software Foundation,
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
#-----------------------------------------------------------------------
|
|
#
|
|
# creator
|
|
owner=zhaohongjiang@huawei.com
|
|
|
|
seq=`basename $0`
|
|
echo "QA output created by $seq"
|
|
|
|
status=1 # failure is the default!
|
|
|
|
_cleanup()
|
|
{
|
|
rm -rf $TEST_DIR/tmp
|
|
}
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common.rc
|
|
. ./common.filter
|
|
|
|
# real QA test starts here
|
|
_supported_fs generic
|
|
_supported_os Linux
|
|
|
|
mkdir $TEST_DIR/tmp
|
|
for n in {1..4096}; do
|
|
touch $TEST_DIR/tmp/$n
|
|
done
|
|
|
|
_test_read()
|
|
{
|
|
src/t_readdir_1 $TEST_DIR/tmp &
|
|
sleep 100
|
|
killall src/t_readdir_1
|
|
}
|
|
|
|
_test_lseek()
|
|
{
|
|
src/t_readdir_2 $TEST_DIR/tmp &
|
|
sleep 100
|
|
killall src/t_readdir_2
|
|
}
|
|
|
|
_test_read
|
|
_test_lseek
|
|
|
|
# success, all done
|
|
echo "*** done"
|
|
rm -f $seq.full
|
|
status=0
|
|
exit
|