]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Fix JournalStream::read length assertion
authorJohn Spray <john.spray@inktank.com>
Mon, 12 May 2014 13:16:54 +0000 (14:16 +0100)
committerJohn Spray <john.spray@inktank.com>
Tue, 20 May 2014 13:07:51 +0000 (14:07 +0100)
This was checking for new-format length even
when reading from an old-format journal.

Signed-off-by: John Spray <john.spray@inktank.com>
src/osdc/Journaler.cc

index 2748a8c446e93b1fddd7bc1618727344737c9891..f8ed7e23fdb5aacff7e055f9fd743d4af667a089 100644 (file)
@@ -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;
 }