summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-04-05 15:31:18 +0200
committerLennart Poettering <lennart@poettering.net>2019-04-12 14:23:12 +0200
commit337fabf7490f36753a5ed58ccee419a98ef3a0a2 (patch)
tree4cfd148c131096eec7b4b42bcfb25645dfa1cba4 /src/journal
parente3d78cb160ae8d6b2eb25e5c05a11196af4fb94e (diff)
downloadsystemd-337fabf7490f36753a5ed58ccee419a98ef3a0a2.tar.gz
systemd-337fabf7490f36753a5ed58ccee419a98ef3a0a2.tar.bz2
systemd-337fabf7490f36753a5ed58ccee419a98ef3a0a2.zip
journald: rebreak a few comments
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journald-server.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 09babd0ba3..5729041e3b 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1421,14 +1421,13 @@ static int setup_signals(Server *s) {
if (r < 0)
return r;
- /* Let's process SIGTERM late, so that we flush all queued
- * messages to disk before we exit */
+ /* Let's process SIGTERM late, so that we flush all queued messages to disk before we exit */
r = sd_event_source_set_priority(s->sigterm_event_source, SD_EVENT_PRIORITY_NORMAL+20);
if (r < 0)
return r;
- /* When journald is invoked on the terminal (when debugging),
- * it's useful if C-c is handled equivalent to SIGTERM. */
+ /* When journald is invoked on the terminal (when debugging), it's useful if C-c is handled
+ * equivalent to SIGTERM. */
r = sd_event_add_signal(s->event, &s->sigint_event_source, SIGINT, dispatch_sigterm, s);
if (r < 0)
return r;
@@ -1437,11 +1436,9 @@ static int setup_signals(Server *s) {
if (r < 0)
return r;
- /* SIGRTMIN+1 causes an immediate sync. We process this very
- * late, so that everything else queued at this point is
- * really written to disk. Clients can watch
- * /run/systemd/journal/synced with inotify until its mtime
- * changes to see when a sync happened. */
+ /* SIGRTMIN+1 causes an immediate sync. We process this very late, so that everything else queued at
+ * this point is really written to disk. Clients can watch /run/systemd/journal/synced with inotify
+ * until its mtime changes to see when a sync happened. */
r = sd_event_add_signal(s->event, &s->sigrtmin1_event_source, SIGRTMIN+1, dispatch_sigrtmin1, s);
if (r < 0)
return r;
@@ -1759,23 +1756,17 @@ static int server_connect_notify(Server *s) {
assert(!s->notify_event_source);
/*
- So here's the problem: we'd like to send notification
- messages to PID 1, but we cannot do that via sd_notify(),
- since that's synchronous, and we might end up blocking on
- it. Specifically: given that PID 1 might block on
- dbus-daemon during IPC, and dbus-daemon is logging to us,
- and might hence block on us, we might end up in a deadlock
- if we block on sending PID 1 notification messages — by
- generating a full blocking circle. To avoid this, let's
- create a non-blocking socket, and connect it to the
- notification socket, and then wait for POLLOUT before we
- send anything. This should efficiently avoid any deadlocks,
- as we'll never block on PID 1, hence PID 1 can safely block
- on dbus-daemon which can safely block on us again.
-
- Don't think that this issue is real? It is, see:
- https://github.com/systemd/systemd/issues/1505
- */
+ * So here's the problem: we'd like to send notification messages to PID 1, but we cannot do that via
+ * sd_notify(), since that's synchronous, and we might end up blocking on it. Specifically: given
+ * that PID 1 might block on dbus-daemon during IPC, and dbus-daemon is logging to us, and might
+ * hence block on us, we might end up in a deadlock if we block on sending PID 1 notification
+ * messages — by generating a full blocking circle. To avoid this, let's create a non-blocking
+ * socket, and connect it to the notification socket, and then wait for POLLOUT before we send
+ * anything. This should efficiently avoid any deadlocks, as we'll never block on PID 1, hence PID 1
+ * can safely block on dbus-daemon which can safely block on us again.
+ *
+ * Don't think that this issue is real? It is, see: https://github.com/systemd/systemd/issues/1505
+ */
e = getenv("NOTIFY_SOCKET");
if (!e)
@@ -1807,8 +1798,7 @@ static int server_connect_notify(Server *s) {
return log_error_errno(r, "Failed to add watchdog time event: %m");
}
- /* This should fire pretty soon, which we'll use to send the
- * READY=1 event. */
+ /* This should fire pretty soon, which we'll use to send the READY=1 event. */
return 0;
}