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.
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;
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;