linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Nikolay Borisov <nborisov@suse.com>, linux-btrfs@vger.kernel.org
Cc: wqu@suse.com, dsterba@suse.com
Subject: Re: [PATCH 2/2] btrfs: fix btrfs_find_device unused arg seed
Date: Fri, 25 Sep 2020 16:42:11 +0800	[thread overview]
Message-ID: <53868e52-9580-43ce-2ffc-9c48f04686f1@oracle.com> (raw)
In-Reply-To: <8d33a6d5-b2bd-aa58-5833-b321a6f4e9d2@suse.com>



On 25/9/20 4:22 pm, Nikolay Borisov wrote:
> 
> 
> On 24.09.20 г. 13:21 ч., Nikolay Borisov wrote:
>>
>>
>> On 24.09.20 г. 13:11 ч., Anand Jain wrote:
>>> commit 343694eee8d8 (btrfs: switch seed device to list api), missed to
>>> check if the last arg (seed) is true in the function btrfs_find_device().
>>> This arg tells whether to traverse through the seed device list or not.
>>>
>>> This means after the above commit the arg is always true, and the parent
>>> function which set this arg to false aren't effective.
>>>
>>> So we don't worry about the parent functions which set the last arg to
>>> true, instead there is only one parent with calling btrfs_find_device
>>> with the last arg false in device_list_add().
>>>
>>> But in fact, even the device_list_add() has no purpose that it has to set
>>> the last arg to false. Because the fs_devices always points to the
>>> device's fs_devices. So with the devid+uuid matching, it shall find the
>>> btrfs_device and returns. So naturally, it won't traverse through the
>>> seed fs_devices (if) present.
>>>
>>> So this patch makes it official that we don't need the last arg in the
>>> function btrfs_find_device() and it shall always traverse through the
>>> seed device list.
>>>
>>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>>
>> IMO the changelog could be vastly simplified by stating that following
>> commit 343694eee8d8 the seed argument is no longer used and can simply
>> be removed.
>>
>> In any case
>>
>> Reviewed-by: Nikolay Borisov <nborisov@suse.com>
>>
>>
> 
> 
> Actually I went back and it seems that I accidentally removed the
> portion of btrfs_find_device() which was predicated on seed bool
> parameter being true or false. So the correct thing to do is really to
> send a patch which adds it back and consider it a fix (i.e adding a
> Fixes: tag as well).
> 
> 
> OTOH - does it really make any difference? SO what if btrfs_find_device
> returns a device from fs_devices->seed_list  in device_list_add (which
> is called only from device scan)?
> 

There isn't bug as such. device scan is through the btrfs_control 
interface. So it depends on the device fsid to get fs_devices and it 
could never use seed_list with a genuine (non crafted) disk image.

Thanks, Anand

  reply	other threads:[~2020-09-25  8:42 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
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 [this message]
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=53868e52-9580-43ce-2ffc-9c48f04686f1@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.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).