From: John Spray Date: Thu, 15 Oct 2015 00:31:16 +0000 (+0100) Subject: client: close mds sessions in shutdown() X-Git-Tag: v10.0.2~188^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=07a748310dbc183cb5a3a52e92497dc5b91e2722;p=ceph.git client: close mds sessions in shutdown() Usually this happens in unmount(), but when we have instantiated Client without mounting (to send MDS commands), we need to handle closing any open sessions in shutdown as well. This is the correct replacement for the mark_down() call that was removed from handle_command_reply in the last commit. Signed-off-by: John Spray --- diff --git a/src/client/Client.cc b/src/client/Client.cc index aab30522e89..3ccffa6ba76 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -554,6 +554,12 @@ void Client::shutdown() { ldout(cct, 1) << "shutdown" << dendl; + // If we were not mounted, but were being used for sending + // MDS commands, we may have sessions that need closing. + client_lock.Lock(); + close_sessions(); + client_lock.Unlock(); + cct->_conf->remove_observer(this); AdminSocket* admin_socket = cct->get_admin_socket(); @@ -5100,6 +5106,24 @@ int Client::mount(const std::string &mount_root, bool require_mds) // UNMOUNT +void Client::close_sessions() +{ + while (!mds_sessions.empty()) { + // send session closes! + for (map::iterator p = mds_sessions.begin(); + p != mds_sessions.end(); + ++p) { + if (p->second->state != MetaSession::STATE_CLOSING) { + _close_mds_session(p->second); + } + } + + // wait for sessions to close + ldout(cct, 2) << "waiting for " << mds_sessions.size() << " mds sessions to close" << dendl; + mount_cond.Wait(client_lock); + } +} + void Client::unmount() { Mutex::Locker lock(client_lock); @@ -5184,21 +5208,7 @@ void Client::unmount() traceout.close(); } - - while (!mds_sessions.empty()) { - // send session closes! - for (map::iterator p = mds_sessions.begin(); - p != mds_sessions.end(); - ++p) { - if (p->second->state != MetaSession::STATE_CLOSING) { - _close_mds_session(p->second); - } - } - - // wait for sessions to close - ldout(cct, 2) << "waiting for " << mds_sessions.size() << " mds sessions to close" << dendl; - mount_cond.Wait(client_lock); - } + close_sessions(); mounted = false; diff --git a/src/client/Client.h b/src/client/Client.h index 0482360538b..4c3467003fc 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -534,6 +534,8 @@ protected: */ void _handle_full_flag(int64_t pool); + void close_sessions(); + public: void set_filer_flags(int flags); void clear_filer_flags(int flags);