chiark / gitweb /
job: only jobs on the runqueue can be run
[elogind.git] / src / core / mount.c
index e662af0c87855516ac7a0f3b9f191b93ee847eea..01e9d78ad52a1ff29ae8abd588e10d900fd7513b 100644 (file)
@@ -32,6 +32,7 @@
 #include "log.h"
 #include "strv.h"
 #include "mkdir.h"
+#include "path-util.h"
 #include "mount-setup.h"
 #include "unit-name.h"
 #include "dbus-mount.h"
@@ -263,6 +264,21 @@ static int mount_add_socket_links(Mount *m) {
         return 0;
 }
 
+static int mount_add_requires_mounts_links(Mount *m) {
+        Unit *other;
+        int r;
+
+        assert(m);
+
+        LIST_FOREACH(has_requires_mounts_for, other, UNIT(m)->manager->has_requires_mounts_for) {
+                r = unit_add_one_mount_link(other, m);
+                if (r < 0)
+                        return r;
+        }
+
+        return 0;
+}
+
 static char* mount_test_option(const char *haystack, const char *needle) {
         struct mntent me;
 
@@ -614,6 +630,10 @@ static int mount_load(Unit *u) {
                 if ((r = mount_add_path_links(m)) < 0)
                         return r;
 
+                r = mount_add_requires_mounts_links(m);
+                if (r < 0)
+                        return r;
+
                 if ((r = mount_add_automount_links(m)) < 0)
                         return r;
 
@@ -801,6 +821,7 @@ static int mount_spawn(Mount *m, ExecCommand *c, pid_t *_pid) {
                             UNIT(m)->cgroup_bondings,
                             UNIT(m)->cgroup_attributes,
                             NULL,
+                            NULL,
                             &pid)) < 0)
                 goto fail;
 
@@ -871,7 +892,7 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) {
                                 if ((r = set_put(pid_set, LONG_TO_PTR(m->control_pid))) < 0)
                                         goto fail;
 
-                        r = cgroup_bonding_kill_list(UNIT(m)->cgroup_bondings, sig, true, pid_set, NULL);
+                        r = cgroup_bonding_kill_list(UNIT(m)->cgroup_bondings, sig, true, false, pid_set, NULL);
                         if (r < 0) {
                                 if (r != -EAGAIN && r != -ESRCH && r != -ENOENT)
                                         log_warning("Failed to kill control group: %s", strerror(-r));
@@ -1830,7 +1851,7 @@ static int mount_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError
                                 goto finish;
                         }
 
-                q = cgroup_bonding_kill_list(UNIT(m)->cgroup_bondings, signo, false, pid_set, NULL);
+                q = cgroup_bonding_kill_list(UNIT(m)->cgroup_bondings, signo, false, false, pid_set, NULL);
                 if (q < 0)
                         if (q != -EAGAIN && q != -ESRCH && q != -ENOENT)
                                 r = q;