From: Samuel Just Date: Wed, 20 Mar 2013 21:30:29 +0000 (-0700) Subject: OSDMonitor: factor out check_source helper X-Git-Tag: v0.62~191^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=edebb341c20b48f3a2e0eeea65765b1350f80bd0;p=ceph.git OSDMonitor: factor out check_source helper Signed-off-by: Samuel Just --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 8c4d1a43c77..952b3721c2b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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()) { diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 42d241ec2b1..4dd6feecc1d 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -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);