]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: make mark_me_down asserts match check
authorSage Weil <sage@inktank.com>
Mon, 17 Jun 2013 03:13:51 +0000 (20:13 -0700)
committerSage Weil <sage@inktank.com>
Mon, 17 Jun 2013 03:13:51 +0000 (20:13 -0700)
The OSD may have sent a request where the message source does not match
the target in the message.  Verify that the target matches so that it
matches the assert.

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

index 7625a500448aa0efa7bdbeac136477339cfcc177..cf0e45d9a65af2d67f6f976959f8a1338ea3c7ee 100644 (file)
@@ -766,32 +766,33 @@ public:
 bool OSDMonitor::preprocess_mark_me_down(MOSDMarkMeDown *m)
 {
   int requesting_down = m->get_target().name.num();
+  int from = m->get_orig_source().num();
 
   // check permissions
   if (check_source(m, m->fsid))
-    goto didit;
+    goto reply;
 
   // first, verify the reporting host is valid
-  if (m->get_orig_source().is_osd()) {
-    int from = m->get_orig_source().num();
-    if (!osdmap.exists(from) ||
-       osdmap.get_addr(from) != m->get_orig_source_inst().addr ||
-       osdmap.is_down(from)) {
-      dout(5) << "preprocess_mark_me_down from dead osd."
-             << from << ", ignoring" << dendl;
-      send_incremental(m, m->get_epoch()+1);
-      goto didit;
-    }
+  if (!m->get_orig_source().is_osd())
+    goto reply;
+
+  if (!osdmap.exists(from) ||
+      osdmap.is_down(from) ||
+      osdmap.get_addr(from) != m->get_target().addr) {
+    dout(5) << "preprocess_mark_me_down from dead osd."
+           << from << ", ignoring" << dendl;
+    send_incremental(m, m->get_epoch()+1);
+    goto reply;
   }
 
   // no down might be set
   if (!can_mark_down(requesting_down))
-    goto didit;
+    goto reply;
 
   dout(10) << "MOSDMarkMeDown for: " << m->get_target() << dendl;
   return false;
 
didit:
reply:
   Context *c(new C_AckMarkedDown(this, m));
   c->complete(0);
   return true;