public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Ben Myers <bpm@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 1/5] xfs: don't try to mark uncached buffers stale on error.
Date: Wed, 25 Sep 2013 06:32:32 +1000	[thread overview]
Message-ID: <20130924203232.GA26872@dastard> (raw)
In-Reply-To: <20130924153324.GF1935@sgi.com>

On Tue, Sep 24, 2013 at 10:33:24AM -0500, Ben Myers wrote:
> Hi Dave,
> 
> On Tue, Sep 24, 2013 at 04:01:12PM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > fsstress failed during a shutdown with the following assert:
> > 
> > XFS: Assertion failed: xfs_buf_islocked(bp), file: fs/xfs/xfs_buf.c, line: 143
> > .....
> >  xfs_buf_stale+0x3f/0xf0
> >  xfs_bioerror_relse+0x2d/0x90
> >  xfsbdstrat+0x51/0xa0
> 
> Here you're showing an assert reported through an xfsbdstrat codepath...
> 
> >  xfs_zero_remaining_bytes+0x1d1/0x2d0
> >  xfs_free_file_space+0x5d0/0x600
> >  xfs_change_file_space+0x251/0x3a0
> >  xfs_ioc_space+0xcc/0x130
> > .....
> > 
> > xfs_zero_remaining_bytes() works with uncached buffers, and hence if
> > we are preventing IO due to a shutdown, we should not be marking it
> > stale as that is only for cached buffers. Instead, just mark it with
> > an error and make sure it gets to the caller.
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > ---
> >  fs/xfs/xfs_buf.c | 31 +++++++++++++++----------------
> >  1 file changed, 15 insertions(+), 16 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > index 2634700..956685f 100644
> > --- a/fs/xfs/xfs_buf.c
> > +++ b/fs/xfs/xfs_buf.c
> > @@ -1093,25 +1093,20 @@ xfs_bioerror_relse(
> >  	struct xfs_buf	*bp)
> >  {
> >  	int64_t		fl = bp->b_flags;
> > +
> >  	/*
> > -	 * No need to wait until the buffer is unpinned.
> > -	 * We aren't flushing it.
> > -	 *
> > -	 * chunkhold expects B_DONE to be set, whether
> > -	 * we actually finish the I/O or not. We don't want to
> > -	 * change that interface.
> > +	 * No need to wait until the buffer is unpinned. We aren't flushing it.
> >  	 */
> >  	XFS_BUF_UNREAD(bp);
> >  	XFS_BUF_DONE(bp);
> >  	xfs_buf_stale(bp);
> >  	bp->b_iodone = NULL;
> > +
> > +	/*
> > +	 * There's no reason to mark error for ASYNC buffers as there is no-one
> > +	 * waiting to collect the error.
> > +	 */
> >  	if (!(fl & XBF_ASYNC)) {
> > -		/*
> > -		 * Mark b_error and B_ERROR _both_.
> > -		 * Lot's of chunkcache code assumes that.
> > -		 * There's no reason to mark error for
> > -		 * ASYNC buffers.
> > -		 */
> >  		xfs_buf_ioerror(bp, EIO);
> >  		complete(&bp->b_iowait);
> >  	} else {
> > @@ -1128,11 +1123,15 @@ xfs_bdstrat_cb(
> >  	if (XFS_FORCED_SHUTDOWN(bp->b_target->bt_mount)) {
> >  		trace_xfs_bdstrat_shut(bp, _RET_IP_);
> >  		/*
> > -		 * Metadata write that didn't get logged but
> > -		 * written delayed anyway. These aren't associated
> > -		 * with a transaction, and can be ignored.
> > +		 * If this is a cached write, then it is likely to be a delayed
> > +		 * write metadata buffer that can be ignored because the
> > +		 * contents are logged. If it's an uncached buffer or a read
> > +		 * operation, then the caller will get the error through the
> > +		 * normal IO completion path. We can tell if the buffer is
> > +		 * cached or not by looking to see if the b_pag field is NULL or
> > +		 * not.
> >  		 */
> > -		if (!bp->b_iodone && !XFS_BUF_ISREAD(bp))
> > +		if (!bp->b_iodone && !XFS_BUF_ISREAD(bp) && bp->b_pag)
> 
> ...but it looks like your fix is in xfs_bdstrat_cb, which wouldn't have been
> involved in the stack you posted above.  What am I missing?

That the first hunk that changes xfs_bioerror_relse() fixes the bug
that caused the assert failure through xfsbdstrat().

However, if we issue the uncached IO through bwrite() rather than
xfsbdstrat() directly, we need to fix xfs_bdstrat_cb() to handle
uncached buffers appropriately.

i.e. there are multiple IO path call-chain and they all need to call
the correct error handler for uncached buffers....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2013-09-24 20:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-24  6:01 [PATCH 0/5] xfs: fixes for 3.12-rc3 Dave Chinner
2013-09-24  6:01 ` [PATCH 1/5] xfs: don't try to mark uncached buffers stale on error Dave Chinner
2013-09-24 15:31   ` Mark Tinguely
2013-09-24 15:33   ` Ben Myers
2013-09-24 20:32     ` Dave Chinner [this message]
2013-09-24 20:59       ` Ben Myers
2013-09-25  0:31         ` Dave Chinner
2013-09-24  6:01 ` [PATCH 2/5] xfs: lock the AIL before removing the buffer item Dave Chinner
2013-09-24 16:12   ` Mark Tinguely
2013-09-24  6:01 ` [PATCH 3/5] xfs: asserting lock not held during freeing not valid Dave Chinner
2013-09-24 17:17   ` Mark Tinguely
2013-09-24  6:01 ` [PATCH 4/5] xfs: fix XFS_IOC_FREE_EOFBLOCKS definition Dave Chinner
2013-09-24 16:13   ` Mark Tinguely
2013-09-24  6:01 ` [PATCH 5/5] xfs: log recovery lsn ordering needs uuid check Dave Chinner
2013-09-24 17:14   ` Ben Myers
2013-09-24 17:46 ` [PATCH 0/5] xfs: fixes for 3.12-rc3 Ben Myers

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=20130924203232.GA26872@dastard \
    --to=david@fromorbit.com \
    --cc=bpm@sgi.com \
    --cc=xfs@oss.sgi.com \
    /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