]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: discard messages from disconnected clients
authorSage Weil <sage@inktank.com>
Fri, 31 May 2013 05:52:21 +0000 (22:52 -0700)
committerSage Weil <sage@inktank.com>
Sat, 1 Jun 2013 00:05:17 +0000 (17:05 -0700)
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>
src/mon/Monitor.cc
src/mon/PaxosService.cc

index 89048a17f9b250668aa3e708dfc884fd4654dde4..72fd3777a8cacaa479a6173f54921758e67efc51 100644 (file)
@@ -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);
index e360215b94ff11a48e206ca5897732b663909e6d..8840fcecc3576f88f2039888a999ee7525b55b2d 100644 (file)
@@ -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;