[systemd-devel] How to set a limit for mounting roofs?

Chris Murphy lists at colorremedies.com
Wed Jul 6 19:10:37 UTC 2016


On Wed, Jul 6, 2016 at 3:36 AM, Andrei Borzenkov <arvidjaar at gmail.com> wrote:
> On Wed, Jul 6, 2016 at 7:26 AM, Lennart Poettering
> <lennart at poettering.net> wrote:

>> I figure it would be OK to merge a patch that makes the udev rules
>> above set SYSTEMD_READY immediately if the device popped up in case
>> some new kernel command line option is set.
>>
>
> That won't work. This will make it impossible to mount any btrfs that
> needs more than 1 device to actually be mountable (even degraded).
> Because then it will announce btrfs as soon as any device is seen and
> filesystem will be incomplete and won't mount. And we do not retry
> later.
>
> The situation is the same as we had with Linux MD assembly. What is required, is
>
> a) we need a way to query btrfs whether it is mountable (may be degraded)

BTRFS_IOC_DEVICES_READY, might lack sufficient granularity. There are
more than two states for redundant multiple device volumes; but only
two states for either one device volumes or multiple device volumes
lacking redundancy (raid0 and single profiles).

Basically this ioctl is not telling the complete truth when a
redundant volume is missing just one device (or two for raid6), it
says devices not ready. The complete truth is devices minimally ready,
i.e. a mount sould succeed if rootflags=degraded.



> b) we need some way to define external policy whether we want to mount
> degraded btrfs or not. In general case, not just special case of root
> filesystem
> c) we need some way to wait for more devices to appear before we
> attempt degraded mount
> d) finally we need some way to actually perform degraded mount when we
> decide to do it

Yep. Even in the md and lvm cases, if they were to indicate minimum
devices available for mount, systemd could have a timer to delay mount
attempt for most use cases while other use case would change to
immediately (or never) try degraded mount.

I think systemd needs more information to do the right thing, and that
right information can only come from code responsible for making that
determination. For Btrfs anyway, it's kernel code. I'm not sure where
this would go for mdadm and lvm arrays.



> As far as I understand btrfs must be mounted with special option (-o
> degraded), so this can be used as policy decision.

That's true also. However it's still possible that at the time systemd
goes to mount that the minimum number of devices for successful
degraded mount aren't yet ready. *shrug*




-- 
Chris Murphy


More information about the systemd-devel mailing list