From: Sage Weil Date: Tue, 10 Dec 2019 04:38:57 +0000 (-0600) Subject: mds/MDSDaemon: make con disposable before passing message to asok X-Git-Tag: v15.1.0~519^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=63f57ded6cdd0b5bc2f612290f1ec0677c4a8a9c;p=ceph-ci.git mds/MDSDaemon: make con disposable before passing message to asok Signed-off-by: Sage Weil --- diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 16722b584a4..6092a7cae99 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -591,6 +591,22 @@ void MDSDaemon::handle_command(const cref_t &m) std::string outs; bufferlist outbl; + // If someone is using a closed session for sending commands (e.g. + // the ceph CLI) then we should feel free to clean up this connection + // as soon as we've sent them a response. + const bool live_session = + session->get_state_seq() > 0 && + mds_rank && + mds_rank->sessionmap.get_session(session->info.inst.name); + + if (!live_session) { + // This session only existed to issue commands, so terminate it + // as soon as we can. + ceph_assert(session->is_closed()); + session->get_connection()->mark_disposable(); + } + priv.reset(); + if (!session->auth_caps.allow_all()) { dout(1) << __func__ << ": received command from client without `tell` capability: " @@ -610,22 +626,6 @@ void MDSDaemon::handle_command(const cref_t &m) return; } - // If someone is using a closed session for sending commands (e.g. - // the ceph CLI) then we should feel free to clean up this connection - // as soon as we've sent them a response. - const bool live_session = - session->get_state_seq() > 0 && - mds_rank && - mds_rank->sessionmap.get_session(session->info.inst.name); - - if (!live_session) { - // This session only existed to issue commands, so terminate it - // as soon as we can. - ceph_assert(session->is_closed()); - session->get_connection()->mark_disposable(); - } - priv.reset(); - auto reply = make_message(r, outs); reply->set_tid(m->get_tid()); reply->set_data(outbl);