chiark / gitweb /
man: extend man pages a little
[elogind.git] / src / automount.c
index 26fec45107b35ad0e95aa9f0714a86b3ed11d79f..e685c96a76ab7206b9407484d9a92bc89c652169 100644 (file)
@@ -146,6 +146,23 @@ static int automount_add_mount_links(Automount *a) {
         return 0;
 }
 
+static int automount_add_default_dependencies(Automount *a) {
+        int r;
+
+        assert(a);
+
+        if (a->meta.manager->running_as == MANAGER_SYSTEM) {
+
+                if ((r = unit_add_dependency_by_name(UNIT(a), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0)
+                        return r;
+
+                if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+                        return r;
+        }
+
+        return 0;
+}
+
 static int automount_verify(Automount *a) {
         bool b;
         char *e;
@@ -202,7 +219,7 @@ static int automount_load(Unit *u) {
                         return r;
 
                 if (a->meta.default_dependencies)
-                        if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+                        if ((r = automount_add_default_dependencies(a)) < 0)
                                 return r;
         }
 
@@ -551,6 +568,13 @@ static void automount_enter_runnning(Automount *a) {
 
         dbus_error_init(&error);
 
+        /* We don't take mount requests anymore if we are supposed to
+         * shut down anyway */
+        if (a->meta.job && a->meta.job->type == JOB_STOP) {
+                automount_send_ready(a, -EHOSTDOWN);
+                return;
+        }
+
         mkdir_p(a->where, a->directory_mode);
 
         /* Before we do anything, let's see if somebody is playing games with us? */