|
|
7e7c9f |
From 7fe6194a2a7872532f121e6159d4fa60d1c85c50 Mon Sep 17 00:00:00 2001
|
|
|
f4d4e0 |
From: =?UTF-8?q?Michal=20Sekleta=CC=81r?= <msekleta@redhat.com>
|
|
|
f4d4e0 |
Date: Fri, 27 Mar 2020 17:01:59 +0100
|
|
|
f4d4e0 |
Subject: [PATCH] sd-journal: remove the dead code and actually fix #14695
|
|
|
f4d4e0 |
|
|
|
f4d4e0 |
journal_file_fstat() returns an error if we call it on already unlinked
|
|
|
f4d4e0 |
journal file and hence we never reach remove_file_real() which is the
|
|
|
f4d4e0 |
entire point.
|
|
|
f4d4e0 |
|
|
|
f4d4e0 |
I must have made some mistake while testing the fix that got me thinking
|
|
|
f4d4e0 |
the issue is gone while opposite was true.
|
|
|
f4d4e0 |
|
|
|
f4d4e0 |
Fixes #14695
|
|
|
f4d4e0 |
|
|
|
f4d4e0 |
(cherry-picked from commit 8581b9f9732d4c158bb5f773230a65ce77f2c292)
|
|
|
f4d4e0 |
|
|
|
7e7c9f |
Resolves: #1812889
|
|
|
f4d4e0 |
---
|
|
|
f4d4e0 |
src/journal/sd-journal.c | 7 +++----
|
|
|
f4d4e0 |
1 file changed, 3 insertions(+), 4 deletions(-)
|
|
|
f4d4e0 |
|
|
|
f4d4e0 |
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
|
|
|
f4d4e0 |
index 09466df810..1f03c8e8ba 100644
|
|
|
f4d4e0 |
--- a/src/journal/sd-journal.c
|
|
|
f4d4e0 |
+++ b/src/journal/sd-journal.c
|
|
|
f4d4e0 |
@@ -2399,13 +2399,12 @@ _public_ int sd_journal_wait(sd_journal *j, uint64_t timeout_usec) {
|
|
|
f4d4e0 |
Get rid of the deleted files now so they don't stay around indefinitely. */
|
|
|
f4d4e0 |
ORDERED_HASHMAP_FOREACH(f, j->files, i) {
|
|
|
f4d4e0 |
r = journal_file_fstat(f);
|
|
|
f4d4e0 |
- if (r < 0) {
|
|
|
f4d4e0 |
+ if (r == -EIDRM)
|
|
|
f4d4e0 |
+ remove_file_real(j, f);
|
|
|
f4d4e0 |
+ else if (r < 0) {
|
|
|
f4d4e0 |
log_error("Failed to fstat() journal file '%s' : %m", f->path);
|
|
|
f4d4e0 |
continue;
|
|
|
f4d4e0 |
}
|
|
|
f4d4e0 |
-
|
|
|
f4d4e0 |
- if (f->last_stat.st_nlink <= 0)
|
|
|
f4d4e0 |
- remove_file_real(j, f);
|
|
|
f4d4e0 |
}
|
|
|
f4d4e0 |
|
|
|
f4d4e0 |
/* The journal might have changed since the context
|