]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: deal with the case where you have a Session close event without a Session.
authorGreg Farnum <greg@inktank.com>
Fri, 19 Oct 2012 21:27:38 +0000 (14:27 -0700)
committerSage Weil <sage@inktank.com>
Sat, 20 Oct 2012 22:58:56 +0000 (15:58 -0700)
This case shouldn't ever happen, but we've seen it, so there's a bug
somewhere. Handling a Session close when the Session is already closed
is easy, though -- we don't need to do anything!

Signed-off-by: Greg Farnum <greg@inktank.com>
src/mds/journal.cc

index 0de3f397f46bb2bb55039202621a293e44fc3831..3f839314bfaedf97ff8537c092a1d2b5e9965212 100644 (file)
@@ -831,12 +831,17 @@ void ESession::replay(MDS *mds)
       dout(10) << " opened session " << session->inst << dendl;
     } else {
       session = mds->sessionmap.get_session(client_inst.name);
-      if (session->connection == NULL) {
-       dout(10) << " removed session " << session->inst << dendl;
-       mds->sessionmap.remove_session(session);
+      if (session) { // there always should be a session, but there's a bug
+       if (session->connection == NULL) {
+         dout(10) << " removed session " << session->inst << dendl;
+         mds->sessionmap.remove_session(session);
+       } else {
+         session->clear();    // the client has reconnected; keep the Session, but reset
+         dout(10) << " reset session " << session->inst << " (they reconnected)" << dendl;
+       }
       } else {
-       session->clear();    // the client has reconnected; keep the Session, but reset
-       dout(10) << " reset session " << session->inst << " (they reconnected)" << dendl;
+       mds->clog.warn() << "Replayed stray Session close event for " << client_inst
+                        << " from time " << stamp << ", ignoring!";
       }
     }
   }