[systemd-devel] mount units and automatic (un)mounts

Alad Wenter alad at archlinux.info
Fri Jul 15 17:14:05 UTC 2016


Andrei Borzenkov wrote:
> 15.07.2016 19:50, Alad Wenter пишет:
> ...
>
>>>> "systemctl reset-failed" is issued (note that appending the .mount unit
>>>> doesn't work in this case, giving a "Unit mnt-transcend\x2dsdhc.mount is
>>>> not loaded" error).
>>>>
>>> So how exactly do you call it?
>> % sudo systemctl reset-failed mnt-transcend\x2dsdhc.mount
>> Failed to reset failed state of unit mnt-transcendx2dsdhc.mount: Unit
>> mnt-transcendx2dsdhc.mount is not loaded.
>>
> Sorry if I was not clear. You said this did not work, implying some
> other invocation did. If "appending .mount unit does not work", I expect
> some other command that *does* work?

Yes, I forgot to quote the escaped name in the shell (thanks to Dave
Reisner for pointing this out). The following works:

% sudo systemctl reset-failed "mnt-transcend\x2dsdhc.mount"
>
>> Being now aware of the distinction between in-memory and static units, I
>> assume this is due to mnt-transcend\x2dsdhc.mount being in-memory? The
>> reset-failed command works as expected with .mount units which are on disk.
> Well, if this mount unit was instantiated from /proc/self/mountinfo,
> then goes away then of course systemd does not know anything about it
> any more.
>
> ...
>
>>>> [Service]
>>>> Type=oneshot
>>>> RemainAfterExit=yes
>>>> ExecStart=/bin/mount -a -t nocifs,nosmbfs,nonfs
>>>>
>>>> [Install]
>>>> WantedBy=local-fs.target
>>>>
>>>> However, according to the systemd.mount(5), .mount units will be
>>>> generated either way. Oddly enough, when using the above service they
>>>> don't seem to cause automatic mounts/unmounts.
>>>>
>>> Because in this case you do not have static mount units, and for
>>> transient mount units (created from external mount event) things were
>>> partially fixed by not requiring existing device.
>> Could you give a pointer on what release this was partially fixed in? In
>> the NEWS file, I only found a mention to systemd 219 which introduced
>> unmounting of unavailable devices.
> I mean this commit
>
> commit 628c89cc68ab96fce2de7ebba5933725d147aecc
> Author: Lennart Poettering <lennart at poettering.net>
> Date:   Fri Feb 27 21:55:08 2015 +0100
>
>     core: rework device state logic
>
>     This change introduces a new state "tentative" for device units. Device
>     units are considered "plugged" when udev announced them, "dead" when
>     they are not available in the kernel, and "tentative" when they are
>     referenced in /proc/self/mountinfo or /proc/swaps but not (yet)
>     announced via udev.
>
>     This should fix a race when device nodes (like loop devices) are created
>     and immediately mounted. Previously, systemd might end up seeing the
>     mount unit before the device, and would thus pull down the mount because
>     its BindTo dependency on the device would not be fulfilled.
>
>
> with lot of subsequent fixes ... this commit is included starting with v220.
>
>
>
Understood.

Thanks,

Alad


More information about the systemd-devel mailing list