chiark / gitweb /
exec: drop process group kill mode since it has little use and confuses the user
[elogind.git] / src / mount.c
index 00780101a0c1edbced14f97a2ce6c0371416a33f..8528d17a804ffa9d796872c06bbeeca7319d4156 100644 (file)
@@ -37,6 +37,7 @@
 #include "special.h"
 #include "bus-errors.h"
 #include "exit-status.h"
+#include "def.h"
 
 static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = {
         [MOUNT_DEAD] = UNIT_INACTIVE,
@@ -412,9 +413,22 @@ static int mount_add_default_dependencies(Mount *m) {
 
         if (m->meta.manager->running_as == MANAGER_SYSTEM &&
             !path_equal(m->where, "/")) {
+                MountParameters *p;
 
-                if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_BEFORE, SPECIAL_QUOTACHECK_SERVICE, NULL, true)) < 0)
-                        return r;
+                if (m->from_fragment)
+                        p = &m->parameters_fragment;
+                else if (m->from_etc_fstab)
+                        p = &m->parameters_etc_fstab;
+                else
+                        p = NULL;
+
+                if (!p ||
+                    (!mount_test_option(p->options, "_netdev") &&
+                    !(p->fstype && fstype_is_network(p->fstype)) &&
+                    (mount_test_option(p->options, "usrquota") || mount_test_option(p->options, "grpquota"))))
+                        if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTACHECK_SERVICE, NULL, true)) < 0 ||
+                            (r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTAON_SERVICE, NULL, true)) < 0)
+                                return r;
 
                 if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
                         return r;
@@ -733,9 +747,7 @@ static void mount_enter_signal(Mount *m, MountState state, bool success) {
                            state == MOUNT_REMOUNTING_SIGTERM) ? m->exec_context.kill_signal : SIGKILL;
 
                 if (m->control_pid > 0) {
-                        if (kill_and_sigcont(m->exec_context.kill_mode == KILL_PROCESS_GROUP ?
-                                             -m->control_pid :
-                                             m->control_pid, sig) < 0 && errno != ESRCH)
+                        if (kill_and_sigcont(m->control_pid, sig) < 0 && errno != ESRCH)
 
                                 log_warning("Failed to kill control process %li: %m", (long) m->control_pid);
                         else
@@ -830,6 +842,10 @@ static void mount_enter_mounting(Mount *m) {
 
         mkdir_p(m->where, m->directory_mode);
 
+        /* create the source directory for bind-mounts if needed */
+        if (m->parameters_fragment.fstype && strcmp(m->parameters_fragment.fstype, "bind") == 0)
+                mkdir_p(m->parameters_fragment.what, m->directory_mode);
+
         if (m->from_fragment)
                 r = exec_command_set(
                                 m->control_command,
@@ -1666,7 +1682,7 @@ static int mount_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError
         }
 
         if (m->control_pid > 0)
-                if (kill(mode == KILL_PROCESS_GROUP ? -m->control_pid : m->control_pid, signo) < 0)
+                if (kill(m->control_pid, signo) < 0)
                         r = -errno;
 
         if (mode == KILL_CONTROL_GROUP) {