summaryrefslogtreecommitdiff
path: root/src/journal/journal-file.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-29 12:21:52 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-29 12:24:09 +0200
commit1fcefd8815455e416c1eda3c8c1220831a2f82e9 (patch)
treea0b19636d10485079e142c5e0ba6a367fc4a495f /src/journal/journal-file.c
parent076ea6f6d2d9d119cd467e7776e020d5766e2577 (diff)
journal-file: when rotating a journal file, fsync directory too
As suggested by: https://github.com/systemd/systemd/pull/3126#discussion_r61125474
Diffstat (limited to 'src/journal/journal-file.c')
-rw-r--r--src/journal/journal-file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index a58079bdd1..c9ce5c73be 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -3213,6 +3213,9 @@ int journal_file_rotate(JournalFile **f, bool compress, bool seal, Set *deferred
if (r < 0 && errno != ENOENT)
return -errno;
+ /* Sync the rename to disk */
+ (void) fsync_directory_of_file(old_file->fd);
+
/* Set as archive so offlining commits w/state=STATE_ARCHIVED.
* Previously we would set old_file->header->state to STATE_ARCHIVED directly here,
* but journal_file_set_offline() short-circuits when state != STATE_ONLINE, which