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

Martin Pitt martin.pitt at ubuntu.com
Wed Jan 28 03:06:12 PST 2015


Martin Pitt [2015-01-28 11:04 +0100]:
> > 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).

This is true (i. e. broken) with 218, but apparently got fixed in
trunk. With trunk (where I added a log_* for the code below) the
.device is properly brought down.

> 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);

So this works well.

But you wrote:

| The .mount units of device nodes already have a BindsTo= dependency on
| their respective backing .device units. This should have the effect
| that systemd will take the .mount units down if the .device units are
| removed. Are you saying that doesn't work?

This indeed seems to be the crucial part indeed. After the eject, I
get:

| martin at pid1:~$ sudo systemctl status -l media-martin-Ubuntu\\x2015.04\\x20amd64.mount 
| ● media-martin-Ubuntu\x2015.04\x20amd64.mount - /media/martin/Ubuntu 15.04 amd64
|    Loaded: loaded (/proc/self/mountinfo)
|    Active: active (mounted) since Mi 2015-01-28 11:56:34 CET; 4min 57s ago
|     Where: /media/martin/Ubuntu 15.04 amd64
|      What: /dev/sr1
|
| martin at pid1:~$ systemctl status -l sys-devices-pci0000:00-0000:00:01.1-ata2-host1-target1:0:0-1:0:0:0-block-sr1.device
| ● sys-devices-pci0000:00-0000:00:01.1-ata2-host1-target1:0:0-1:0:0:0-block-sr1.device
|    Loaded: loaded
|    Active: inactive (dead)

I. e. the .mount does not seem to be bound on the .device, and isn't
taken down automatically (stopping the mount manually works fine). In
"show" I don't see a BindsTo, and the Requires also doesn't mention
the /dev/sr1 device:

| martin at pid1:~$ sudo systemctl show media-martin-Ubuntu\\x2015.04\\x20amd64.mount|cat
| Where=/media/martin/Ubuntu 15.04 amd64
| What=/dev/sr1
| Options=ro,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2
| Type=iso9660
| TimeoutUSec=1min 30s
| ControlPID=0
| DirectoryMode=0755
| SloppyOptions=no
| Result=success
| Slice=system.slice
| Delegate=no
| CPUAccounting=no
| CPUShares=18446744073709551615
| StartupCPUShares=18446744073709551615
| CPUQuotaPerSecUSec=infinity
| BlockIOAccounting=no
| BlockIOWeight=18446744073709551615
| StartupBlockIOWeight=18446744073709551615
| MemoryAccounting=no
| MemoryLimit=18446744073709551615
| DevicePolicy=auto
| UMask=0022
| LimitCPU=18446744073709551615
| LimitFSIZE=18446744073709551615
| LimitDATA=18446744073709551615
| LimitSTACK=18446744073709551615
| LimitCORE=18446744073709551615
| LimitRSS=18446744073709551615
| LimitNOFILE=4096
| LimitAS=18446744073709551615
| LimitNPROC=7917
| LimitMEMLOCK=65536
| LimitLOCKS=18446744073709551615
| LimitSIGPENDING=7917
| LimitMSGQUEUE=819200
| LimitNICE=0
| LimitRTPRIO=0
| LimitRTTIME=18446744073709551615
| OOMScoreAdjust=0
| Nice=0
| IOScheduling=0
| CPUSchedulingPolicy=0
| CPUSchedulingPriority=0
| TimerSlackNSec=50000
| CPUSchedulingResetOnFork=no
| NonBlocking=no
| StandardInput=null
| StandardOutput=journal
| StandardError=inherit
| TTYReset=no
| TTYVHangup=no
| TTYVTDisallocate=no
| SyslogPriority=30
| SyslogLevelPrefix=yes
| SecureBits=0
| CapabilityBoundingSet=18446744073709551615
| MountFlags=0
| PrivateTmp=no
| PrivateNetwork=no
| PrivateDevices=no
| ProtectHome=no
| ProtectSystem=no
| SameProcessGroup=yes
| IgnoreSIGPIPE=yes
| NoNewPrivileges=no
| SystemCallErrorNumber=0
| RuntimeDirectoryMode=0755
| KillMode=control-group
| KillSignal=15
| SendSIGKILL=yes
| SendSIGHUP=no
| Id=media-martin-Ubuntu\x5cx2015.04\x5cx20amd64.mount
| Names=media-martin-Ubuntu\x5cx2015.04\x5cx20amd64.mount
| Requires=-.mount
| Wants=system.slice
| Conflicts=umount.target
| Before=umount.target local-fs.target
| After=systemd-journald.socket local-fs-pre.target system.slice -.mount
| RequiresMountsFor=/media/martin
| Description=/media/martin/Ubuntu 15.04 amd64
| LoadState=loaded
| ActiveState=active
| SubState=mounted
| SourcePath=/proc/self/mountinfo
| InactiveExitTimestamp=Mi 2015-01-28 11:56:34 CET
| InactiveExitTimestampMonotonic=8718833
| ActiveEnterTimestamp=Mi 2015-01-28 11:56:34 CET
| ActiveEnterTimestampMonotonic=8718833
| ActiveExitTimestampMonotonic=0
| InactiveEnterTimestampMonotonic=0
| CanStart=yes
| CanStop=yes
| CanReload=yes
| CanIsolate=no
| StopWhenUnneeded=no
| RefuseManualStart=no
| RefuseManualStop=no
| AllowIsolate=no
| DefaultDependencies=yes
| OnFailureJobMode=replace
| IgnoreOnIsolate=yes
| IgnoreOnSnapshot=no
| NeedDaemonReload=no
| JobTimeoutUSec=0
| JobTimeoutAction=none
| ConditionResult=no
| AssertResult=no
| ConditionTimestampMonotonic=0
| AssertTimestampMonotonic=0
| Transient=no

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: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150128/b5c4085c/attachment-0001.sig>


More information about the systemd-devel mailing list