From: Sage Weil Date: Fri, 25 Mar 2011 20:50:45 +0000 (-0700) Subject: mds: fix client session removal on journal replay X-Git-Tag: v0.26~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=009714b8a24c9b175a8905b1c83805cffd80cd1a;p=ceph.git mds: fix client session removal on journal replay 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 --- diff --git a/src/mds/journal.cc b/src/mds/journal.cc index 7bfecc7c1ac3..99fafdc13c63 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -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()