linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: don't BUG() on mixed direct and mapped I/O
Date: Mon, 31 Oct 2016 12:25:51 -0400	[thread overview]
Message-ID: <20161031162551.GB57171@bfoster.bfoster> (raw)
In-Reply-To: <20161031154642.GA28355@infradead.org>

On Mon, Oct 31, 2016 at 08:46:42AM -0700, Christoph Hellwig wrote:
> On Mon, Oct 31, 2016 at 10:14:28AM -0400, Brian Foster wrote:
> > We've had reports of generic/095 causing XFS to BUG() in
> > __xfs_get_blocks() due to the existence of delalloc blocks on a direct
> > I/O read. generic/095 issues a mix of various types of I/O, including
> > direct and memory mapped I/O to a single file.
> 
> Can you explain the scenario in which case this happens in a little
> more detail?  The patch looks fine to me, but I'd really like to
> understand how this happens.

Sure... the case I reproduced is a race between a direct I/O read and a
mapped write to a hole in a file. The direct read gets through
xfs_file_dio_aio_read() and down to __xfs_get_blocks() while the region
is still a hole. Before the xfs_bmapi_read() call from
__xfs_get_blocks(), a mapped write occurs and allocates delalloc blocks
in the associated file range. xfs_bmapi_read() then returns a delalloc
mapping for a dio read and falls through to the BUG_ON().

FWIW, the specific reproducer was a tweaked variant of generic/095 to up
the iodepth (1024), iodepth_batch (60), and numjobs (20) fio params. It
was also on a ppc64 box with a 64k page size, so that might have also
improved the chances of a race. This can be manufactured on demand with a
hack to delay the dio read in __xfs_get_blocks(), however. E.g., stick a
'if (!create && direct) ssleep(N);' right before xfs_bmapi_read(), run a
single block dio read to a hole in the file, and then a single block
mapped write to the same offset as the read while it is delayed.

Brian


      reply	other threads:[~2016-10-31 16:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-31 14:14 [PATCH] xfs: don't BUG() on mixed direct and mapped I/O Brian Foster
2016-10-31 15:46 ` Christoph Hellwig
2016-10-31 16:25   ` Brian Foster [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=20161031162551.GB57171@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=hch@infradead.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;
as well as URLs for NNTP newsgroup(s).