803fb7
From 4a1723115afea68db4cbe4f7f2d97c4f5663403d Mon Sep 17 00:00:00 2001
803fb7
From: Lukas Nykryn <lnykryn@redhat.com>
803fb7
Date: Thu, 6 Aug 2015 11:30:19 +0200
803fb7
Subject: [PATCH] Revert "journald: move /dev/log socket to /run"
803fb7
803fb7
This reverts commit 03ee5c38cb0da193dd08733fb4c0c2809cee6a99.
803fb7
803fb7
rhel-only
803fb7
803fb7
Resolves: #1249968
803fb7
---
803fb7
 Makefile-man.am                       |  5 -----
de8967
 Makefile.am                           |  7 ++----
803fb7
 man/systemd-journald.service.xml      |  2 --
803fb7
 src/core/namespace.c                  |  3 ++-
803fb7
 src/journal/journald-server.c         |  3 +--
803fb7
 src/journal/journald-syslog.c         |  2 +-
de8967
 units/systemd-journald-dev-log.socket | 32 ---------------------------
803fb7
 units/systemd-journald.service.in     |  4 ++--
803fb7
 units/systemd-journald.socket         |  2 +-
803fb7
 9 files changed, 9 insertions(+), 51 deletions(-)
803fb7
 delete mode 100644 units/systemd-journald-dev-log.socket
803fb7
803fb7
diff --git a/Makefile-man.am b/Makefile-man.am
803fb7
index 084df754a..497be6612 100644
803fb7
--- a/Makefile-man.am
803fb7
+++ b/Makefile-man.am
803fb7
@@ -214,7 +214,6 @@ MANPAGES_ALIAS += \
803fb7
 	man/systemd-hybrid-sleep.service.8 \
803fb7
 	man/systemd-initctl.8 \
803fb7
 	man/systemd-initctl.socket.8 \
803fb7
-	man/systemd-journald-dev-log.socket.8 \
803fb7
 	man/systemd-journald.8 \
803fb7
 	man/systemd-journald.socket.8 \
803fb7
 	man/systemd-kexec.service.8 \
803fb7
@@ -326,7 +325,6 @@ man/systemd-hibernate.service.8: man/systemd-suspend.service.8
803fb7
 man/systemd-hybrid-sleep.service.8: man/systemd-suspend.service.8
803fb7
 man/systemd-initctl.8: man/systemd-initctl.service.8
803fb7
 man/systemd-initctl.socket.8: man/systemd-initctl.service.8
803fb7
-man/systemd-journald-dev-log.socket.8: man/systemd-journald.service.8
803fb7
 man/systemd-journald.8: man/systemd-journald.service.8
803fb7
 man/systemd-journald.socket.8: man/systemd-journald.service.8
803fb7
 man/systemd-kexec.service.8: man/systemd-halt.service.8
803fb7
@@ -616,9 +614,6 @@ man/systemd-initctl.html: man/systemd-initctl.service.html
803fb7
 man/systemd-initctl.socket.html: man/systemd-initctl.service.html
803fb7
 	$(html-alias)
803fb7
 
803fb7
-man/systemd-journald-dev-log.socket.html: man/systemd-journald.service.html
803fb7
-	$(html-alias)
803fb7
-
803fb7
 man/systemd-journald.html: man/systemd-journald.service.html
803fb7
 	$(html-alias)
803fb7
 
803fb7
diff --git a/Makefile.am b/Makefile.am
803fb7
index a81d3c131..58bcc2c42 100644
803fb7
--- a/Makefile.am
803fb7
+++ b/Makefile.am
803fb7
@@ -4518,8 +4518,7 @@ bin_PROGRAMS += \
803fb7
 	systemd-cat
803fb7
 
803fb7
 dist_systemunit_DATA += \
803fb7
-	units/systemd-journald.socket \
803fb7
-	units/systemd-journald-dev-log.socket
803fb7
+	units/systemd-journald.socket
803fb7
 
803fb7
 nodist_systemunit_DATA += \
803fb7
 	units/systemd-journald.service \
803fb7
@@ -4538,9 +4537,7 @@ dist_catalog_DATA = \
803fb7
 	catalog/systemd.catalog
803fb7
 
803fb7
 SOCKETS_TARGET_WANTS += \
803fb7
-	systemd-journald.socket \
803fb7
-	systemd-journald-dev-log.socket
803fb7
-
803fb7
+	systemd-journald.socket
803fb7
 SYSINIT_TARGET_WANTS += \
803fb7
 	systemd-journald.service \
803fb7
 	systemd-journal-flush.service \
803fb7
diff --git a/man/systemd-journald.service.xml b/man/systemd-journald.service.xml
803fb7
index 8280d6c87..fe99ce9bc 100644
803fb7
--- a/man/systemd-journald.service.xml
803fb7
+++ b/man/systemd-journald.service.xml
803fb7
@@ -45,7 +45,6 @@
803fb7
   <refnamediv>
803fb7
     <refname>systemd-journald.service</refname>
803fb7
     <refname>systemd-journald.socket</refname>
803fb7
-    <refname>systemd-journald-dev-log.socket</refname>
803fb7
     <refname>systemd-journald</refname>
803fb7
     <refpurpose>Journal service</refpurpose>
803fb7
   </refnamediv>
803fb7
@@ -53,7 +52,6 @@
803fb7
   <refsynopsisdiv>
803fb7
     <para><filename>systemd-journald.service</filename></para>
803fb7
     <para><filename>systemd-journald.socket</filename></para>
803fb7
-    <para><filename>systemd-journald-dev-log.socket</filename></para>
803fb7
     <para><filename>/usr/lib/systemd/systemd-journald</filename></para>
803fb7
   </refsynopsisdiv>
803fb7
 
803fb7
diff --git a/src/core/namespace.c b/src/core/namespace.c
803fb7
index d4f1c8621..ebd5fb334 100644
803fb7
--- a/src/core/namespace.c
803fb7
+++ b/src/core/namespace.c
803fb7
@@ -187,7 +187,8 @@ static int mount_dev(BindMount *m) {
803fb7
         mount("/dev/hugepages", devhugepages, NULL, MS_BIND, NULL);
803fb7
 
803fb7
         devlog = strjoina(temporary_mount, "/dev/log");
803fb7
-        symlink("/run/systemd/journal/dev-log", devlog);
803fb7
+        (void)touch(devlog);
803fb7
+        mount("/dev/log", devlog, NULL, MS_BIND, NULL);
803fb7
 
803fb7
         NULSTR_FOREACH(d, devnodes) {
803fb7
                 _cleanup_free_ char *dn = NULL;
803fb7
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
803fb7
index d692c06ef..fb7aae309 100644
803fb7
--- a/src/journal/journald-server.c
803fb7
+++ b/src/journal/journald-server.c
803fb7
@@ -1531,8 +1531,7 @@ int server_init(Server *s) {
803fb7
 
803fb7
                         s->stdout_fd = fd;
803fb7
 
803fb7
-                } else if (sd_is_socket_unix(fd, SOCK_DGRAM, -1, "/dev/log", 0) > 0 ||
803fb7
-                           sd_is_socket_unix(fd, SOCK_DGRAM, -1, "/run/systemd/journal/dev-log", 0) > 0) {
803fb7
+                } else if (sd_is_socket_unix(fd, SOCK_DGRAM, -1, "/dev/log", 0) > 0) {
803fb7
 
803fb7
                         if (s->syslog_fd >= 0) {
803fb7
                                 log_error("Too many /dev/log sockets passed.");
803fb7
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
803fb7
index ba80941d7..4e118aabc 100644
803fb7
--- a/src/journal/journald-syslog.c
803fb7
+++ b/src/journal/journald-syslog.c
803fb7
@@ -384,7 +384,7 @@ int server_open_syslog_socket(Server *s) {
803fb7
         if (s->syslog_fd < 0) {
803fb7
                 static const union sockaddr_union sa = {
803fb7
                         .un.sun_family = AF_UNIX,
803fb7
-                        .un.sun_path = "/run/systemd/journal/dev-log",
803fb7
+                        .un.sun_path = "/dev/log",
803fb7
                 };
803fb7
 
803fb7
                 s->syslog_fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
803fb7
diff --git a/units/systemd-journald-dev-log.socket b/units/systemd-journald-dev-log.socket
803fb7
deleted file mode 100644
803fb7
index ffd44bb50..000000000
803fb7
--- a/units/systemd-journald-dev-log.socket
803fb7
+++ /dev/null
803fb7
@@ -1,32 +0,0 @@
803fb7
-#  This file is part of systemd.
803fb7
-#
803fb7
-#  systemd is free software; you can redistribute it and/or modify it
803fb7
-#  under the terms of the GNU Lesser General Public License as published by
803fb7
-#  the Free Software Foundation; either version 2.1 of the License, or
803fb7
-#  (at your option) any later version.
803fb7
-
803fb7
-[Unit]
803fb7
-Description=Journal Socket (/dev/log)
803fb7
-Documentation=man:systemd-journald.service(8) man:journald.conf(5)
803fb7
-DefaultDependencies=no
803fb7
-Before=sockets.target
803fb7
-
803fb7
-# Mount and swap units need this. If this socket unit is removed by an
803fb7
-# isolate request the mount and swap units would be removed too,
803fb7
-# hence let's exclude this from isolate requests.
803fb7
-IgnoreOnIsolate=yes
803fb7
-
803fb7
-[Socket]
803fb7
-Service=systemd-journald.service
803fb7
-ListenDatagram=/run/systemd/journal/dev-log
803fb7
-Symlinks=/dev/log
803fb7
-SocketMode=0666
803fb7
-PassCredentials=yes
803fb7
-PassSecurity=yes
803fb7
-
803fb7
-# Increase both the send and receive buffer, so that things don't
803fb7
-# block early. Note that journald internally uses the this socket both
803fb7
-# for receiving syslog messages, and for forwarding them to any other
803fb7
-# syslog, hence we bump both values.
803fb7
-ReceiveBuffer=8M
803fb7
-SendBuffer=8M
803fb7
diff --git a/units/systemd-journald.service.in b/units/systemd-journald.service.in
803fb7
index 1bcc290ec..9d4462283 100644
803fb7
--- a/units/systemd-journald.service.in
803fb7
+++ b/units/systemd-journald.service.in
803fb7
@@ -10,12 +10,12 @@ Description=Journal Service
803fb7
 Documentation=man:systemd-journald.service(8) man:journald.conf(5)
803fb7
 DefaultDependencies=no
803fb7
 Requires=systemd-journald.socket
803fb7
-After=systemd-journald.socket systemd-journald-dev-log.socket syslog.socket
803fb7
+After=systemd-journald.socket syslog.socket
803fb7
 Before=sysinit.target
803fb7
 
803fb7
 [Service]
803fb7
 Type=notify
803fb7
-Sockets=systemd-journald.socket systemd-journald-dev-log.socket
803fb7
+Sockets=systemd-journald.socket
803fb7
 ExecStart=@rootlibexecdir@/systemd-journald
803fb7
 Restart=always
803fb7
 RestartSec=0
803fb7
diff --git a/units/systemd-journald.socket b/units/systemd-journald.socket
803fb7
index 71737014c..fbeb10baa 100644
803fb7
--- a/units/systemd-journald.socket
803fb7
+++ b/units/systemd-journald.socket
803fb7
@@ -19,8 +19,8 @@ IgnoreOnIsolate=yes
803fb7
 [Socket]
803fb7
 ListenStream=/run/systemd/journal/stdout
803fb7
 ListenDatagram=/run/systemd/journal/socket
803fb7
+ListenDatagram=/dev/log
803fb7
 SocketMode=0666
803fb7
 PassCredentials=yes
803fb7
 PassSecurity=yes
803fb7
 ReceiveBuffer=8M
803fb7
-Service=systemd-journald.service