All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dave@jikos.cz>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: Enhance super validation check
Date: Mon, 7 Dec 2015 16:02:49 +0100	[thread overview]
Message-ID: <20151207150249.GQ26112@twin.jikos.cz> (raw)
In-Reply-To: <1449477555-10333-1-git-send-email-quwenruo@cn.fujitsu.com>

On Mon, Dec 07, 2015 at 04:39:15PM +0800, Qu Wenruo wrote:
> Enhance btrfs_check_super_valid() function by the following points:
> 1) Restrict sector/node size check
>    Not the old max/min valid check, but also check if it's a power of 2.
>    So some bogus number like 12K nodesize won't pass now.
> 
> 2) Super flag check
>    Except some common one like WRITTEN and RELOC, and other one used in
>    btrfs-progs, unrecognized flag will cause btrfs refuse to mount.
> 
> 3) Better root alignment check
>    Now root bytenr is checked against sectorsize.
> 
> 4) Move some check into btrfs_check_super_valid().
>    Like nodesize vs leafsize check, and PAGESIZE vs sectorsize check.
>    And MAGIC check.
> 
> Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

Good, the code is better structured now, eg. the sb magic check came too
late before.

> @@ -4005,31 +3993,47 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
>  	}
>  
>  	/*
> -	 * The common minimum, we don't know if we can trust the nodesize/sectorsize
> -	 * items yet, they'll be verified later. Issue just a warning.
> +	 * Check sectorsize and nodesize first, some other check will need it.
> +	 * XXX: Just do a favor for later subpage size check. Check all

Please do not add new XXX or TODO markers to the sources. The comment
would be fine with just:

	 "Check all possible sectorsizes (4K, 8K, 16K, 32K, 64K) here."

With that fixed,

Reviewed-by: David Sterba <dsterba@suse.com>

      parent reply	other threads:[~2015-12-07 16:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07  8:39 [PATCH] btrfs: Enhance super validation check Qu Wenruo
2015-12-07 11:48 ` Holger Hoffstätte
2015-12-07 14:11   ` Qu Wenruo
2015-12-07 15:02 ` David Sterba [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=20151207150249.GQ26112@twin.jikos.cz \
    --to=dave@jikos.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.