summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Sekletár <msekleta@redhat.com>2020-03-27 17:01:59 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-04-01 19:18:35 +0200
commite4b7c40dca12b714932b2b8cea8755d2e31f7703 (patch)
tree2fffb52b147e4a11001c9c7a4d6db03888fe8532
parenta0b77ea24b314c6b23e7dda9a097db7d148e190e (diff)
downloadsystemd-e4b7c40dca12b714932b2b8cea8755d2e31f7703.tar.gz
sd-journal: remove the dead code and actually fix #14695
journal_file_fstat() returns an error if we call it on already unlinked journal file and hence we never reach remove_file_real() which is the entire point. I must have made some mistake while testing the fix that got me thinking the issue is gone while opposite was true. Fixes #14695 (cherry picked from commit 8581b9f9732d4c158bb5f773230a65ce77f2c292)
-rw-r--r--src/journal/sd-journal.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 56a6a9c431..36f65ad688 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -2675,13 +2675,12 @@ _public_ int sd_journal_wait(sd_journal *j, uint64_t timeout_usec) {
Get rid of the deleted files now so they don't stay around indefinitely. */
ORDERED_HASHMAP_FOREACH(f, j->files, i) {
r = journal_file_fstat(f);
- if (r < 0) {
+ if (r == -EIDRM)
+ remove_file_real(j, f);
+ else if (r < 0) {
log_debug_errno(r,"Failed to fstat() journal file '%s' : %m", f->path);
continue;
}
-
- if (f->last_stat.st_nlink <= 0)
- remove_file_real(j, f);
}
/* The journal might have changed since the context