From: Samuel Just Date: Thu, 28 Feb 2013 00:58:45 +0000 (-0800) Subject: FileJournal::wrap_read_bl: adjust pos before returning X-Git-Tag: v0.56.4~53 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ee943c8bcf36f1e2218d8e25edfa38ec5fe4bec2;p=ceph.git FileJournal::wrap_read_bl: adjust pos before returning Otherwise, we may feed an offset past the end of the journal to check_header in read_entry and incorrectly determine that the entry is corrupt. Fixes: 4296 Backport: bobtail Backport: argonaut Reviewed-by: Sage Weil Signed-off-by: Samuel Just (cherry picked from commit 5d54ab154ca790688a6a1a2ad5f869c17a23980a) --- diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 50bbb95190e3..0056f1f23b44 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -1591,6 +1591,8 @@ void FileJournal::wrap_read_bl(off64_t& pos, int64_t olen, bufferlist& bl) pos += len; olen -= len; } + if (pos >= header.max_size) + pos = pos + get_top() - header.max_size; } bool FileJournal::read_entry(bufferlist& bl, uint64_t& seq)