[systemd-devel] Race condition for service dependent on mount

David Strauss david at davidstrauss.net
Thu Oct 18 11:33:47 PDT 2012


If a service depends on a mount, systemd doesn't properly wait for the
mount to complete before starting the service. This creates bad race
conditions where the service may write to the mount directory before
the mount is active, which can stop the mount from even completing
successfully because the mount directory isn't empty. We might be able
to stop the writes through permissions on the mount directory, but the
writes would still fail.

The cleanest solution to this seems to be "notify" integration into
the mount utility so it tells systemd that the mount is complete or
waiting for the mount request to complete in some other way.

Part of why we use this dependency is to perform the mount before
"forking" the file system namespace for the dependent service. This
allows the dependent service file system namespace to not propagate
further mounts from the main file system.

Has anyone else looked into this?

-- 
David Strauss
   | david at davidstrauss.net


More information about the systemd-devel mailing list