ceph/ceph — pull request #2610 by ukernel (2014-09-30 13:03:29+00:00)
Title: mds: Add session to sessionmap when its state becomes opening

following sequence events may happen.
- client sends reconnect message to a recovering MDS.
- MDS::ms_verify_authorizer() create a session for the client, the
session is in closed state.
- MDS::handle_client_reconnect() sends session close message to
the client.
- client closes the old connection and opens a new connection
- MDS::ms_verify_authorizer() is called for a new connection
- MDS::ms_handle_reset() is called for the old connection
- MDS::ms_handle_accept() is called for the new connection

MDS::ms_handle_reset() removes client's session from the session map, this
can cause null pointer dereference when handling client request. The fix
is add session to sessionmap when its state becomes 'opening' and remove
session from sessionmap when its state becomes 'closed'

Signed-off-by: Yan, Zheng