]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMonitor: factor out check_source helper
authorSamuel Just <sam.just@inktank.com>
Wed, 20 Mar 2013 21:30:29 +0000 (14:30 -0700)
committerSamuel Just <sam.just@inktank.com>
Fri, 22 Mar 2013 01:37:35 +0000 (18:37 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h

index 8c4d1a43c777114e69d6eabf1994a32de025bba1..952b3721c2b725d756330563aa70d267327d2e08 100644 (file)
@@ -625,25 +625,33 @@ bool OSDMonitor::should_propose(double& delay)
 
 // failure --
 
-bool OSDMonitor::preprocess_failure(MOSDFailure *m)
-{
-  // who is target_osd
-  int badboy = m->get_target().name.num();
-
+bool OSDMonitor::check_source(PaxosServiceMessage *m, uuid_d fsid) {
   // check permissions
   MonSession *session = m->get_session();
   if (!session)
-    goto didit;
+    return true;
   if (!session->caps.check_privileges(PAXOS_OSDMAP, MON_CAP_X)) {
-    dout(0) << "got MOSDFailure from entity with insufficient caps "
+    dout(0) << "got osdmap change request from entity with insufficient caps "
            << session->caps << dendl;
-    goto didit;
+    return true;
+  }
+  if (fsid != mon->monmap->fsid) {
+    dout(0) << "check_source: on fsid " << fsid
+           << " != " << mon->monmap->fsid << dendl;
+    return true;
   }
+  return false;
+}
 
-  if (m->fsid != mon->monmap->fsid) {
-    dout(0) << "preprocess_failure on fsid " << m->fsid << " != " << mon->monmap->fsid << dendl;
+
+bool OSDMonitor::preprocess_failure(MOSDFailure *m)
+{
+  // who is target_osd
+  int badboy = m->get_target().name.num();
+
+  // check permissions
+  if (check_source(m, m->fsid))
     goto didit;
-  }
 
   // first, verify the reporting host is valid
   if (m->get_orig_source().is_osd()) {
index 42d241ec2b1f80852c9b612cc7f4f4108ae2b7f7..4dd6feecc1d46748582135c8e7aca70d4f13da75 100644 (file)
@@ -171,6 +171,8 @@ private:
   void remove_redundant_pg_temp();
   void remove_down_pg_temp();
   int reweight_by_utilization(int oload, std::string& out_str);
+
+  bool check_source(PaxosServiceMessage *m, uuid_d fsid);
  
   bool preprocess_failure(class MOSDFailure *m);
   bool prepare_failure(class MOSDFailure *m);