From: Sage Weil Date: Fri, 31 May 2013 05:52:21 +0000 (-0700) Subject: mon: discard messages from disconnected clients X-Git-Tag: v0.64~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb3cd0c2a8f27a1c8d601a478fd896cc0b609011;p=ceph.git 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 Reviewed-by: Greg Farnum --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 89048a17f9b2..72fd3777a8ca 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2889,7 +2889,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 e360215b94ff..8840fcecc357 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;