linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 02/11] btrfs-progs: call warn() for missing device
Date: Wed, 19 Jul 2023 22:34:58 +0800	[thread overview]
Message-ID: <7dd5f32f-43e5-d8f9-1ce6-1411c66adc31@oracle.com> (raw)
In-Reply-To: <21fbff59-909f-ff39-1b35-197fe14be4b1@oracle.com>

On 18/07/2023 02:22, Anand Jain wrote:
> 
> 
> On 14/07/2023 02:48, David Sterba wrote:
>> On Fri, Jul 07, 2023 at 11:52:32PM +0800, Anand Jain wrote:
>>> When we add a struct btrfs_device for the missing device, announce a
>>> warning indicating that a device is missing.
>>>
>>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>>> ---
>>>   kernel-shared/volumes.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c
>>> index 92282524867d..d20cb3177a34 100644
>>> --- a/kernel-shared/volumes.c
>>> +++ b/kernel-shared/volumes.c
>>> @@ -2252,6 +2252,7 @@ static int read_one_dev(struct btrfs_fs_info 
>>> *fs_info,
>>>       device = btrfs_find_device(fs_info, devid, dev_uuid, fs_uuid);
>>>       if (!device) {
>>> +        warning("device id %llu is missing", devid);
>>
>> read_one_dev() is a low level helper that should not print any messages,
>> the calling context is not known. If you really want to print such
>> message then please move it to the appropriate caller.

Furthermore, there is only one caller from the top function:
open_ctree context.

__open_ctree_fd()
  btrfs_setup_chunk_tree_and_device_map()
   btrfs_read_chunk_tree()
    read_one_dev()

Do you remember any failing test cases or potential concerns
if we print the identified missing device information here?


Thanks.

> 
> The motivation for adding the warning comes from the following test:
> Despite the missing device, btrfstune -m was still able to change
> the fsid.
> 
>      $ mkfs.btrfs -f -dsingle -msingle /dev/sdb1 /dev/sdb2
>      $ wipefs -a /dev/sdb2
>      $ btrfstune -m /dev/sdb1
> 
> This series fixes the bug; that is, it makes btrfstune fail in this
> test case and this particular patch reports the missing device.
> 
> Which is similar to the behavior in the kernel code.
> 
> read_one_dev() function is only used by btrfs_read_chunk_tree(),
> which is not aware of the missing device through the returned
> error code.
> 
> Perhaps we can make an exception here?
> 



> Thanks.
>>
>>>           device = kzalloc(sizeof(*device), GFP_NOFS);
>>>           if (!device)
>>>               return -ENOMEM;
>>> -- 
>>> 2.39.3


  reply	other threads:[~2023-07-19 14:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 15:52 [PATCH 00/11] btrfs-progs: fix bugs and CHANGING_FSID_V2 flag Anand Jain
2023-07-07 15:52 ` [PATCH 01/11] btrfs-progs: fix duplicate missing device Anand Jain
2023-07-07 15:52 ` [PATCH 02/11] btrfs-progs: call warn() for " Anand Jain
2023-07-13 18:48   ` David Sterba
2023-07-17 18:22     ` Anand Jain
2023-07-19 14:34       ` Anand Jain [this message]
2023-07-07 15:52 ` [PATCH 03/11] btrfs-progs: track missing device counter Anand Jain
2023-07-07 15:52 ` [PATCH 04/11] btrfs-progs: NULL initialize device name for missing Anand Jain
2023-07-07 15:52 ` [PATCH 05/11] btrfs-progs: tune: check for missing device Anand Jain
2023-07-13 18:49   ` David Sterba
2023-07-17 19:02     ` Anand Jain
2023-07-07 15:52 ` [PATCH 06/11] btrfs-progs: track changing_fsid flag in fs_devices Anand Jain
2023-07-07 15:52 ` [PATCH 07/11] btrfs-progs: track num_devices per fs_devices Anand Jain
2023-07-07 15:52 ` [PATCH 08/11] btrfs-progs: track total_devs in fs devices Anand Jain
2023-07-13 18:58   ` David Sterba
2023-07-17 19:28     ` Anand Jain
2023-07-07 15:52 ` [PATCH 09/11] btrfs-progs: track active metadata_uuid per fs_devices Anand Jain
2023-07-07 15:52 ` [PATCH 10/11] btrfs-progs: add helper to reunite devices with same metadata_uuid Anand Jain
2023-07-07 15:52 ` [PATCH 11/11] btrfs-progs: tune: fix incomplete fsid_change Anand Jain
2023-07-13 18:57   ` David Sterba
2023-07-17 19:25     ` Anand Jain
2023-07-20 14:33       ` 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=7dd5f32f-43e5-d8f9-1ce6-1411c66adc31@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /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).