]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: be more careful about decoding LogEvents
authorGreg Farnum <greg@inktank.com>
Wed, 11 Sep 2013 23:24:32 +0000 (16:24 -0700)
committerGreg Farnum <greg@inktank.com>
Mon, 23 Sep 2013 22:34:25 +0000 (15:34 -0700)
We need to wrap the full decode section or we can abort the process
if there's an issue (which we may want to just skip by).

Signed-off-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 73289b34b0be5b6612e38944794d59b5e789f841)

src/mds/LogEvent.cc

index b775b6d9501c74e60048af15fcb985756b9126b8..16e7f80319609c1df6a68b4628761fb0b9f6ab43 100644 (file)
@@ -46,10 +46,16 @@ LogEvent *LogEvent::decode(bufferlist& bl)
   ::decode(type, p);
 
   if (EVENT_NEW_ENCODING == type) {
-    DECODE_START(1, p);
-    ::decode(type, p);
-    event = decode_event(bl, p, type);
-    DECODE_FINISH(p);
+    try {
+      DECODE_START(1, p);
+      ::decode(type, p);
+      event = decode_event(bl, p, type);
+      DECODE_FINISH(p);
+    }
+    catch (const buffer::error &e) {
+      generic_dout(0) << "failed to decode LogEvent (type maybe " << type << ")" << dendl;
+      return NULL;
+    }
   } else { // we are using classic encoding
     event = decode_event(bl, p, type);
   }