From 63f57ded6cdd0b5bc2f612290f1ec0677c4a8a9c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 9 Dec 2019 22:38:57 -0600 Subject: [PATCH] mds/MDSDaemon: make con disposable before passing message to asok Signed-off-by: Sage Weil --- src/mds/MDSDaemon.cc | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 16722b584a465..6092a7cae9938 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); -- 2.47.3