]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: verify full_crc when available
authorSage Weil <sage@redhat.com>
Fri, 22 Aug 2014 00:35:15 +0000 (17:35 -0700)
committerSage Weil <sage@redhat.com>
Fri, 12 Dec 2014 19:08:38 +0000 (11:08 -0800)
Crash if it is wrong.  The monitors should *always* agree.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index 7c6bb75623e44da32477c5b62c82fca37c4e4876..180d350d9718487571b1575babb5c343921b6805 100644 (file)
@@ -223,6 +223,16 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
     osdmap.encode(full_bl, f | CEPH_FEATURE_RESERVED);
     tx_size += full_bl.length();
 
+    // verify the crc is as expected
+    if (inc.have_crc &&
+       inc.full_crc != osdmap.crc) {
+      derr << "inc for epoch " << osdmap.get_epoch() << " has full_crc "
+          << inc.full_crc << " but actual is " << osdmap.crc
+          << " features " << f
+          << dendl;
+      assert(0 == "got mismatched crc encoding full map");
+    }
+
     put_version_full(t, osdmap.epoch, full_bl);
     put_version_latest_full(t, osdmap.epoch);