]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: remove the dead code and actually fix #14695
authorMichal Sekletár <msekleta@redhat.com>
Fri, 27 Mar 2020 16:01:59 +0000 (17:01 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 28 Mar 2020 08:39:33 +0000 (09:39 +0100)
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

src/journal/sd-journal.c

index 56a6a9c431f9f8072d1fdd50edde1d3ac0c594c3..36f65ad68830432cd70d3cf440ceb261398542a1 100644 (file)
@@ -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