All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org, dsterba@suse.com,
	nborisov@suse.com, josef@toxicpanda.com
Subject: Re: [PATCH 2/3] btrfs: include non-missing as a qualifier for the latest_bdev
Date: Sat, 2 May 2020 06:54:35 +0800	[thread overview]
Message-ID: <95c7db9e-70bc-ff14-b380-7de677ccbe9a@oracle.com> (raw)
In-Reply-To: <20200430134602.GM18421@twin.jikos.cz>



On 30/4/20 9:46 pm, David Sterba wrote:
> On Tue, Apr 28, 2020 at 11:22:26PM +0800, Anand Jain wrote:
>> btrfs_free_extra_devids() reorgs fs_devices::latest_bdev
>> to point to the bdev with greatest device::generation number.
>> For a typical-missing device the generation number is zero so
>> fs_devices::latest_bdev will never point to it.
>>
>> But if the missing device is due to alienation [1], then
>> device::generation is not-zero and if it is >= to rest of
>> device::generation in the list, then fs_devices::latest_bdev
>> ends up pointing to the missing device and reports the error
>> like this [2]
>>
>> [1] We maintain devices of a fsid (as in fs_device::fsid) in the
>> fs_devices::devices list, a device is considered as an alien device
>> if its fsid does not match with the fs_device::fsid
>>
>> $ mkfs.btrfs -fq /dev/sdd && mount /dev/sdd /btrfs
> 
> Please put each command on one line for clarity
> 

yep.

>> $ mkfs.btrfs -fq -draid1 -mraid1 /dev/sdb /dev/sdc
>> $ sleep 3 # avoid racing with udev's useless scans if needed
>> $ btrfs dev add -f /dev/sdb /btrfs
>> $ mount -o degraded /dev/sdc /btrfs1
> 
> So the cause is a second mkfs on some devices, but is the degraded mount
> supposed to work? The example goes:
> 
Yes. It must work. We don't know if the user is mounting B just after
mkfs or if it already contains some data.

> - create first filesystem with device A
> - create second filesystem with device B and C
> - add device B to the first filesystem, effectively making it missing
> - mount first filesystem, degraded because of the missing device
> 
> For a reproducer that's ok, but is this something that we can expect to
> happen in practice? The flag -f should prevent accidental overwrite, but
> yes the kernel code needs to deal with that in any case.
> 

Its a configuration related, so is left the user how they arrive at
their understanding of what configuration is suitable for them. Yes its
better to fix loop holes in its path. I encountered it when testing
something else.




  reply	other threads:[~2020-05-01 14:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 15:22 [PATCH v3 REBASED 0/3] btrfs: fix issues due to alien device Anand Jain
2020-04-28 15:22 ` [PATCH 1/3] btrfs: drop useless goto in open_fs_devices Anand Jain
2020-04-30 14:09   ` David Sterba
2020-04-28 15:22 ` [PATCH 2/3] btrfs: include non-missing as a qualifier for the latest_bdev Anand Jain
2020-04-30 13:46   ` David Sterba
2020-05-01 22:54     ` Anand Jain [this message]
2020-04-28 15:22 ` [PATCH 3/3] btrfs: free alien device due to device add Anand Jain
2020-04-30 13:31   ` David Sterba
2020-05-01 20:01     ` Anand Jain
2020-05-05 17:02       ` David Sterba
2020-05-04 18:58   ` [PATCH v4 2/3] btrfs: include non-missing as a qualifier for the latest_bdev Anand Jain
2020-05-04 18:58   ` [PATCH v4 3/3] btrfs: free alien device due to device add Anand Jain
2020-05-05 19:34     ` David Sterba
2020-05-05 23:40       ` Anand Jain
2020-04-30  6:05 ` [PATCH v3 REBASED 0/3] btrfs: fix issues due to alien device Nikolay Borisov
2020-04-30 17:54   ` Anand Jain
2020-04-30 10:28     ` Nikolay Borisov
2020-05-01 19:45       ` 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=95c7db9e-70bc-ff14-b380-7de677ccbe9a@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=josef@toxicpanda.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 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.