systemd/0007-journal-forget-file-after-encountering-an-error.patch

75 lines
2.4 KiB
Diff
Raw Normal View History

Accepting request 225408 from Base:System - Add or port upstream bugfix patches: 0001-Fix-systemd-stdio-bridge-symlink.patch 0002-execute-free-directory-path-if-we-fail-to-remove-it-.patch 0003-Do-not-print-invalid-UTF-8-in-error-messages.patch 0004-man-document-missing-options-of-systemd-run.patch 0005-systemd-run-add-some-extra-safety-checks.patch 0006-journal-assume-that-next-entry-is-after-previous-ent.patch 0007-journal-forget-file-after-encountering-an-error.patch 0008-core-correctly-unregister-PIDs-from-PID-hashtables.patch 0009-logind-fix-reference-to-systemd-user-sessions.servic.patch 0010-man-update-link-to-LSB.patch 0011-man-systemd-bootchart-fix-spacing-in-command.patch 0012-man-add-missing-comma.patch 0013-units-Do-not-unescape-instance-name-in-systemd-backl.patch - Add linker scripts as place holder of the old systemd shared libraries now all included in libsystemd.so (bnc#867128) - Make patch 1006-udev-always-rename-network.patch work again and add it again. - address missing owner functionality in systemd-tmpfiles (fate#314974) 1022-systemd-tmpfiles-ownerkeep.patch - Generate the bash completion files on the fly for the case of not having the package bash-completion around - Add or port upstream bugfix patches: 0001-nspawn-fix-detection-of-missing-proc-self-loginuid.patch 0002-cdrom_id-use-the-old-MMC-fallback.patch 0003-journalctl-refuse-extra-arguments-with-verify-and-si.patch OBS-URL: https://build.opensuse.org/request/show/225408 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=177
2014-03-11 09:24:11 +01:00
From a9a245c128af6c0418085062c60251bc51fa4a94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 27 Feb 2014 00:11:54 -0500
Subject: [PATCH] journal: forget file after encountering an error
If we encounter an inconsistency in a file, let's just
ignore it. Otherwise, after previous patch, we would try,
and fail, to use this file in every invocation of sd_journal_next
or sd_journal_previous that happens afterwards.
---
src/journal/sd-journal.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git src/journal/sd-journal.c src/journal/sd-journal.c
index ef455e9..b54bc21 100644
--- src/journal/sd-journal.c
+++ src/journal/sd-journal.c
@@ -51,6 +51,8 @@
#define DEFAULT_DATA_THRESHOLD (64*1024)
+static void remove_file_real(sd_journal *j, JournalFile *f);
+
static bool journal_pid_changed(sd_journal *j) {
assert(j);
@@ -885,6 +887,7 @@ static int real_journal_next(sd_journal *j, direction_t direction) {
r = next_beyond_location(j, f, direction, &o, &p);
if (r < 0) {
log_debug("Can't iterate through %s, ignoring: %s", f->path, strerror(-r));
+ remove_file_real(j, f);
continue;
} else if (r == 0)
continue;
@@ -1339,7 +1342,7 @@ static int add_file(sd_journal *j, const char *prefix, const char *filename) {
}
static int remove_file(sd_journal *j, const char *prefix, const char *filename) {
- char *path;
+ _cleanup_free_ char *path;
JournalFile *f;
assert(j);
@@ -1351,10 +1354,17 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename)
return -ENOMEM;
f = hashmap_get(j->files, path);
- free(path);
if (!f)
return 0;
+ remove_file_real(j, f);
+ return 0;
+}
+
+static void remove_file_real(sd_journal *j, JournalFile *f) {
+ assert(j);
+ assert(f);
+
hashmap_remove(j->files, f->path);
log_debug("File %s removed.", f->path);
@@ -1372,8 +1382,6 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename)
journal_file_close(f);
j->current_invalidate_counter ++;
-
- return 0;
}
static int add_directory(sd_journal *j, const char *prefix, const char *dirname) {
--
1.7.9.2