public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: "'linux-xfs@oss.sgi.com'" <linux-xfs@oss.sgi.com>
Subject: Re: [PATCH, RFC] xfs: don't verify checksum on non-V5 superblocks
Date: Fri, 16 Aug 2013 07:00:18 +1000	[thread overview]
Message-ID: <20130815210018.GR6023@dastard> (raw)
In-Reply-To: <520D1BA3.1050500@redhat.com>

On Thu, Aug 15, 2013 at 01:19:15PM -0500, Eric Sandeen wrote:
> The current test in xfs_sb_read_verify() will attempt to validate
> an sb checksum if sb_crc is non-zero, even if the superblock is not
> marked as being version 5.
> 
> This runs the risk of picking up random garbage in sb_crc for non-V5
> superblocks; such garbage is known to exist in the wild due to prior bugs.
> This will cause verification to fail for otherwise non-fatal reasons.
> 
> I'm not sure of the point of trying to validate a non-V5 superblock;
> is there one?  Shouldn't this || be an &&?  (Can sb_crc validly be
> 0 for a V5 SB?)

I don't think so.

As I mentioned on the call, the reason for this check is that if we
have a CRC set and a non-v5 superblock version, we may have a
corrupt superblock with bit errors in it. In this case, we check the
CRC to determine if the superblock is intact. If the CRC validates,
then it means that we wrote a bad superblock to disk (i.e. a code
bug). If it doesn't validate, then the superblock is in a corrupt
state because all fields not understood by the v4 superblock should
be zero.

That's why if the checksum fails we are returning EFSCORRUPTED.

The problem we see here is not the validation of the primary
superblock - it's the secondary superblocks that have been written
by growfs that are the problem. We already know that we are
verifying a secondary superblock by the "check_inprogress"
parameter. Hence if we get this problem on a secondary superblock we
can verify it against the primary superblock via the struct
xfs_mount (i.e. mp->m_sb.sb_versionnum) and determine whether we do
indeed have a v4 or v5 superblock and hence determine whether we
should error out or just warn about it.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

  parent reply	other threads:[~2013-08-15 21:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 18:19 [PATCH, RFC] xfs: don't verify checksum on non-V5 superblocks Eric Sandeen
2013-08-15 19:45 ` Ben Myers
2013-08-15 21:00 ` Dave Chinner [this message]
2013-08-15 21:15   ` Eric Sandeen
2013-08-15 22:41     ` [PATCH, RFC] xfs: be more forgiving of a v4 secondary sb w/ junk in v5 fields Eric Sandeen
2013-08-15 23:15       ` Dave Chinner
2013-09-09 20:33       ` [PATCH V2] " Eric Sandeen
2013-09-09 21:08         ` Mark Tinguely
2013-09-09 21:10           ` Eric Sandeen
2013-09-09 21:16             ` Mark Tinguely
2013-10-31 15:51         ` Ben Myers
2013-10-17 20:17       ` [PATCH, RFC] " 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=20130815210018.GR6023@dastard \
    --to=david@fromorbit.com \
    --cc=linux-xfs@oss.sgi.com \
    --cc=sandeen@redhat.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