xfs: force file creation to the data device for certain layout tests
[xfstests-dev.git] / tests / generic / 135
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 135
6 #
7 # Concurrent I/O to same file to ensure no deadlocks
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "exit \$status" 0 1 2 3 15
17
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21
22 # real QA test starts here
23 _supported_fs generic
24
25 _require_odirect
26 _require_scratch
27 _scratch_mkfs >/dev/null 2>&1
28 _scratch_mount
29
30 cd $SCRATCH_MNT
31
32 # create file with async I/O
33 $XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x12 0 4k' async_file > /dev/null
34
35 # create file with sync I/O
36 $XFS_IO_PROG -f -s -c 'pwrite -b 4k -S 0x34 0 4k' sync_file > /dev/null
37
38 # create file with direct I/O
39 $XFS_IO_PROG -f -d -c 'pwrite -b 4k -S 0x56 0 4k' direct_file > /dev/null
40
41 # create file, truncate and then dirty again
42 $XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x78 0 4k' trunc_file > /dev/null
43 $XFS_IO_PROG -f -c 'truncate 2k' trunc_file > /dev/null
44 $XFS_IO_PROG -c 'pwrite 1k 0 1k' trunc_file > /dev/null
45
46 pushd / > /dev/null
47 _scratch_cycle_mount
48 popd > /dev/null
49
50 # check file size and contents
51 od -Ad -x async_file
52 od -Ad -x sync_file
53 od -Ad -x direct_file
54 od -Ad -x trunc_file
55
56 rm -f async_file sync_file direct_file trunc_file
57
58 status=0
59 exit