From 763c46defa1c9b632a0788622d05c71a7de18424 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 7 Feb 2023 15:03:45 +0100 Subject: [PATCH 1/2] journal: print a useful error message if we hit the journal file open limit See: #20921 --- src/libsystemd/sd-journal/journal-internal.h | 2 ++ src/libsystemd/sd-journal/sd-journal.c | 2 -- src/shared/journal-util.c | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libsystemd/sd-journal/journal-internal.h b/src/libsystemd/sd-journal/journal-internal.h index ed052d1b89..87ce930d41 100644 --- a/src/libsystemd/sd-journal/journal-internal.h +++ b/src/libsystemd/sd-journal/journal-internal.h @@ -14,6 +14,8 @@ #include "list.h" #include "set.h" +#define JOURNAL_FILES_MAX 7168u + #define JOURNAL_LOG_RATELIMIT ((const RateLimit) { .interval = 60 * USEC_PER_SEC, .burst = 3 }) typedef struct Match Match; diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c index 523e23925d..c297f06d72 100644 --- a/src/libsystemd/sd-journal/sd-journal.c +++ b/src/libsystemd/sd-journal/sd-journal.c @@ -42,8 +42,6 @@ #include "strv.h" #include "syslog-util.h" -#define JOURNAL_FILES_MAX 7168 - #define JOURNAL_FILES_RECHECK_USEC (2 * USEC_PER_SEC) /* The maximum size of variable values we'll expand in catalog entries. We bind this to PATH_MAX for now, as diff --git a/src/shared/journal-util.c b/src/shared/journal-util.c index bc3d38bb94..ea396fcc9b 100644 --- a/src/shared/journal-util.c +++ b/src/shared/journal-util.c @@ -128,6 +128,10 @@ int journal_access_check_and_warn(sd_journal *j, bool quiet, bool want_other_use log_warning_errno(err, "Journal file %s corrupted, ignoring file.", path); break; + case ETOOMANYREFS: + log_warning_errno(err, "Too many journal files (limit is at %u) in scope, ignoring file '%s'.", JOURNAL_FILES_MAX, path); + break; + default: log_warning_errno(err, "An error was encountered while opening journal file or directory %s, ignoring file: %m", path); break; From 2fbfdb1edc9a017dc72faf651a7c5bf21d60cde3 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 7 Feb 2023 15:11:52 +0100 Subject: [PATCH 2/2] update TODO --- TODO | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TODO b/TODO index 0a06735c08..6fd21d244a 100644 --- a/TODO +++ b/TODO @@ -129,6 +129,10 @@ Deprecations and removals: Features: +* sd-journal puts a limit on parallel journal files to view at once. journald + should probably honour that same limit (JOURNAL_FILES_MAX) when vacuuming to + ensure we never generate more files than we can actually view. + * in order to make binding to PCR 4 realistic: - generate one keypair "U" and store it in a tpm2 nvindex. - Generate another keypair "P" and store it in a second tpm2 nvindex.