linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Josef Bacik <josef@toxicpanda.com>, linux-btrfs@vger.kernel.org
Cc: nborisov@suse.com, wqu@suse.com, dsterba@suse.com
Subject: Re: [PATCH 1/2] btrfs: drop never met condition of disk_total_bytes == 0
Date: Tue, 6 Oct 2020 20:53:31 +0800	[thread overview]
Message-ID: <6db564ab-33e9-17cd-3ccd-9f3c2c6cf23c@oracle.com> (raw)
In-Reply-To: <2a768517-2ab4-8671-5d70-e80ed01e406d@toxicpanda.com>



On 5/10/20 9:22 pm, Josef Bacik wrote:
> On 9/24/20 6:11 AM, Anand Jain wrote:
>> btrfs_device::disk_total_bytes is set even for a seed device (the
>> comment is wrong).
>>
>> The function fill_device_from_item() does the job of reading it from the
>> item and updating btrfs_device::disk_total_bytes. So both the missing
>> device and the seed devices do have their disk_total_bytes updated.
>>
>> So this patch removes the check dev->disk_total_bytes == 0 in the
>> function verify_one_dev_extent()
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> 
> Ok I understand that logically this check is incorrect, however we pull 
> this value from the device item, which could be corrupt.  I'm looking 
> around and I don't see a similar check in any of our other code, it 
> should probably go in check_dev_item() maybe?  I think that removing 
> this check is ok, but we need to make sure we catch the invalid case 
> where total_disk_bytes == 0 somewhere, so please add that in the 
> appropriate place.  Thanks,

We could check the upper limit based on the device size. But we can't
check for zero, because while removing the device if there is a power
loss, we could have a device with its total_bytes = 0, that's still
valid. I shall make this check in v2 in read_one_dev() as we need a
valid device->bdev.

But I have a question though- we have csum for everything to determine
offline corruption at the time of reading, so corruptions are taken care
of. An authenticated mount is a holistic fix for the crafted image
problems, and systems that aren't secured appropriately may be exposed
to crafted image problems. So do we have to handle each one of those
corruption/crafted-image cases independently, then?

Thanks, Anand

> 
> Josef

  reply	other threads:[~2020-10-06 12:53 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 10:11 [PATCH 0/2] fix verify_one_dev_extent and btrfs_find_device Anand Jain
2020-09-24 10:11 ` [PATCH 1/2] btrfs: drop never met condition of disk_total_bytes == 0 Anand Jain
2020-09-24 11:48   ` Nikolay Borisov
2020-09-24 11:58     ` Qu Wenruo
2020-09-24 12:19       ` Qu Wenruo
2020-09-25  4:17     ` Anand Jain
2020-09-25  6:19       ` Nikolay Borisov
2020-09-25  7:33         ` Anand Jain
2020-09-25  7:56           ` Nikolay Borisov
2020-09-25  8:12             ` Anand Jain
2020-10-05 13:22   ` Josef Bacik
2020-10-06 12:53     ` Anand Jain [this message]
2020-10-06 12:54   ` [PATCH v2 " Anand Jain
2020-10-21  4:16     ` [PATCH RESEND " Anand Jain
2020-10-21 14:35     ` Josef Bacik
2020-10-22  9:40       ` Anand Jain
2020-10-29 21:30     ` Anand Jain
2020-09-24 10:11 ` [PATCH 2/2] btrfs: fix btrfs_find_device unused arg seed Anand Jain
2020-09-24 10:21   ` Nikolay Borisov
2020-09-25  8:22     ` Nikolay Borisov
2020-09-25  8:42       ` Anand Jain
2020-10-05 13:23   ` Josef Bacik
2020-10-21  4:16   ` [PATCH RESEND " Anand Jain
2020-10-29 21:30   ` [PATCH RESEND v2 " Anand Jain
2020-10-02  3:14 ` [PATCH 0/2] fix verify_one_dev_extent and btrfs_find_device Anand Jain
2020-10-21  4:16 ` [PATCH RESEND " Anand Jain
2020-10-29 21:02 ` David Sterba
2020-10-29 21:14   ` Anand Jain
2020-11-11 15:49     ` David Sterba
2020-10-29 21:30 ` Anand Jain

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=6db564ab-33e9-17cd-3ccd-9f3c2c6cf23c@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.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;
as well as URLs for NNTP newsgroup(s).