]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: tear down connections from `tell` commands 6933/head
authorJohn Spray <john.spray@redhat.com>
Mon, 14 Dec 2015 22:11:24 +0000 (22:11 +0000)
committerJohn Spray <john.spray@redhat.com>
Tue, 15 Dec 2015 11:20:11 +0000 (11:20 +0000)
We can identify sessions that were never really
opened, just created when a client sent in
a 'tell' message.  When we see one of those, mark
the associated connection disposable when responding
to the command.

Fixes: #14048
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDSDaemon.cc

index 9fcff34ab25680fc93bdca7cb5233f566060067f..4e1f0ff9d7b15fcc526f25998c8093820d83f4d9 100644 (file)
@@ -571,6 +571,21 @@ void MDSDaemon::handle_command(MCommand *m)
     r = _handle_command(cmdmap, m->get_data(), &outbl, &outs, &run_after);
   }
 
+  // If someone is using a closed session for sending commands (e.g.
+  // the ceph CLI) then we should feel free to clean up this connection
+  // as soon as we've sent them a response.
+  const bool live_session = mds_rank &&
+    mds_rank->sessionmap.get_session(session->info.inst.name) != nullptr
+    && session->get_state_seq() > 0;
+
+  if (!live_session) {
+    // This session only existed to issue commands, so terminate it
+    // as soon as we can.
+    assert(session->is_closed());
+    session->connection->mark_disposable();
+    session->put();
+  }
+
   MCommandReply *reply = new MCommandReply(r, outs);
   reply->set_tid(m->get_tid());
   reply->set_data(outbl);