chiark / gitweb /
journal: add memory barrier before linking in newly created entries
[elogind.git] / src / journal / journal-file.c
index 45aab0e54a0eacfb2b3923a6c1ae2c8e50e66f0f..15a752d507eae8892e92ae7931dd3d562347a28c 100644 (file)
@@ -138,6 +138,9 @@ static int journal_file_refresh_header(JournalFile *f) {
         f->header->boot_id = boot_id;
 
         f->header->state = STATE_ONLINE;
+
+        __sync_synchronize();
+
         return 0;
 }
 
@@ -898,6 +901,8 @@ static int journal_file_link_entry(JournalFile *f, Object *o, uint64_t offset) {
         assert(offset > 0);
         assert(o->object.type == OBJECT_ENTRY);
 
+        __sync_synchronize();
+
         /* Link up the entry itself */
         r = link_entry_into_array(f,
                                   &f->header->entry_array_offset,