All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Cc: Johannes.Thumshirn@wdc.com
Subject: Re: [PATCH v2] btrfs: free device without BTRFS_MAGIC
Date: Wed, 23 Sep 2020 14:09:52 +0300	[thread overview]
Message-ID: <a0dc643f-81ee-8450-1371-d5c7f89dd8db@suse.com> (raw)
In-Reply-To: <1ee9b318e3bb851aaec9c1efd1eadb117ad46638.1600741332.git.anand.jain@oracle.com>



On 22.09.20 г. 6:13 ч., Anand Jain wrote:
> Many things can happen after the device is scanned and before the device
> is mounted.
> 
> One such thing is losing the BTRFS_MAGIC on the device.
> 
> If it happens we still won't free that device from the memory and causes
> the userland to confuse.
> 
> For example: As the BTRFS_IOC_DEV_INFO still carries the device path which
> does not have the BTRFS_MAGIC, the btrfs fi show still shows device
> which does not belong. As shown below.
> 
> mkfs.btrfs -fq -draid1 -mraid1 /dev/sda /dev/sdb
> 
> wipefs -a /dev/sdb
> mount -o degraded /dev/sda /btrfs
> btrfs fi show -m
> 
> /dev/sdb does not contain BTRFS_MAGIC and we still show it as part of
> btrfs.
> Label: none  uuid: 470ec6fb-646b-4464-b3cb-df1b26c527bd
>         Total devices 2 FS bytes used 128.00KiB
>         devid    1 size 3.00GiB used 571.19MiB path /dev/sda
>         devid    2 size 3.00GiB used 571.19MiB path /dev/sdb
> 
> Fix is to return -ENODATA error code in btrfs_read_dev_one_super()
> when BTRFS_MAGIC check fails, and its parent open_fs_devices() to
> free the device in the mount-thread.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Has an fstest for this been submitted ?

<snip>

  reply	other threads:[~2020-09-23 11:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-19  2:52 [PATCH] btrfs: free device without BTRFS_MAGIC Anand Jain
2020-09-21  9:44 ` Johannes Thumshirn
2020-09-21 10:52 ` Johannes Thumshirn
2020-09-21 11:19   ` Anand Jain
2020-09-22  3:13 ` [PATCH v2] " Anand Jain
2020-09-23 11:09   ` Nikolay Borisov [this message]
2020-09-24 11:55     ` Anand Jain
2020-09-28 18:14   ` Josef Bacik
2020-09-30  7:21     ` Anand Jain
2020-09-30 12:41       ` Josef Bacik
2020-09-30 13:09 ` [PATCH v3] " Anand Jain
2020-10-01  1:05   ` Anand Jain
2020-10-01 10:49   ` David Sterba

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=a0dc643f-81ee-8450-1371-d5c7f89dd8db@suse.com \
    --to=nborisov@suse.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=anand.jain@oracle.com \
    --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 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.