summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/journal/journald-server.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 4f8cff29d4..717c8e480e 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -335,6 +335,20 @@ static bool server_flushed_flag_is_set(Server *s) {
return access(fn, F_OK) >= 0;
}
+static void server_drop_flushed_flag(Server *s) {
+ const char *fn;
+
+ assert(s);
+
+ if (s->namespace)
+ return;
+
+ fn = strjoina(s->runtime_directory, "/flushed");
+ if (unlink(fn) < 0 && errno != ENOENT)
+ log_ratelimit_warning_errno(errno, JOURNAL_LOG_RATELIMIT,
+ "Failed to unlink %s, ignoring: %m", fn);
+}
+
static int server_system_journal_open(
Server *s,
bool flush_requested,
@@ -437,6 +451,7 @@ static int server_system_journal_open(
server_add_acls(s->runtime_journal, 0);
(void) cache_space_refresh(s, &s->runtime_storage);
patch_min_use(&s->runtime_storage);
+ server_drop_flushed_flag(s);
}
}
@@ -1450,7 +1465,6 @@ finish:
}
static int server_relinquish_var(Server *s) {
- const char *fn;
assert(s);
if (s->storage == STORAGE_NONE)
@@ -1470,11 +1484,6 @@ static int server_relinquish_var(Server *s) {
ordered_hashmap_clear_with_destructor(s->user_journals, journal_file_offline_close);
set_clear_with_destructor(s->deferred_closes, journal_file_offline_close);
- fn = strjoina(s->runtime_directory, "/flushed");
- if (unlink(fn) < 0 && errno != ENOENT)
- log_ratelimit_warning_errno(errno, JOURNAL_LOG_RATELIMIT,
- "Failed to unlink %s, ignoring: %m", fn);
-
server_refresh_idle_timer(s);
return 0;
}