summaryrefslogtreecommitdiffstats
path: root/src/tools/cephfs/JournalScanner.cc
diff options
context:
space:
mode:
authorJohn Spray <john.spray@redhat.com>2015-09-24 14:08:43 +0200
committerJohn Spray <john.spray@redhat.com>2015-09-24 14:12:03 +0200
commit557df13b324bb396167772af6c9dd31136d7f895 (patch)
tree464e5a2f4e41cee24907d4a36a7b77ed3e2c9770 /src/tools/cephfs/JournalScanner.cc
parentMerge pull request #5928 from ceph/wip-12819-infernalis (diff)
downloadceph-557df13b324bb396167772af6c9dd31136d7f895.tar.xz
ceph-557df13b324bb396167772af6c9dd31136d7f895.zip
tools/cephfs: detect malformed ESubtreeMap::expire_pos
Signed-off-by: John Spray <john.spray@redhat.com>
Diffstat (limited to 'src/tools/cephfs/JournalScanner.cc')
-rw-r--r--src/tools/cephfs/JournalScanner.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tools/cephfs/JournalScanner.cc b/src/tools/cephfs/JournalScanner.cc
index f75edd9b29f..f2d22d0c230 100644
--- a/src/tools/cephfs/JournalScanner.cc
+++ b/src/tools/cephfs/JournalScanner.cc
@@ -15,6 +15,8 @@
#include "include/rados/librados.hpp"
#include "mds/JournalPointer.h"
+#include "mds/events/ESubtreeMap.h"
+
#include "JournalScanner.h"
#define dout_subsys ceph_subsys_mds
@@ -256,9 +258,21 @@ int JournalScanner::scan_events()
}
LogEvent *le = LogEvent::decode(le_bl);
+
if (le) {
dout(10) << "Valid entry at 0x" << std::hex << read_offset << std::dec << dendl;
+ if (le->get_type() == EVENT_SUBTREEMAP
+ || le->get_type() == EVENT_SUBTREEMAP_TEST) {
+ ESubtreeMap *sle = dynamic_cast<ESubtreeMap*>(le);
+ if (sle->expire_pos > read_offset) {
+ errors.insert(std::make_pair(
+ read_offset, EventError(
+ -ERANGE,
+ "ESubtreeMap has expire_pos ahead of its own position")));
+ }
+ }
+
if (filter.apply(read_offset, *le)) {
events[read_offset] = EventRecord(le, consumed);
} else {