[systemd-devel] dev-root.device is not active, results in an umount spree

Martin Pitt martin.pitt at ubuntu.com
Thu May 14 03:51:37 PDT 2015


Hello all,

Dimitri John Ledkov [2015-05-13 12:48 +0100]:
> I am booting without initramfs, using a plan9 filesystem as rootfs in a kvm.
> 
> Thus my /proc/cmdline has:
> root=/dev/root rootflags=rw,trans=virtio,version=9p2000.L rootfstype=9p
> 
> # mount
> /dev/root on / type 9p
> (rw,relatime,sync,dirsync,rw,trans=virtio,version=9p2000.L)
> 
> Yet, dev-root.device is dead:
> # systemctl status dev-root.device
> ● dev-root.device
>    Loaded: loaded
>    Active: inactive (dead)
> 
> This is very bad. As a harmless action like following:
> 
> # mount --bind /opt /opt
> 
> Results in opt.mount unit to be generated which BindsTo
> dev-root.device, which is inactive, thus systemd tries to stop that
> unit straight away, and umount fails and is retried infinitely...
> effectively DoSing init.

As I mentioned before, simply ignoring /dev/root doesn't help in all
cases, and hardcoding it in the code is a bit ugly.

The attached patch is a more general solution which stops creating
dead stub .device units for devices which don't exist at all. I. e.
while in your case -.mount was probably BindsTo=dev-root.device (or in
my case, in my container I had mnt.mount BindsTo=dev-sda3.device,
which exists on the host but not in the container), but with this
patch it should now not be bound to anything.

Lennart, if you don't like this there is an alternative, and more
complicated solution: We could instead teach device_found_node() to
actually do create a proper .device with the passed DeviceFound (which
is "MOUNT"), resulting in creating a state "tentative" device. I have
a half-working patch for this, but it's brittle as with pretty much
any uevent or moutinfo change the status changes back to "dead",
causing the unmount attempt. IMHO this approach isn't conceptually
correct either -- in such containers, if don't have the corresponding
device nodes at all, we shouldn't try to react to hotplug events and
clean up mounts. I. e. the "tentative" concept does not really apply
there. But I have misunderstood the intent.

Thanks for considering,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-device-Don-t-bind-to-nonexisting-devices.patch
Type: text/x-diff
Size: 2473 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150514/6360c397/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150514/6360c397/attachment-0001.sig>


More information about the systemd-devel mailing list