core: fix output (logging) for mount units (#7603)
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Sat, 13 Jan 2018 12:30:43 +0000 (12:30 +0000)
committerAlan Jenkins <alan.christopher.jenkins@gmail.com>
Sat, 13 Jan 2018 13:03:13 +0000 (13:03 +0000)
Documentation - systemd.exec - strongly implies mount units get logging.

It is safe for mounts to depend on systemd-journald.socket.  There is no
cyclic dependency generated.  This is because the root, -.mount, was
already deliberately set to EXEC_OUTPUT_NULL.  See comment in
mount_load_root_mount().  And /run is excluded from being a mount unit.

Nor does systemd-journald depend on /var.  It starts earlier, initially
logging to /run.

Tested before/after using `systemctl stop tmp.mount`.

src/core/mount.c

index 9367869..9b0b29b 100644 (file)
@@ -164,6 +164,10 @@ static void mount_init(Unit *u) {
         assert(u->load_state == UNIT_STUB);
 
         m->timeout_usec = u->manager->default_timeout_start_usec;
+
+        m->exec_context.std_output = u->manager->default_std_output;
+        m->exec_context.std_error = u->manager->default_std_error;
+
         m->directory_mode = 0755;
 
         /* We need to make sure that /usr/bin/mount is always called