Discussion:
journal file boot_id and tail_entry_monotonic
(too old to reply)
Matthijs van Duin
2018-03-15 06:02:24 UTC
Permalink
While studying a bit how journal works, I noticed something odd:

My understanding of the boot_id field in the file header is that it should
reflect the boot_id of the tail entry, to allow correct interpretation of
the tail_entry_monotonic timestamp. This also agrees with the checks done
by journal_file_verify().

However, in journal_file_refresh_header(), the boot_id field is updated to
the current boot id even though no entry is being added there. This is even
being done before the journal file is set online!

Shouldn't the header boot_id instead be refreshed
in journal_file_link_entry(), where the tail_entry timestamps are being
updated?

(also, the tail_entry_monotonic_valid flag of JournalFile doesn't seem to
get tested anywhere?)

Matthijs
Lennart Poettering
2018-03-20 10:23:22 UTC
Permalink
Post by Matthijs van Duin
My understanding of the boot_id field in the file header is that it should
reflect the boot_id of the tail entry, to allow correct interpretation of
the tail_entry_monotonic timestamp. This also agrees with the checks done
by journal_file_verify().
However, in journal_file_refresh_header(), the boot_id field is updated to
the current boot id even though no entry is being added there. This is even
being done before the journal file is set online!
I am pretty sure the boot ID should reflect the boot the file was last
set online on. Hence I'd say journal_file_verify() is wrong, and
journal_file_refresh_header() is right.

Will fix!
Post by Matthijs van Duin
Shouldn't the header boot_id instead be refreshed
in journal_file_link_entry(), where the tail_entry timestamps are being
updated?
(also, the tail_entry_monotonic_valid flag of JournalFile doesn't seem to
get tested anywhere?)
True! I guess we can drop that.

Will fix, too!

Thanks for the hints, such code reviews are very welcome!

Lennart
--
Lennart Poettering, Red Hat
Matthijs van Duin
2018-03-28 22:13:31 UTC
Permalink
Post by Lennart Poettering
I am pretty sure the boot ID should reflect the boot the file was last
set online on. Hence I'd say journal_file_verify() is wrong, and
journal_file_refresh_header() is right.
So that means that tail_entry_monotonic is basically useless, since
it's a monotonic timestamp for an unknown boot id?

Matthijs

Loading...