From: Allison Henderson <allison.henderson@oracle.com>
To: "Darrick J. Wong" <djwong@kernel.org>, guaneryu@gmail.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: Re: [PATCH 7/8] generic/371: disable speculative preallocation regressions on XFS
Date: Fri, 9 Jul 2021 16:50:53 -0700 [thread overview]
Message-ID: <068bec25-cd8e-7682-3c40-b5f6e38b4ec0@oracle.com> (raw)
In-Reply-To: <162561730547.543423.5029188797370208051.stgit@locust>
On 7/6/21 5:21 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Once in a very long while, the fallocate calls in this test will fail
> due to ENOSPC conditions. While in theory this test is careful only to
> allocate at most 160M of space from a 256M filesystem, there's a twist
> on XFS: speculative preallocation.
>
> The first loop in this test is an 80M appending write done in units of
> 4k. Once the file size hits 64k, XFS will begin speculatively
> preallocating blocks past the end of the file; as the file grows larger,
> so will the speculative preallocation.
>
> Since the pwrite/rm loop races with the fallocate/rm loop, it's possible
> that the fallocate loop will free that file just before the buffered
> write extends the speculative preallocation out to 160MB. With fs and
> log overhead, that doesn't leave enough free space to start the 80MB
> fallocate request, which tries to avoid disappointing the caller by
> freeing all speculative preallocations. That fails if the pwriter
> thread owns the IOLOCK on $testfile1, so fallocate returns ENOSPC and
> the test fails.
>
> The simple solution here is to disable speculative preallocation by
> setting an extent size hint if the fs is XFS.
>
Ok, makes sense
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> tests/generic/371 | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
>
> diff --git a/tests/generic/371 b/tests/generic/371
> index c94fa85e..a2fdaf7b 100755
> --- a/tests/generic/371
> +++ b/tests/generic/371
> @@ -18,10 +18,18 @@ _begin_fstest auto quick enospc prealloc
> _supported_fs generic
> _require_scratch
> _require_xfs_io_command "falloc"
> +test "$FSTYP" = "xfs" && _require_xfs_io_command "extsize"
>
> _scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1
> _scratch_mount
>
> +# Disable speculative post-EOF preallocation on XFS, which can grow fast enough
> +# that a racing fallocate then fails.
> +if [ "$FSTYP" = "xfs" ]; then
> + alloc_sz="$(_get_file_block_size $SCRATCH_MNT)"
> + $XFS_IO_PROG -c "extsize $alloc_sz" $SCRATCH_MNT >> $seqres.full
> +fi
> +
> testfile1=$SCRATCH_MNT/testfile1
> testfile2=$SCRATCH_MNT/testfile2
>
>
next prev parent reply other threads:[~2021-07-09 23:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 0:21 [PATCHSET 0/8] fstests: random fixes Darrick J. Wong
2021-07-07 0:21 ` [PATCH 1/8] xfs/172: disable test when file writes don't use delayed allocation Darrick J. Wong
2021-07-09 23:38 ` Allison Henderson
2021-07-07 0:21 ` [PATCH 2/8] generic/561: hide assertions when duperemove is killed Darrick J. Wong
2021-07-09 23:38 ` Allison Henderson
2021-07-10 1:25 ` Darrick J. Wong
2021-07-07 0:21 ` [PATCH 3/8] shared/298: fix random deletion when filenames contain spaces Darrick J. Wong
2021-07-09 23:39 ` Allison Henderson
2021-07-07 0:21 ` [PATCH 4/8] dmthin: erase the metadata device properly before starting Darrick J. Wong
2021-07-09 23:39 ` Allison Henderson
2021-07-18 14:20 ` Eryu Guan
2021-07-18 14:32 ` Eryu Guan
2021-07-07 0:21 ` [PATCH 5/8] check: run _check_filesystems in an OOM-happy subshell Darrick J. Wong
2021-07-07 0:21 ` [PATCH 6/8] xfs/084: fix test program status collection and processing Darrick J. Wong
2021-07-07 0:21 ` [PATCH 7/8] generic/371: disable speculative preallocation regressions on XFS Darrick J. Wong
2021-07-09 23:50 ` Allison Henderson [this message]
2021-07-07 0:21 ` [PATCH 8/8] generic/019: don't dump cores when fio/fsstress hit io errors Darrick J. Wong
2021-07-09 23:39 ` Allison Henderson
2021-07-18 14:35 ` [PATCHSET 0/8] fstests: random fixes Eryu Guan
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=068bec25-cd8e-7682-3c40-b5f6e38b4ec0@oracle.com \
--to=allison.henderson@oracle.com \
--cc=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=guan@eryu.me \
--cc=guaneryu@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).