| #! /bin/bash |
| # SPDX-License-Identifier: GPL-2.0 |
| # Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved. |
| # |
| # FSQA Test No. 135 |
| # |
| # Concurrent I/O to same file to ensure no deadlocks |
| # |
| . ./common/preamble |
| _begin_fstest metadata auto quick |
| |
| # Import common functions. |
| . ./common/filter |
| |
| |
| _require_odirect |
| _require_scratch |
| _scratch_mkfs >/dev/null 2>&1 |
| _scratch_mount |
| |
| # create file with async I/O |
| $XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x12 0 4k' $SCRATCH_MNT/async_file > /dev/null |
| |
| # create file with sync I/O |
| $XFS_IO_PROG -f -s -c 'pwrite -b 4k -S 0x34 0 4k' $SCRATCH_MNT/sync_file > /dev/null |
| |
| # create file with direct I/O |
| $XFS_IO_PROG -f -d -c 'pwrite -b 4k -S 0x56 0 4k' $SCRATCH_MNT/direct_file > /dev/null |
| |
| # create file, truncate and then dirty again |
| $XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x78 0 4k' $SCRATCH_MNT/trunc_file > /dev/null |
| $XFS_IO_PROG -f -c 'truncate 2k' $SCRATCH_MNT/trunc_file > /dev/null |
| $XFS_IO_PROG -c 'pwrite 1k 0 1k' $SCRATCH_MNT/trunc_file > /dev/null |
| |
| _scratch_cycle_mount |
| |
| # check file size and contents |
| od -Ad -x $SCRATCH_MNT/async_file |
| od -Ad -x $SCRATCH_MNT/sync_file |
| od -Ad -x $SCRATCH_MNT/direct_file |
| od -Ad -x $SCRATCH_MNT/trunc_file |
| |
| status=0 |
| exit |