]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix crash killing sessions without conn 2297/head
authorJohn Spray <john.spray@redhat.com>
Thu, 21 Aug 2014 10:51:09 +0000 (11:51 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 21 Aug 2014 22:24:58 +0000 (23:24 +0100)
Bug was introduced in 54eca56695  (mds: use Connection::mark_down()).
Used to call SimpleMessenger::mark_down, which had a check for
connection==NULL, when calling conn->mark_down() we must
now do our own nullness check.

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

index ec77f81abaa72d3a27837edd516bf62b10d8aea5..aaa44c97fc25d087d45c84b2fed617f961737539 100644 (file)
@@ -310,6 +310,7 @@ void Server::_session_logged(Session *session, uint64_t state_seq, bool open, ve
     assert(session->is_opening());
     mds->sessionmap.set_state(session, Session::STATE_OPEN);
     mds->sessionmap.touch_session(session);
+    assert(session->connection != NULL);
     session->connection->send_message(new MClientSession(CEPH_SESSION_OPEN));
   } else if (session->is_closing() ||
             session->is_killing()) {
@@ -343,7 +344,11 @@ void Server::_session_logged(Session *session, uint64_t state_seq, bool open, ve
       // ms_handle_remote_reset() and realize they had in fact closed.
       // do this *before* sending the message to avoid a possible
       // race.
-      session->connection->mark_disposable();
+      if (session->connection != NULL) {;
+        // Conditional because terminate_sessions will indiscrimately
+        // put sessions in CLOSING whether they ever had a conn or not.
+        session->connection->mark_disposable();
+      }
 
       // reset session
       mds->send_message_client(new MClientSession(CEPH_SESSION_CLOSE), session);
@@ -351,7 +356,9 @@ void Server::_session_logged(Session *session, uint64_t state_seq, bool open, ve
       session->clear();
     } else if (session->is_killing()) {
       // destroy session, close connection
-      session->connection->mark_down();
+      if (session->connection != NULL) {
+        session->connection->mark_down();
+      }
       mds->sessionmap.remove_session(session);
     } else {
       assert(0);