* BTRFS_IOC_DEVICES_READY and removed devices
@ 2012-09-17 22:46 Kay Sievers
2012-09-18 13:09 ` Josef Bacik
0 siblings, 1 reply; 2+ messages in thread
From: Kay Sievers @ 2012-09-17 22:46 UTC (permalink / raw)
To: btrfs; +Cc: Lennart Poettering, Harald Hoyer
We are currently playing around with native btrfs multi-device support
in systemd. We already committed the needed pieces to systemd git, to
register all detected btrfs filesystems with the kernel.
For volumes which are listed in fstab for mounting, we delay the
actual mount-attempt of a multi-device volume until we see READY
returned from BTRFS_IOC_DEVICES_READY. A line with UUID= in /etc/fstab
with "nofail" in the options field, and we can boot up without any
device plugged in. Now plugging in devices one-after-the-other until
the volume has a full tree of devices; with the last device there,
systemd just mounts the volume as expected.
This seems to work very well so far, unless a device which is already
registered disappears, which is a kind of valid hotplug scenario we
should handle better:
If one device of a 2-device volume is registered with the in-kernel
cache, and then the device is unplugged from the system, the cache
state does not get updated. If then the other device of the 2-device
volume is registered, BTRFS_IOC_DEVICES_READY indicates ready; but in
fact only one of two needed devices are available at that time, and
mounting fails.
Can we somehow subscribe to device media-changes/removal to prevent
the stale device state in the in-kernel cache?
Or alternatively make BTRFS_IOC_DEVICES_READY re-validate all involved
block devices before it returns READY?
Thanks,
Kay
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: BTRFS_IOC_DEVICES_READY and removed devices
2012-09-17 22:46 BTRFS_IOC_DEVICES_READY and removed devices Kay Sievers
@ 2012-09-18 13:09 ` Josef Bacik
0 siblings, 0 replies; 2+ messages in thread
From: Josef Bacik @ 2012-09-18 13:09 UTC (permalink / raw)
To: Kay Sievers; +Cc: btrfs, Lennart Poettering, Harald Hoyer
On Mon, Sep 17, 2012 at 04:46:08PM -0600, Kay Sievers wrote:
> We are currently playing around with native btrfs multi-device support
> in systemd. We already committed the needed pieces to systemd git, to
> register all detected btrfs filesystems with the kernel.
>
> For volumes which are listed in fstab for mounting, we delay the
> actual mount-attempt of a multi-device volume until we see READY
> returned from BTRFS_IOC_DEVICES_READY. A line with UUID= in /etc/fstab
> with "nofail" in the options field, and we can boot up without any
> device plugged in. Now plugging in devices one-after-the-other until
> the volume has a full tree of devices; with the last device there,
> systemd just mounts the volume as expected.
>
> This seems to work very well so far, unless a device which is already
> registered disappears, which is a kind of valid hotplug scenario we
> should handle better:
>
> If one device of a 2-device volume is registered with the in-kernel
> cache, and then the device is unplugged from the system, the cache
> state does not get updated. If then the other device of the 2-device
> volume is registered, BTRFS_IOC_DEVICES_READY indicates ready; but in
> fact only one of two needed devices are available at that time, and
> mounting fails.
>
> Can we somehow subscribe to device media-changes/removal to prevent
> the stale device state in the in-kernel cache?
>
> Or alternatively make BTRFS_IOC_DEVICES_READY re-validate all involved
> block devices before it returns READY?
Hrm excellent question, I'll look at what options we have in kernel to check and
see if a device is still present and figure something out. Thanks,
Josef
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-18 13:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-17 22:46 BTRFS_IOC_DEVICES_READY and removed devices Kay Sievers
2012-09-18 13:09 ` Josef Bacik
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).