From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz, Qu Wenruo <quwenruo.btrfs@gmx.com>,
Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org, Nathan Dehnel <ncdehnel@gmail.com>
Subject: Re: [PATCH] btrfs: resize: Allow user to shrink missing device
Date: Wed, 20 Nov 2019 13:52:56 +0800 [thread overview]
Message-ID: <925c1064-02a6-916b-a1b9-a1be15545800@oracle.com> (raw)
In-Reply-To: <20191119143444.GT3001@twin.jikos.cz>
On 11/19/19 10:34 PM, David Sterba wrote:
> On Tue, Nov 19, 2019 at 03:40:42PM +0800, Anand Jain wrote:
>> IMO changing the size of the missing device is point less. What if
>> in between the resize and replace the missing device reappears
>> in the following unmount and mount.
>
> The reappearing device is always tricky. If the device is missing from
> the beginning, it'll exist in the fs_devices structure with MISSING bit
> set. If it reappears, device_list_add will find it, update the path and
> drop the missing bit.
Right.
> From that point the device is regular but might miss some data updates.
Um no its not regular yet. If the device has reappeared after mount it
won't be part of the dev_alloc_list, so no new chunks are allocated
on it. It needs patch [1] to be regular but as I said in other
thread its better not to do that unless writehole is fixed.
[1] [PATCH] btrfs: handle dynamically reappearing missing device
> There's a check for last generation of the device to pick the latest
> one, but this applies only to mount.
This will work as long as there is only one umount mount sequence.
A umount mount sequence of two times will make generation on all disks
equal including device with missing some data. But that's fine..
> Now when there's a replace in progress, and on a redundant profile, like
> in the reported case, the device can be used as source device as long as
> the data are not stale. This is detected by generation mismatch.
Right. Reading dev_items are safe as they are read from the tree.
(Just off topic - but non-inline file data are not so lucky in this
scenario as they are read off-tree and there is no header, ML patch:
"[PATCH] fstests: btrfs test read from disks of different generation"
reproduced it).
> The resize of missing device happens on the in-memory structure as it is
> represented in the fs_devices list, before the device reappears. And
> after it's scanned again, the device item in memory is not changed, so
> the size stays and is used until replace finishes.
Right, I checked it, it looks safe now. Thanks for verifying it.
> Which is IMO all ok for the usecase, but the device states are tricky so
> I could have missed something.
Missing device state was only relevant here.. I can't think of any
other.
Thanks, Anand
prev parent reply other threads:[~2019-11-20 5:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-18 7:05 [PATCH] btrfs: resize: Allow user to shrink missing device Qu Wenruo
2019-11-18 11:38 ` Anand Jain
2019-11-18 12:02 ` Qu Wenruo
2019-11-19 7:40 ` Anand Jain
2019-11-19 7:54 ` Qu Wenruo
2019-11-19 8:03 ` Qu Wenruo
2019-11-19 14:34 ` David Sterba
2019-11-20 5:52 ` Anand Jain [this message]
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=925c1064-02a6-916b-a1b9-a1be15545800@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=ncdehnel@gmail.com \
--cc=quwenruo.btrfs@gmx.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).