From: John Spray Date: Mon, 12 May 2014 13:16:54 +0000 (+0100) Subject: Fix JournalStream::read length assertion X-Git-Tag: v0.82~48^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d52eeaba42bf3e1a2a06daca8101c1d6c3025543;p=ceph.git Fix JournalStream::read length assertion This was checking for new-format length even when reading from an old-format journal. Signed-off-by: John Spray --- diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc index 2748a8c446e9..f8ed7e23fdb5 100644 --- a/src/osdc/Journaler.cc +++ b/src/osdc/Journaler.cc @@ -1167,10 +1167,15 @@ size_t JournalStream::read(bufferlist &from, bufferlist &entry, uint64_t &start_ start_ptr = 0; } } + + size_t raw_length; if (format >= JOURNAL_FORMAT_RESILIENT) { + raw_length = sizeof(entry_size) + sizeof(entry_sentinel) + entry_size + sizeof(start_ptr); assert(entry_sentinel == sentinel); + } else { + raw_length = sizeof(entry_size) + entry_size; } - assert(from.length() >= sizeof(entry_size) + sizeof(entry_sentinel) + entry_size + sizeof(start_ptr)); + assert(from.length() >= raw_length); assert(entry_size != 0); if (format >= JOURNAL_FORMAT_RESILIENT) { @@ -1182,11 +1187,7 @@ size_t JournalStream::read(bufferlist &from, bufferlist &entry, uint64_t &start_ from.splice(0, sizeof(start_ptr)); } - if (format >= JOURNAL_FORMAT_RESILIENT) { - return (sizeof(entry_sentinel) + sizeof(entry_size) + entry_size + sizeof(start_ptr)); - } else { - return (sizeof(entry_size) + entry_size); - } + return raw_length; }