public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Zorro Lang <zlang@kernel.org>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] fstests: add a regression test for fiemap into an mmap range
Date: Wed, 20 Mar 2024 10:59:42 -0400	[thread overview]
Message-ID: <20240320145942.GB3091349@perftesting> (raw)
In-Reply-To: <20240313154851.zvawwfmoufhdwtel@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com>

On Wed, Mar 13, 2024 at 11:48:51PM +0800, Zorro Lang wrote:
> On Mon, Feb 12, 2024 at 11:41:14AM -0500, Josef Bacik wrote:
> > Btrfs had a deadlock that you could trigger by mmap'ing a large file and
> > using that as the buffer for fiemap.  This test adds a c program to do
> > this, and the fstest creates a large enough file and then runs the
> > reproducer on the file.  Without the fix btrfs deadlocks, with the fix
> > we pass fine.
> > 
> > Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> > ---
> > v1->v2:
> > - Add the fiemap group to the test.
> > - Actually include the reproducer helper program.
> 
> Looks like this patch is missed (except the author changed the patch subject:),
> correct me if I'm wrong. The last review point hoped to add "src/fiemap-fault"
> to .gitignore.
> 
> > 
> >  src/Makefile          |  2 +-
> >  src/fiemap-fault.c    | 73 +++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/740     | 41 ++++++++++++++++++++++++
> >  tests/generic/740.out |  2 ++
> >  4 files changed, 117 insertions(+), 1 deletion(-)
> >  create mode 100644 src/fiemap-fault.c
> >  create mode 100644 tests/generic/740
> >  create mode 100644 tests/generic/740.out
> > 
> 
> [snip]
> 
> > diff --git a/tests/generic/740 b/tests/generic/740
> > new file mode 100644
> > index 00000000..30ace1dd
> > --- /dev/null
> > +++ b/tests/generic/740
> > @@ -0,0 +1,41 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2023 Meta Platforms, Inc.  All Rights Reserved.
> > +#
> > +# FS QA Test 708
> > +#
> > +# Test fiemap into an mmaped buffer of the same file
> > +#
> > +# Create a reasonably large file, then run a program which mmaps it and uses
> > +# that as a buffer for an fiemap call.  This is a regression test for btrfs
> > +# where we used to hold a lock for the duration of the fiemap call which would
> > +# result in a deadlock if we page faulted.
> > +#
> > +. ./common/preamble
> > +_begin_fstest quick auto fiemap
> > +[ $FSTYP == "btrfs" ] && \
> > +	_fixed_by_kernel_commit xxxxxxxxxxxx \
> 
> This commit id is "b0ad381fa769" now.
> 
> > +		"btrfs: fix deadlock with fiemap and extent locking"
> > +
> > +# real QA test starts here
> > +_supported_fs generic
> > +_require_test
> > +_require_odirect
> > +_require_test_program fiemap-fault
> > +dst=$TEST_DIR/fiemap-fault-$seq
> > +
> > +echo "Silence is golden"
> > +
> > +for i in $(seq 0 2 1000)
> > +do
> > +	$XFS_IO_PROG -d -f -c "pwrite -q $((i * 4096)) 4096" $dst
> > +done
> 
> _require_sparse_files ?
> 

This is the only comment I didn't incorporate, I'm not looking for sparse files,
I'm just looking for a lot of extents.  If smb fills in the holes I suppose this
will only be a problem if it fills them in contiguously, but it'll just create a
4gib file instead of a 2gib file.  Thanks,

Josef

      reply	other threads:[~2024-03-20 14:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 16:41 [PATCH v2] fstests: add a regression test for fiemap into an mmap range Josef Bacik
2024-02-13  2:36 ` Anand Jain
2024-02-13  2:50 ` David Disseldorp
2024-03-13 15:48 ` Zorro Lang
2024-03-20 14:59   ` Josef Bacik [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=20240320145942.GB3091349@perftesting \
    --to=josef@toxicpanda.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zlang@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