From 80e81ec4d2b76bf46b700c76602d15238fbc4205 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 8 Mar 2013 13:05:22 -0800 Subject: [PATCH] client: fix up _closed_mds_session Drop useless arg. Simplify callers. Signed-off-by: Sage Weil --- src/client/Client.cc | 14 +++++++------- src/client/Client.h | 2 +- src/client/MetaSession.cc | 1 + src/client/MetaSession.h | 1 + 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index ab26adf6541ab..a368a093052cb 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1488,14 +1488,14 @@ void Client::_close_mds_session(MetaSession *s) s->inst); } -void Client::_closed_mds_session(int mds, MetaSession *s) +void Client::_closed_mds_session(MetaSession *s) { + s->state = MetaSession::STATE_CLOSED; mount_cond.Signal(); - if (s) - remove_session_caps(s); - kick_requests(mds, true); + remove_session_caps(s); + kick_requests(s->mds_num, true); + mds_sessions.erase(s->mds_num); delete s; - mds_sessions.erase(mds); } void Client::handle_client_session(MClientSession *m) @@ -1522,7 +1522,7 @@ void Client::handle_client_session(MClientSession *m) break; case CEPH_SESSION_CLOSE: - _closed_mds_session(from, session); + _closed_mds_session(session); break; case CEPH_SESSION_RENEWCAPS: @@ -7769,7 +7769,7 @@ void Client::ms_handle_remote_reset(Connection *con) if (mds >= 0) { if (s->state == MetaSession::STATE_CLOSING) { ldout(cct, 1) << "reset from mds we were closing; we'll call that closed" << dendl; - _closed_mds_session(mds, s); + _closed_mds_session(s); } } } diff --git a/src/client/Client.h b/src/client/Client.h index cbd10a28cd8e2..069c1fb54a5d0 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -236,7 +236,7 @@ public: MetaSession *_get_or_open_mds_session(int mds); MetaSession *_open_mds_session(int mds); void _close_mds_session(MetaSession *s); - void _closed_mds_session(int mds, MetaSession *s); + void _closed_mds_session(MetaSession *s); void handle_client_session(MClientSession *m); void send_reconnect(int mds); void resend_unsafe_requests(int mds); diff --git a/src/client/MetaSession.cc b/src/client/MetaSession.cc index c6a9496710b5b..87c14bf11f648 100644 --- a/src/client/MetaSession.cc +++ b/src/client/MetaSession.cc @@ -14,6 +14,7 @@ const char *MetaSession::get_state_name() const case STATE_OPENING: return "opening"; case STATE_OPEN: return "open"; case STATE_CLOSING: return "closing"; + case STATE_CLOSED: return "closed"; default: return "unknown"; } } diff --git a/src/client/MetaSession.h b/src/client/MetaSession.h index bb3fad241a0d1..ab015a17bc431 100644 --- a/src/client/MetaSession.h +++ b/src/client/MetaSession.h @@ -33,6 +33,7 @@ struct MetaSession { STATE_OPENING, STATE_OPEN, STATE_CLOSING, + STATE_CLOSED, } state; list waiting_for_open; -- 2.39.5