[systemd-devel] umounting FS happens to be at the same time as shutting down services
Francis Moreau
francis.moro at gmail.com
Mon Nov 23 00:00:32 PST 2015
On Sun, Nov 22, 2015 at 4:04 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Sun, 22.11.15 15:26, Francis Moreau (francis.moro at gmail.com) wrote:
>
>> Hi,
>>
>> While rebooting, It seems to me that shutting down services while
>> unmounting some FS at the same time in an unordered fashion is not a
>> good idea since unmounting a FS can happen before a service using this
>> FS is stopped.
>>
>> Is this expected ?
>
> No, and it's not really what happends. Mounts from /etc/fstab are
> usually ordered with a Before= depdendency against local-fs.target,
> which is ordered Before= basic.target, which is the target that normal
> services are ordered After=. Hence, at startup you get the strict
> order:
>
> Mounts from /etc/fstab → local-fs.target → basic.target → normal services
>
> Now, in systemd the shutdown order is always the strict reverse of the
> start-up order, hence this results in this shutdown order:
>
> normal services → basic.target → local-fs.target → Mounts from /etc/fstab
>
> Thus, file systems are unmounted only *after* normal services have been
> terminated.
>
> Now, there are some services that set DefaultDependencies=no, and some
> mount units too. For those these automatic dependencies are not in
> effect, and they basically explicitly ask for the right to be ordered
> manually against whatever they want to be ordered against, and thus
> possibly are started or stopped in parallel. However, that's explicit
> configuration that way, and the exception.
>
Thank you very much for your detailed answer, it's clear now.
--
Francis
More information about the systemd-devel
mailing list