Files
apfstests/tests/btrfs/206
T
Darrick J. Wong 7e98d41a6e fstests: move test group info to test files
Refactor every test in the entire test suite to use the new boilerplate
functions.  This also migrates all the test group information into the
test files.  This patch has been autogenerated via the command:

./tools/convert-group btrfs ceph cifs ext4 f2fs generic nfs ocfs2 overlay perf shared udf xfs

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-06-27 22:50:02 +08:00

69 lines
2.0 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2020 Facebook. All Rights Reserved.
#
# FS QA Test 206
#
# Validate that without no-holes we do not get a i_size that is after a gap in
# the file extents on disk when punching a hole past i_size. This is fixed by
# the following patches
#
# btrfs: use the file extent tree infrastructure
# btrfs: replace all uses of btrfs_ordered_update_i_size
#
. ./common/preamble
_begin_fstest auto quick log replay
# Import common functions.
. ./common/filter
. ./common/dmlogwrites
# real QA test starts here
_supported_fs btrfs
_require_test
_require_scratch
_require_log_writes
_require_xfs_io_command "falloc" "-k"
_require_xfs_io_command "fpunch"
_log_writes_init $SCRATCH_DEV
_log_writes_mkfs "-O ^no-holes" >> $seqres.full 2>&1
# There's not a straightforward way to commit the transaction without also
# flushing dirty pages, so shorten the commit interval to 1 so we're sure to get
# a commit with our broken file
_log_writes_mount -o commit=1
# This creates a gap extent because fpunch doesn't insert hole extents past
# i_size
$XFS_IO_PROG -f -c "falloc -k 4k 8k" $SCRATCH_MNT/file
$XFS_IO_PROG -f -c "fpunch 4k 4k" $SCRATCH_MNT/file
# The pwrite extends the i_size to cover the gap extent, and then the truncate
# sets the disk_i_size to 12k because it assumes everything was a-ok.
$XFS_IO_PROG -f -c "pwrite 0 4k" $SCRATCH_MNT/file | _filter_xfs_io
$XFS_IO_PROG -f -c "pwrite 0 8k" $SCRATCH_MNT/file | _filter_xfs_io
$XFS_IO_PROG -f -c "truncate 12k" $SCRATCH_MNT/file
# Wait for a transaction commit
sleep 2
_log_writes_unmount
_log_writes_remove
cur=$(_log_writes_find_next_fua 0)
echo "cur=$cur" >> $seqres.full
while [ ! -z "$cur" ]; do
_log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
# We only care about the fs consistency, so just run fsck, we don't have
# to mount the fs to validate it
_check_scratch_fs
cur=$(_log_writes_find_next_fua $(($cur + 1)))
done
# success, all done
status=0
exit