diff --git a/0002-journal-remember-last-direction-of-search-and-keep-o.patch b/0002-journal-remember-last-direction-of-search-and-keep-o.patch new file mode 100644 index 0000000..d956170 --- /dev/null +++ b/0002-journal-remember-last-direction-of-search-and-keep-o.patch @@ -0,0 +1,122 @@ +From 87011c25d96e9fbcd8a465ba758fa037c7d08203 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Thu, 6 Jun 2013 22:28:05 -0400 +Subject: [PATCH 01/13] journal: remember last direction of search and keep + offset cache + +The fields in JournalFile are moved around to avoid wasting +7 bytes because of alignment. +--- + TODO | 3 --- + src/journal/journal-file.h | 18 +++++++++++------- + src/journal/sd-journal.c | 11 +++++------ + 3 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/TODO b/TODO +index 0dd19a0..1dc585c 100644 +--- a/TODO ++++ b/TODO +@@ -77,9 +77,6 @@ Features: + + * investigate endianess issues of UUID vs. GUID + +-* see if we can fix https://bugs.freedesktop.org/show_bug.cgi?id=63672 +- without dropping the location cache entirely. +- + * dbus: when a unit failed to load (i.e. is in UNIT_ERROR state), we + should be able to safely try another attempt when the bus call LoadUnit() is invoked. + +diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h +index 7b1cd42..5cc2c2d 100644 +--- a/src/journal/journal-file.h ++++ b/src/journal/journal-file.h +@@ -42,10 +42,14 @@ typedef struct JournalMetrics { + uint64_t keep_free; + } JournalMetrics; + ++typedef enum direction { ++ DIRECTION_UP, ++ DIRECTION_DOWN ++} direction_t; ++ + typedef struct JournalFile { + int fd; +- char *path; +- struct stat last_stat; ++ + mode_t mode; + + int flags; +@@ -56,6 +60,11 @@ typedef struct JournalFile { + + bool tail_entry_monotonic_valid; + ++ direction_t last_direction; ++ ++ char *path; ++ struct stat last_stat; ++ + Header *header; + HashItem *data_hash_table; + HashItem *field_hash_table; +@@ -90,11 +99,6 @@ typedef struct JournalFile { + #endif + } JournalFile; + +-typedef enum direction { +- DIRECTION_UP, +- DIRECTION_DOWN +-} direction_t; +- + int journal_file_open( + const char *fname, + int flags, +diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c +index 3aa9ed4..4c4cc2d 100644 +--- a/src/journal/sd-journal.c ++++ b/src/journal/sd-journal.c +@@ -102,7 +102,8 @@ static void init_location(Location *l, LocationType type, JournalFile *f, Object + l->seqnum_set = l->realtime_set = l->monotonic_set = l->xor_hash_set = true; + } + +-static void set_location(sd_journal *j, LocationType type, JournalFile *f, Object *o, uint64_t offset) { ++static void set_location(sd_journal *j, LocationType type, JournalFile *f, Object *o, ++ direction_t direction, uint64_t offset) { + assert(j); + assert(type == LOCATION_DISCRETE || type == LOCATION_SEEK); + assert(f); +@@ -110,12 +111,10 @@ static void set_location(sd_journal *j, LocationType type, JournalFile *f, Objec + + init_location(&j->current_location, type, f, o); + +- if (j->current_file) +- j->current_file->current_offset = 0; +- + j->current_file = f; + j->current_field = 0; + ++ f->last_direction = direction; + f->current_offset = offset; + } + +@@ -811,7 +810,7 @@ static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc + assert(j); + assert(f); + +- if (f->current_offset > 0) { ++ if (f->last_direction == direction && f->current_offset > 0) { + cp = f->current_offset; + + r = journal_file_move_to_object(f, OBJECT_ENTRY, cp, &c); +@@ -908,7 +907,7 @@ static int real_journal_next(sd_journal *j, direction_t direction) { + if (r < 0) + return r; + +- set_location(j, LOCATION_DISCRETE, new_file, o, new_offset); ++ set_location(j, LOCATION_DISCRETE, new_file, o, direction, new_offset); + + return 1; + } +-- +1.8.2.1 + diff --git a/systemd.spec b/systemd.spec index 678dfb4..b130073 100644 --- a/systemd.spec +++ b/systemd.spec @@ -13,7 +13,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 204 -Release: 7%{?gitcommit:.git%{gitcommit}}%{?dist} +Release: 8%{?gitcommit:.git%{gitcommit}}%{?dist} # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: A System and Service Manager @@ -36,6 +36,7 @@ Source4: listen.conf Source6: yum-protect-systemd.conf Patch1: 0001-journal-letting-interleaved-seqnums-go.patch +Patch2: 0002-journal-remember-last-direction-of-search-and-keep-o.patch # kernel-install patch for grubby, drop if grubby is obsolete Patch1000: kernel-install-grubby.patch @@ -757,6 +758,10 @@ fi %{_libdir}/pkgconfig/gudev-1.0* %changelog +* Fri Jun 14 2013 Harald Hoyer 204-8 +- fix, which helps to sucessfully browse journals with + duplicated seqnums + * Fri Jun 14 2013 Harald Hoyer 204-7 - fix duplicate message ID bug Resolves: rhbz#974132