diff options
author | Michal Sekletár <msekleta@redhat.com> | 2020-03-27 17:01:59 +0100 |
---|---|---|
committer | The Plumber <50238977+systemd-rhel-bot@users.noreply.github.com> | 2020-05-04 16:20:31 +0200 |
commit | f903a10d666f11a0147fa7baf7aeafd60cbfe44e (patch) | |
tree | 89a5c9bf2b0cf5988625281d450182d71a8918f0 | |
parent | 0d33f461f8b824ab94239c1c1495c2cb7c9de54f (diff) | |
download | systemd-f903a10d666f11a0147fa7baf7aeafd60cbfe44e.tar.gz |
sd-journal: remove the dead code and actually fix #14695v239-18.6
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)
Resolves: #1826216
-rw-r--r-- | src/journal/sd-journal.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index c06255e273..4c502978de 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -2597,13 +2597,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 |