From 73289b34b0be5b6612e38944794d59b5e789f841 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Wed, 11 Sep 2013 16:24:32 -0700 Subject: [PATCH] mds: be more careful about decoding LogEvents 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 Reviewed-by: Sage Weil --- src/mds/LogEvent.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mds/LogEvent.cc b/src/mds/LogEvent.cc index b775b6d9501c7..16e7f80319609 100644 --- a/src/mds/LogEvent.cc +++ b/src/mds/LogEvent.cc @@ -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); } -- 2.39.5