From: Sage Weil Date: Fri, 8 Mar 2013 21:01:56 +0000 (-0800) Subject: client: use helper for _close_mds_session() X-Git-Tag: v0.60~81^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=72d11844d9486a6c430bae33ea7072fc86261e4e;p=ceph.git client: use helper for _close_mds_session() Signed-off-by: Sage Weil --- diff --git a/src/client/Client.cc b/src/client/Client.cc index f115e10aca98..ab26adf6541a 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1480,6 +1480,14 @@ MetaSession *Client::_open_mds_session(int mds) return session; } +void Client::_close_mds_session(MetaSession *s) +{ + ldout(cct, 2) << "_close_mds_session mds." << s->mds_num << " seq " << s->seq << dendl; + s->state = MetaSession::STATE_CLOSING; + messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_CLOSE, s->seq), + s->inst); +} + void Client::_closed_mds_session(int mds, MetaSession *s) { mount_cond.Signal(); @@ -1505,12 +1513,10 @@ void Client::handle_client_session(MClientSession *m) switch (m->get_op()) { case CEPH_SESSION_OPEN: renew_caps(session); + session->state = MetaSession::STATE_OPEN; if (unmounting) { - session->state = MetaSession::STATE_CLOSING; - messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_CLOSE, session->seq), - mdsmap->get_inst(from)); + _close_mds_session(session); } else { - session->state = MetaSession::STATE_OPEN; connect_mds_targets(from); } break; @@ -1961,9 +1967,10 @@ void Client::got_mds_push(int mds) s->seq++; ldout(cct, 10) << " mds." << mds << " seq now " << s->seq << dendl; - if (s->state == MetaSession::STATE_CLOSING) + if (s->state == MetaSession::STATE_CLOSING) { messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_CLOSE, s->seq), s->inst); + } } void Client::handle_lease(MClientLease *m) @@ -3732,12 +3739,8 @@ void Client::unmount() for (map::iterator p = mds_sessions.begin(); p != mds_sessions.end(); ++p) { - ldout(cct, 2) << "sending client_session close to mds." << p->first - << " seq " << p->second->seq << dendl; if (p->second->state != MetaSession::STATE_CLOSING) { - p->second->state = MetaSession::STATE_CLOSING; - messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_CLOSE, p->second->seq), - mdsmap->get_inst(p->first)); + _close_mds_session(p->second); } } diff --git a/src/client/Client.h b/src/client/Client.h index 63b699c40228..cbd10a28cd8e 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -235,6 +235,7 @@ public: void got_mds_push(int mds); 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 handle_client_session(MClientSession *m); void send_reconnect(int mds);