chiark / gitweb /
manager: print fatal errors on the console too
[elogind.git] / src / core / mount.c
index f3ec7365d15178e9d3e1808cda1856c42b94cd1b..b571db946d4f01c128398a70543afb005353ab6c 100644 (file)
@@ -715,6 +715,7 @@ static int mount_spawn(Mount *m, ExecCommand *c, pid_t *_pid) {
         exec_params.confirm_spawn = UNIT(m)->manager->confirm_spawn;
         exec_params.cgroup_supported = UNIT(m)->manager->cgroup_supported;
         exec_params.cgroup_path = UNIT(m)->cgroup_path;
+        exec_params.cgroup_delegate = m->cgroup_context.delegate;
         exec_params.runtime_prefix = manager_get_runtime_prefix(UNIT(m)->manager);
         exec_params.unit_id = UNIT(m)->id;
 
@@ -775,7 +776,8 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) {
         r = unit_kill_context(
                         UNIT(m),
                         &m->kill_context,
-                        state != MOUNT_MOUNTING_SIGTERM && state != MOUNT_UNMOUNTING_SIGTERM && state != MOUNT_REMOUNTING_SIGTERM,
+                        (state != MOUNT_MOUNTING_SIGTERM && state != MOUNT_UNMOUNTING_SIGTERM && state != MOUNT_REMOUNTING_SIGTERM) ?
+                        KILL_KILL : KILL_TERMINATE,
                         -1,
                         m->control_pid,
                         false);
@@ -812,19 +814,26 @@ fail:
 }
 
 void warn_if_dir_nonempty(const char *unit, const char* where) {
+        int r;
+
         assert(unit);
         assert(where);
 
-        if (dir_is_empty(where) > 0)
+        r = dir_is_empty(where);
+        if (r > 0)
                 return;
-
-        log_struct_unit(LOG_NOTICE,
-                   unit,
-                   "MESSAGE=%s: Directory %s to mount over is not empty, mounting anyway.",
-                   unit, where,
-                   "WHERE=%s", where,
-                   MESSAGE_ID(SD_MESSAGE_OVERMOUNTING),
-                   NULL);
+        else if (r == 0)
+                log_struct_unit(LOG_NOTICE,
+                                unit,
+                                "MESSAGE=%s: Directory %s to mount over is not empty, mounting anyway.",
+                                unit, where,
+                                "WHERE=%s", where,
+                                MESSAGE_ID(SD_MESSAGE_OVERMOUNTING),
+                                NULL);
+        else
+                log_warning_unit(unit,
+                                 "MESSAGE=Failed to check directory %s: %s",
+                                 where, strerror(-r));
 }
 
 static int fail_if_symlink(const char *unit, const char* where) {
@@ -903,10 +912,10 @@ static void mount_enter_mounting(Mount *m) {
                                 m->control_command,
                                 "/bin/mount",
                                 m->sloppy_options ? "-ns" : "-n",
-                                "-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto",
-                                "-o", m->parameters_fragment.options ? m->parameters_fragment.options : "",
                                 m->parameters_fragment.what,
                                 m->where,
+                                "-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto",
+                                m->parameters_fragment.options ? "-o" : NULL, m->parameters_fragment.options,
                                 NULL);
         else
                 r = -ENOENT;
@@ -951,10 +960,10 @@ static void mount_enter_remounting(Mount *m) {
                                 m->control_command,
                                 "/bin/mount",
                                 m->sloppy_options ? "-ns" : "-n",
-                                "-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto",
-                                "-o", o,
                                 m->parameters_fragment.what,
                                 m->where,
+                                "-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto",
+                                "-o", o,
                                 NULL);
         } else
                 r = -ENOENT;