From: "Darrick J. Wong" <djwong@kernel.org>
To: Brian Foster <bfoster@redhat.com>
Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH v3] tests/xfs: test COW writeback failure when overlapping non-shared blocks
Date: Fri, 17 Dec 2021 09:06:57 -0800 [thread overview]
Message-ID: <20211217170657.GH27664@magnolia> (raw)
In-Reply-To: <20211217153234.279540-1-bfoster@redhat.com>
On Fri, Dec 17, 2021 at 10:32:34AM -0500, Brian Foster wrote:
> Test that COW writeback that overlaps non-shared delalloc blocks
> does not leave around stale delalloc blocks on I/O failure. This
> triggers assert failures and free space accounting corruption on
> XFS.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
>
> v3:
> - Use fsync and sync_range to avoid spurious failure caused by log I/O
> errors.
> - Add kernel commit reference.
> v2: https://lore.kernel.org/fstests/20211025130053.8343-1-bfoster@redhat.com/
> - Explicitly set COW extent size hint.
> - Move to tests/xfs.
> - Various minor cleanups.
> v1: https://lore.kernel.org/fstests/20211021163959.1887011-1-bfoster@redhat.com/
>
> tests/xfs/999 | 67 +++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/999.out | 2 ++
> 2 files changed, 69 insertions(+)
> create mode 100755 tests/xfs/999
> create mode 100644 tests/xfs/999.out
>
> diff --git a/tests/xfs/999 b/tests/xfs/999
> new file mode 100755
> index 00000000..4308c0da
> --- /dev/null
> +++ b/tests/xfs/999
> @@ -0,0 +1,67 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2021 Red Hat, Inc. All Rights Reserved.
> +#
> +# FS QA Test 999
> +#
> +# Test that COW writeback that overlaps non-shared delalloc blocks does not
> +# leave around stale delalloc blocks on I/O failure. This triggers assert
> +# failures and free space accounting corruption on XFS. Fixed by upstream kernel
> +# commit 5ca5916b6bc9 ("xfs: punch out data fork delalloc blocks on COW
> +# writeback failure").
> +#
> +. ./common/preamble
> +_begin_fstest auto quick clone
> +
> +_cleanup()
> +{
> + _cleanup_flakey
> + cd /
> + rm -r -f $tmp.*
> +}
> +
> +# Import common functions.
> +. ./common/reflink
> +. ./common/dmflakey
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_require_scratch_reflink
> +_require_cp_reflink
> +_require_xfs_io_command "cowextsize"
> +_require_flakey_with_error_writes
> +
> +_scratch_mkfs >> $seqres.full
> +_init_flakey
> +_mount_flakey
> +
> +blksz=$(_get_file_block_size $SCRATCH_MNT)
> +
> +# Set the COW extent size hint to guarantee COW fork preallocation occurs over a
> +# bordering block offset.
> +$XFS_IO_PROG -c "cowextsize $((blksz * 2))" $SCRATCH_MNT >> $seqres.full
> +
> +# create two files that share a single block
> +$XFS_IO_PROG -fc "pwrite $blksz $blksz" $SCRATCH_MNT/file1 >> $seqres.full
> +$XFS_IO_PROG -fc "reflink $SCRATCH_MNT/file1" \
> + -c fsync $SCRATCH_MNT/file2 >> $seqres.full
> +
> +# Perform a buffered write across the shared and non-shared blocks. On XFS, this
> +# creates a COW fork extent that covers the shared block as well as the just
> +# created non-shared delalloc block. Fail the writeback to verify that all
> +# delayed allocation is cleaned up properly.
> +_load_flakey_table $FLAKEY_ERROR_WRITES
> +len=$((blksz * 2))
> +$XFS_IO_PROG -c "pwrite 0 $len" \
> + -c "sync_range -w 0 $len" $SCRATCH_MNT/file2 \
> + -c "sync_range -a 0 $len" >> $seqres.full
Nit: put $SCRATCH_MNT/file2 at the end?
Otherwise looks ok to me, so I'll give this one a spin on my test
infrastructure tonight. In the mean time,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> +_load_flakey_table $FLAKEY_ALLOW_WRITES
> +
> +# Try a post-fail reflink and then unmount. Both of these are known to produce
> +# errors and/or assert failures on XFS if we trip over a stale delalloc block.
> +_cp_reflink $SCRATCH_MNT/file2 $SCRATCH_MNT/file3
> +_unmount_flakey
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/999.out b/tests/xfs/999.out
> new file mode 100644
> index 00000000..95d64cf0
> --- /dev/null
> +++ b/tests/xfs/999.out
> @@ -0,0 +1,2 @@
> +QA output created by 999
> +sync_file_range: Input/output error
> --
> 2.31.1
>
prev parent reply other threads:[~2021-12-17 17:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-17 15:32 [PATCH v3] tests/xfs: test COW writeback failure when overlapping non-shared blocks Brian Foster
2021-12-17 17:06 ` Darrick J. Wong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211217170657.GH27664@magnolia \
--to=djwong@kernel.org \
--cc=bfoster@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox