[systemd-devel] [PATCH] systemd-udevd.service: restore mount propagation

Martin Pitt martin.pitt at ubuntu.com
Wed Jan 28 02:04:22 PST 2015


Martin Pitt [2015-01-28 10:35 +0100]:
>   # remove a medium/eject CD: disable corresponding .mount units
>   ENV{DISK_MEDIA_CHANGE}=="?*", ENV{ID_CDROM_MEDIA}!="?*", ENV{SYSTEMD_READY}="0"
>   # insert a medium; undo the previous rule
>   ENV{DISK_MEDIA_CHANGE}=="?*", ENV{ID_CDROM_MEDIA}=="?*", ENV{SYSTEMD_READY}="1"
> 
> These essentially make SYSTEMD_READY the negation of ID_CDROM_MEDIA,

Err, of course not negation, just mostly mirrors it (translating
"absent" into "0").

> In udevadm I see that this has the intended effect -- as soon as I
> eject the CD, /dev/sr0 gets ENV{SYSTEMD_READY}="0". But there's still
> something missing, as merely adding this property doesn't yet tell
> systemd to stop the unit -- media-ubuntu-5ML.mount is still "active"
> after that.

More interestingly, the corresponding sys-devices-...-block-sr0.device
is still active (plugged). It is tagged "systemd" properly, so it
ought to catch this code path in device_dispatch_io():

       if (streq(action, "remove") || !device_is_ready(dev))  {
                r = device_process_removed_device(m, dev);

I ran systemd with log_level=debug, but core/device.c doesn't have any
debug logging, so that won't help. "journalctl /dev/sr0" doesn't have
anything. So I'll dig into why ENV{SYSTEMD_READY}="0" doesn't stop the
.device.

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


More information about the systemd-devel mailing list