From 360af4cf6f18469df97c11af4cd5696e0ca8b3ef Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Thu, 9 Oct 2014 22:44:29 -0400 Subject: sd-journal: do not reset sd_j_enumerate_unique position on error systemctl would call sd_j_enumerate_unique() interleaved with sd_j_next(). But the latter can remove a file if it detects an error in it. In those circumstances sd_j_enumerate_unique would restart with the first file in hashmap. With many corrupted files sd_j_enumerate_unique might iterate over the list multiple times. Avoid this by jumping to the next file in unique list if possible, or setting a flag that tells sd_j_enumerate_unique that it is done otherwise. --- src/journal/journal-internal.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/journal/journal-internal.h') diff --git a/src/journal/journal-internal.h b/src/journal/journal-internal.h index 2f1f7fc771..e591fb61f8 100644 --- a/src/journal/journal-internal.h +++ b/src/journal/journal-internal.h @@ -124,6 +124,10 @@ struct sd_journal { bool on_network; bool no_new_files; + bool unique_file_lost; /* File we were iterating over got + removed, and there were no more + files, so sd_j_enumerate_unique + will return a value equal to 0. */ size_t data_threshold; -- cgit v1.2.3-54-g00ecf