public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: dsterba@suse.cz, Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 2/4] btrfs: Add incompat flags check for btrfs_check_super_valid()
Date: Tue, 24 Apr 2018 13:30:47 +0200	[thread overview]
Message-ID: <20180424113047.GD21272@twin.jikos.cz> (raw)
In-Reply-To: <057e31d8-f01d-267c-0498-50562a34d11b@gmx.com>

On Tue, Apr 24, 2018 at 07:28:27PM +0800, Qu Wenruo wrote:
> > I've read the discussion under previous version again, IMHO the best way
> > to report what's going on is to use 2 functions for mount ant pre-commit
> > time.
> 
> OK, next version will go that direction.
> 
> Although it may still be a little tricky to split what we need in
> btrfs_validate_super() and btrfs_precheck_super().
> 
> What about this idea:
> - btrfs_precheck_super() only checks the very basis:
>   * magic
>   * incompat flags
>   * csum type
>   Any mismatch will do friendly prompt ("no btrfs detected" or
>   "unsupported flags/csum type" respectively)
> 
> - btrfs_validate_super() do the comprehensive check:
>   * Everything we did in this patchset
>   * including magic, incompat flags and csum type
>   Any mismatch will be considered as corruption.
> 
> For mount time, we call btrfs_precheck_super() then btrfs_validate_super().
> 
> For commit time, only btrfs_validate_super().
> 
> How about this solution?

I'd do that the other way around:

* mount checks: btrfs_validate_super - the superblock on disk must be
  valid before we mount it

  btrfs_validate_super()

* pre-commit checks: the superblock must be valid and we can also do
  some additional checks to detect in-memory corruption

  btrfs_super_precommit_check()
	  btrfs_validate_super()
	  if (incompat) {
		  ...
	  }

  reply	other threads:[~2018-04-24 11:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-24  4:48 [PATCH v2 0/4] btrfs: Add write time super block validation Qu Wenruo
2018-04-24  4:48 ` [PATCH v2 1/4] btrfs: Rename btrfs_check_super_valid() to btrfs_validate_super() Qu Wenruo
2018-04-24  4:48 ` [PATCH v2 2/4] btrfs: Add incompat flags check for btrfs_check_super_valid() Qu Wenruo
2018-04-24 10:48   ` David Sterba
2018-04-24 11:28     ` Qu Wenruo
2018-04-24 11:30       ` David Sterba [this message]
2018-04-24 12:03         ` Qu Wenruo
2018-04-24  4:48 ` [PATCH v2 3/4] btrfs: Add csum type " Qu Wenruo
2018-04-24  4:48 ` [PATCH v2 4/4] btrfs: Do super block verification before writing it to disk Qu Wenruo
2018-04-24 13:14   ` David Sterba
2018-05-10 14:43 ` [PATCH v2 0/4] btrfs: Add write time super block validation David Sterba
2018-05-11  2:57   ` Qu Wenruo

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=20180424113047.GD21272@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=wqu@suse.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