summaryrefslogtreecommitdiff
path: root/src/journal/journald-server.c
diff options
context:
space:
mode:
authorVito Caputo <vito.caputo@coreos.com>2016-02-12 04:59:57 -0800
committerVito Caputo <vito.caputo@coreos.com>2016-02-19 18:50:20 -0800
commitac2e41f5103ce2c679089c4f8fb6be61d7caec07 (patch)
treeaa9015d7a0e9466e783704d857dd5db0fec70512 /src/journal/journald-server.c
parent69a3a6fd3d96101d42a01d0e7d33ae2ef613e54a (diff)
journal: asynchronous journal_file_set_offline()
This adds a wait flag to journal_file_set_offline(), when false the offline is performed asynchronously in a separate thread. When wait is true, if an asynchronous offline is already in-progress it is restarted and waited for. Otherwise the offline is performed synchronously without the use of a thread. journal_file_set_online() cancels or waits for the asynchronous offline to complete if in-flight, depending on where in the offline process the thread happens to be. If the thread is in the fsync() phase, it is cancelled and waiting is unnecessary. Otherwise, the thread is joined before proceeding. A new offline_state member is added to JournalFile which is used via atomic operations for communicating between the offline thread and the journal_file_set_{offline,online}() functions.
Diffstat (limited to 'src/journal/journald-server.c')
-rw-r--r--src/journal/journald-server.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 5e120fdac0..ac992a8b54 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -372,13 +372,13 @@ void server_sync(Server *s) {
int r;
if (s->system_journal) {
- r = journal_file_set_offline(s->system_journal);
+ r = journal_file_set_offline(s->system_journal, false);
if (r < 0)
log_warning_errno(r, "Failed to sync system journal, ignoring: %m");
}
ORDERED_HASHMAP_FOREACH(f, s->user_journals, i) {
- r = journal_file_set_offline(f);
+ r = journal_file_set_offline(f, false);
if (r < 0)
log_warning_errno(r, "Failed to sync user journal, ignoring: %m");
}