From: Anand Jain <anand.jain@oracle.com>
To: Nikolay Borisov <nborisov@suse.com>, linux-btrfs@vger.kernel.org
Cc: Johannes.Thumshirn@wdc.com
Subject: Re: [PATCH v2] btrfs: free device without BTRFS_MAGIC
Date: Thu, 24 Sep 2020 19:55:11 +0800 [thread overview]
Message-ID: <64b0a260-c5da-cf23-c030-4fd9cfaac735@oracle.com> (raw)
In-Reply-To: <a0dc643f-81ee-8450-1371-d5c7f89dd8db@suse.com>
On 23/9/20 7:09 pm, Nikolay Borisov wrote:
>
>
> 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 ?
>
This is fix for btrfs/198.
> <snip>
>
next prev parent reply other threads:[~2020-09-24 11:55 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
2020-09-24 11:55 ` Anand Jain [this message]
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=64b0a260-c5da-cf23-c030-4fd9cfaac735@oracle.com \
--to=anand.jain@oracle.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@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).