From: Dave Chinner <david@fromorbit.com>
To: Mark Tinguely <tinguely@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/2] xfs: check LSN ordering for v5 superblocks during recovery
Date: Thu, 29 Aug 2013 07:02:24 +1000 [thread overview]
Message-ID: <20130828210223.GO12779@dastard> (raw)
In-Reply-To: <521E625A.2070109@sgi.com>
On Wed, Aug 28, 2013 at 03:49:30PM -0500, Mark Tinguely wrote:
> On 08/28/13 06:22, Dave Chinner wrote:
> >From: Dave Chinner<dchinner@redhat.com>
> >
> >Log recovery has some strict ordering requirements which unordered
> >or reordered metadata writeback can defeat. This can occur when an
> >item is logged in a transaction, written back to disk, and then
> >logged in a new transaction before the tail of the log is moved past
> >the original modification.
> >
> >The result of this is that when we read an object off disk for
> >recovery purposes, the buffer that we read may not contain the
> >object type that recovery is expecting and hence at the end of the
> >checkpoint being recovered we have an invalid object in memory.
> >
> >This isn't usually a problem, as recovery will then replay all the
> >other checkpoints and that brings the object back to a valid and
> >correct state, but the issue is that while the object is in the
> >invalid state it can be flushed to disk. This results in the object
> >verifier failing and triggering a corruption shutdown of log
> >recover. This is correct behaviour for the verifiers - the problem
> >is that we are not detecting that the object we've read off disk is
> >newer than the transaction we are replaying.
> >
> >All metadata in v5 filesystems has the LSN of it's last modification
> >stamped in it. This enabled log recover to read that field and
> >determine the age of the object on disk correctly. If the LSN of the
> >object on disk is older than the transaction being replayed, then we
> >replay the modification. If the LSN of the object matches or is more
> >recent than the transaction's LSN, then we should avoid overwriting
> >the object as that is what leads to the transient corrupt state.
> >
> >Signed-off-by: Dave Chinner<dchinner@redhat.com>
> >---
>
>
> >@@ -2488,7 +2595,7 @@ xlog_recover_buffer_pass2(
> > xlog_recover_do_reg_buffer(mp, item, bp, buf_f);
> > }
> > if (error)
> >- return XFS_ERROR(error);
> >+ goto out_release;
> >
>
> This adds a xfs_buf_relse() on the buffer in the error path. The
> reference was taken in this routine. The callers do not know of the
> buffer and can't release it. convinced me.
>
>
> > /*
> > * Perform delayed write on the buffer. Asynchronous writes will be
> >@@ -2517,6 +2624,7 @@ xlog_recover_buffer_pass2(
> > xfs_buf_delwri_queue(bp, buffer_list);
> > }
> >
> >+out_release:
> > xfs_buf_relse(bp);
> > return error;
>
> Looks good. Nice to get into Linux 3.12 and possibly back to stable.
Why stable? It's v5 only code, and everyon knows that is still in
the experimental stage....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-08-28 21:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-28 11:22 [PATCH 0/2] xfs: prevent transient corrupt states during log recovery Dave Chinner
2013-08-28 11:22 ` [PATCH 1/2] xfs: btree block LSN escaping to disk uninitialised Dave Chinner
2013-08-28 20:31 ` Mark Tinguely
2013-08-28 20:57 ` Dave Chinner
2013-08-30 18:41 ` Ben Myers
2013-08-28 11:22 ` [PATCH 2/2] xfs: check LSN ordering for v5 superblocks during recovery Dave Chinner
2013-08-28 20:49 ` Mark Tinguely
2013-08-28 21:02 ` Dave Chinner [this message]
2013-08-28 21:07 ` Mark Tinguely
2013-08-28 21:31 ` Dave Chinner
2013-08-28 21:43 ` Mark Tinguely
2013-08-28 22:34 ` Dave Chinner
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=20130828210223.GO12779@dastard \
--to=david@fromorbit.com \
--cc=tinguely@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