teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0834-journal-break-recursion.patch

7e7c9f
From 19bb218559b8dca65bbb68ad7a4ff0bc9cbfe8fb Mon Sep 17 00:00:00 2001
7e7c9f
From: Stepan Broz <sbroz@redhat.com>
7e7c9f
Date: Wed, 11 Mar 2020 14:45:26 +0100
7e7c9f
Subject: [PATCH] journal: break recursion
7e7c9f
7e7c9f
available_space(s, true) tries to log the current status, which does, in
7e7c9f
turn, lead to another call to available_space(s, true) and so on and so
7e7c9f
on... The call sequence is:
7e7c9f
7e7c9f
available_space()
7e7c9f
  server_driver_message()
7e7c9f
    dispatch_message_real()
7e7c9f
      write_to_journal()
7e7c9f
        find_journal()
7e7c9f
          system_journal_open()
7e7c9f
            available_space()
7e7c9f
7e7c9f
RHEL-only
7e7c9f
7e7c9f
Resolves: #1778744
7e7c9f
---
7e7c9f
 src/journal/journald-server.c | 12 ++++++------
7e7c9f
 1 file changed, 6 insertions(+), 6 deletions(-)
7e7c9f
7e7c9f
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
7e7c9f
index ffe2daa7be..11348af490 100644
7e7c9f
--- a/src/journal/journald-server.c
7e7c9f
+++ b/src/journal/journald-server.c
7e7c9f
@@ -311,7 +311,7 @@ static bool flushed_flag_is_set(void) {
7e7c9f
         return access("/run/systemd/journal/flushed", F_OK) >= 0;
7e7c9f
 }
7e7c9f
 
7e7c9f
-static int system_journal_open(Server *s, bool flush_requested) {
7e7c9f
+static int system_journal_open(Server *s, bool flush_requested, bool verbose) {
7e7c9f
         int r;
7e7c9f
         char *fn;
7e7c9f
         sd_id128_t machine;
7e7c9f
@@ -344,7 +344,7 @@ static int system_journal_open(Server *s, bool flush_requested) {
7e7c9f
 
7e7c9f
                 if (r >= 0) {
7e7c9f
                         server_fix_perms(s, s->system_journal, 0);
7e7c9f
-                        available_space(s, true);
7e7c9f
+                        available_space(s, verbose);
7e7c9f
                 } else {
7e7c9f
                         if (r != -ENOENT && r != -EROFS)
7e7c9f
                                 log_warning_errno(r, "Failed to open system journal: %m");
7e7c9f
@@ -406,7 +406,7 @@ static int system_journal_open(Server *s, bool flush_requested) {
7e7c9f
 
7e7c9f
                 if (s->runtime_journal) {
7e7c9f
                         server_fix_perms(s, s->runtime_journal, 0);
7e7c9f
-                        available_space(s, true);
7e7c9f
+                        available_space(s, verbose);
7e7c9f
                 }
7e7c9f
         }
7e7c9f
 
7e7c9f
@@ -430,7 +430,7 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
7e7c9f
          * else that's left the journals as NULL).
7e7c9f
          *
7e7c9f
          * Fixes https://github.com/systemd/systemd/issues/3968 */
7e7c9f
-        (void) system_journal_open(s, false);
7e7c9f
+        (void) system_journal_open(s, false, false);
7e7c9f
 
7e7c9f
         /* We split up user logs only on /var, not on /run. If the
7e7c9f
          * runtime file is open, we write to it exclusively, in order
7e7c9f
@@ -1132,7 +1132,7 @@ int server_flush_to_var(Server *s, bool require_flag_file) {
7e7c9f
         if (require_flag_file && !flushed_flag_is_set())
7e7c9f
                 return 0;
7e7c9f
 
7e7c9f
-        system_journal_open(s, true);
7e7c9f
+        system_journal_open(s, true, true);
7e7c9f
 
7e7c9f
         if (!s->system_journal)
7e7c9f
                 return 0;
7e7c9f
@@ -1903,7 +1903,7 @@ int server_init(Server *s) {
7e7c9f
 
7e7c9f
         (void) server_connect_notify(s);
7e7c9f
 
7e7c9f
-        r = system_journal_open(s, false);
7e7c9f
+        r = system_journal_open(s, false, true);
7e7c9f
         if (r < 0)
7e7c9f
                 return r;
7e7c9f