From: Lennart Poettering Date: Tue, 7 Feb 2023 14:03:45 +0000 (+0100) Subject: journal: print a useful error message if we hit the journal file open limit X-Git-Tag: v253-rc3~32^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=763c46defa1c9b632a0788622d05c71a7de18424;p=thirdparty%2Fsystemd.git journal: print a useful error message if we hit the journal file open limit See: #20921 --- diff --git a/src/libsystemd/sd-journal/journal-internal.h b/src/libsystemd/sd-journal/journal-internal.h index ed052d1b890..87ce930d410 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 523e23925de..c297f06d725 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 bc3d38bb947..ea396fcc9ba 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;