From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: tree-checker: Fix wrong check on max devid
Date: Wed, 28 Aug 2019 07:26:51 +0800 [thread overview]
Message-ID: <1c281539-89b6-e4c6-9c12-bb0b7bb9708d@oracle.com> (raw)
In-Reply-To: <20190827140511.7081-1-wqu@suse.com>
On 27/8/19 10:05 PM, Qu Wenruo wrote:
> Btrfs doesn't reuse devid, thus if we add and delete device in a loop,
> we can increase devid to higher value, triggering tree checker to give a
> false alert.
>
> Furthermore, we have dev extent verification already (after
> tree-checker, at mount time).
> So even if user had bitflip on some dev items, we can still detect it
> and refuse to mount.
>
> Reported-by: Anand Jain <anand.jain@oracle.com>
> Fixes: ab4ba2e13346 ("btrfs: tree-checker: Verify dev item")
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> Changelog:
> v2:
> - Remove devid check completely
> As we already have verify_one_dev_extent().
> ---
> fs/btrfs/tree-checker.c | 8 --------
> 1 file changed, 8 deletions(-)
>
> diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
> index 43e488f5d063..076d5b8014fb 100644
> --- a/fs/btrfs/tree-checker.c
> +++ b/fs/btrfs/tree-checker.c
> @@ -686,9 +686,7 @@ static void dev_item_err(const struct extent_buffer *eb, int slot,
> static int check_dev_item(struct extent_buffer *leaf,
> struct btrfs_key *key, int slot)
> {
> - struct btrfs_fs_info *fs_info = leaf->fs_info;
> struct btrfs_dev_item *ditem;
> - u64 max_devid = max(BTRFS_MAX_DEVS(fs_info), BTRFS_MAX_DEVS_SYS_CHUNK);
>
> if (key->objectid != BTRFS_DEV_ITEMS_OBJECTID) {
> dev_item_err(leaf, slot,
> @@ -696,12 +694,6 @@ static int check_dev_item(struct extent_buffer *leaf,
> key->objectid, BTRFS_DEV_ITEMS_OBJECTID);
> return -EUCLEAN;
> }
> - if (key->offset > max_devid) {
> - dev_item_err(leaf, slot,
> - "invalid devid: has=%llu expect=[0, %llu]",
> - key->offset, max_devid);
> - return -EUCLEAN;
> - }
> ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item);
> if (btrfs_device_id(leaf, ditem) != key->offset) {
> dev_item_err(leaf, slot,
>
Though ab4ba2e13346 didn't add BTRFS_MAX_DEVS_SYS_CHUNK,
BTRFS_MAX_DEVS_SYS_CHUNK is unused now, can be deleted.
The reproducer script and logs should rather be in this change log.
Thanks, Anand
next prev parent reply other threads:[~2019-08-27 23:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 14:05 [PATCH v2] btrfs: tree-checker: Fix wrong check on max devid Qu Wenruo
2019-08-27 23:26 ` Anand Jain [this message]
2019-08-28 1:16 ` WenRuo Qu
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=1c281539-89b6-e4c6-9c12-bb0b7bb9708d@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--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