mirror of
https://github.com/systemd/systemd.git
synced 2026-06-30 19:57:29 +00:00
journal: Tolerate lost tail hash chain nodes
The data and field hash table chains have the same problem the previous commit fixed for entry array chains. New data and field objects are linked at the tail of their hash bucket by patching the previous tail object's next_hash_offset in place, so after a crash a persisted predecessor (or the bucket head) can point at an object whose body never reached disk. journal_file_find_data_object_with_hash() and journal_file_find_field_object_with_hash() walk those chains while resolving matches, and on -EADDRNOTAVAIL/-EBADMSG from journal_file_move_to_object() they simply return the error directly. That propagates up to real_journal_next(), which discards the whole file from the query. Give those two lookups the same tolerance: on a read-only file, treat an unreadable chain node as the end of the bucket chain.
This commit is contained in:
@@ -1595,6 +1595,8 @@ int journal_file_find_field_object_with_hash(
|
||||
Object *o;
|
||||
|
||||
r = journal_file_move_to_object(f, OBJECT_FIELD, p, &o);
|
||||
if (chain_tail_lost(f, r, p, OBJECT_FIELD))
|
||||
break;
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -1696,6 +1698,8 @@ int journal_file_find_data_object_with_hash(
|
||||
size_t rsize;
|
||||
|
||||
r = journal_file_move_to_object(f, OBJECT_DATA, p, &o);
|
||||
if (chain_tail_lost(f, r, p, OBJECT_DATA))
|
||||
break;
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user