summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-05-30 22:52:21 -0700
committerSage Weil <sage@inktank.com>2013-06-02 16:34:18 -0700
commit38f8d850d35500e3d8751cd14c5cdaaff682c7d7 (patch)
tree2acfb935665f1ca13cf4e8283ebba9a3922b52d5
parent36d948981685114d2fe807f480c19aade7497194 (diff)
downloadceph-38f8d850d35500e3d8751cd14c5cdaaff682c7d7.tar.gz
mon: discard messages from disconnected clients
If the client is not connected, discard the message. They will reconnect and resend anyway, so there is no point in processing it twice (now and later). Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Greg Farnum <greg@inktank.com> (cherry picked from commit fb3cd0c2a8f27a1c8d601a478fd896cc0b609011)
-rw-r--r--src/mon/Monitor.cc2
-rw-r--r--src/mon/PaxosService.cc12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index aa76d43730d..af4289cce61 100644
--- a/src/mon/Monitor.cc
+++ b/src/mon/Monitor.cc
@@ -2869,7 +2869,7 @@ void Monitor::handle_forward(MForward *m)
dout(0) << "forward from entity with insufficient caps! "
<< session->caps << dendl;
} else {
- Connection *c = new Connection(NULL);
+ Connection *c = new Connection(NULL); // msgr must be null; see PaxosService::dispatch()
MonSession *s = new MonSession(m->msg->get_source_inst(), c);
c->set_priv(s);
c->set_peer_addr(m->client.addr);
diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc
index 5b69235e938..0421078b0d5 100644
--- a/src/mon/PaxosService.cc
+++ b/src/mon/PaxosService.cc
@@ -44,6 +44,18 @@ bool PaxosService::dispatch(PaxosServiceMessage *m)
return true;
}
+ // make sure the client is still connected. note that a proxied
+ // connection will be disconnected with a null message; don't drop
+ // those. also ignore loopback (e.g., log) messages.
+ if (!m->get_connection()->is_connected() &&
+ m->get_connection() != mon->messenger->get_loopback_connection() &&
+ m->get_connection()->get_messenger() != NULL) {
+ dout(10) << " discarding message from disconnected client "
+ << m->get_source_inst() << " " << *m << dendl;
+ m->put();
+ return true;
+ }
+
// make sure our map is readable and up to date
if (!is_readable(m->version)) {
dout(10) << " waiting for paxos -> readable (v" << m->version << ")" << dendl;