]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix client session removal on journal replay
authorSage Weil <sage@newdream.net>
Fri, 25 Mar 2011 20:50:45 +0000 (13:50 -0700)
committerSage Weil <sage@newdream.net>
Fri, 25 Mar 2011 20:50:45 +0000 (13:50 -0700)
We want to remove the client session from the map as long as it is not
attached to an actual messenger Connection.  This key point got lost
somewhere the last time the session states were restructured.  It is now
explicit.

This fixes the symptom where a recovering MDS reconnect has to time out on
clients that cleanly closed their sessions.

Also, fix a use-after-free when (uselessly) printing the session state.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/journal.cc

index 7bfecc7c1ac39f980cb032b72fbd55ac61d008f1..99fafdc13c63ff804dd05093aee768265f3a20ed 100644 (file)
@@ -704,18 +704,20 @@ void ESession::replay(MDS *mds)
     Session *session;
     if (open) {
       session = mds->sessionmap.get_or_add_session(client_inst);
-      if (session->is_closed())
-       mds->sessionmap.set_state(session, Session::STATE_OPEN);
+      mds->sessionmap.set_state(session, Session::STATE_OPEN);
+      dout(10) << " opened session " << session->inst << dendl;
     } else {
       session = mds->sessionmap.get_session(client_inst.name);
-      if (session->is_closed())
+      if (session->connection == NULL) {
        mds->sessionmap.remove_session(session);
-      else
+       dout(10) << " removed session " << session->inst << dendl;
+      } else {
        session->clear();    // the client has reconnected; keep the Session, but reset
+       dout(10) << " reset session " << session->inst << " (they reconnected)" << dendl;
+      }
     }
-    dout(10) << "session " << session << " state " << session->get_state() << dendl;
   }
-
+  
   if (inos.size() && inotablev) {
     if (mds->inotable->get_version() >= inotablev) {
       dout(10) << "ESession.replay inotable " << mds->inotable->get_version()