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

Lennart Poettering lennart at poettering.net
Fri Jul 8 18:39:45 UTC 2016


On Wed, 06.07.16 12:36, Andrei Borzenkov (arvidjaar at gmail.com) 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.

Well, my assumption would be that we'd also somehow add the "degraded"
mount option into all btrfs mounts in case that kernel command line
option is specified. One way to implement this could be to introduce a
new generic SYSTEMD_EXTRA_MOUNT_OPTIONS udev property or so that may
be added to a device node, and when specified is appended to the mount
options specified in the mount unit. This would permit udev-based
alteration of mount options in a gernic way, and could be used by the
btrfs rules file to also add in the "degraded" mount option to all
btrfs mounts as soon as the new kernel option is specified.

> 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)
> 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
> 
> This cannot be implemented using current unit dependencies at all. The
> only implementation that could be squeezed into existing framework is
> separate program that listens to udev events and waits for all devices
> to be present. btrfs mount units must then depend on this program.
> Then mount unit will depend on this program and wait for it to
> complete; successful completion means filesystem can be mounted.
> 
> As far as I understand btrfs must be mounted with special option (-o
> degraded), so this can be used as policy decision.
> 
> This will also make existing udev rules obsolete (and we finally stop
> lying about devices availability).

Well, personally I am not convinced that a policy of "automatic time-based
degrading" is a good default policy, and that a policy of "require
manual intervention to proceed with degrading" is a better default
policy.

That all said, I am sure in many setups such an automatic degrading is
useful too, but I am also sure that any fancier policies like that
really shouldn't be implemented in systemd, but via some daemon or so
shipped in btrfs-progs really. 

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list