From 2be6297d12e99dbb25a14f36e4ecdb6b54425776 Mon Sep 17 00:00:00 2001 From: John Spray Date: Fri, 17 Mar 2017 10:32:45 +0000 Subject: [PATCH] mds: remove legacy MMonCommand handling Fixes: http://tracker.ceph.com/issues/19288 Signed-off-by: John Spray --- src/mds/MDSDaemon.cc | 71 ++++-------------------------------- src/mds/MDSDaemon.h | 2 -- src/mds/MDSRank.cc | 85 -------------------------------------------- src/mds/MDSRank.h | 1 - 4 files changed, 6 insertions(+), 153 deletions(-) diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index ff5890b56b3..51f047ca6a1 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -668,16 +668,6 @@ COMMAND("heap " \ "mds", "*", "cli,rest") }; -// FIXME: reinstate issue_caps, try_eval, -// *if* it makes sense to do so (or should these be admin socket things?) - -/* This function DOES put the passed message before returning*/ -void MDSDaemon::handle_command(MMonCommand *m) -{ - bufferlist outbl; - _handle_command_legacy(m->cmd); - m->put(); -} int MDSDaemon::_handle_command( const cmdmap_t &cmdmap, @@ -820,55 +810,6 @@ out: return r; } -/** - * Legacy "mds tell", takes a simple array of args - */ -int MDSDaemon::_handle_command_legacy(std::vector args) -{ - dout(10) << "handle_command args: " << args << dendl; - if (args[0] == "injectargs") { - if (args.size() < 2) { - derr << "Ignoring empty injectargs!" << dendl; - } - else { - std::ostringstream oss; - mds_lock.Unlock(); - g_conf->injectargs(args[1], &oss); - mds_lock.Lock(); - derr << "injectargs:" << dendl; - derr << oss.str() << dendl; - } - } - else if (args[0] == "exit") { - suicide(); - } - else if (args[0] == "respawn") { - respawn(); - } - else if (args[0] == "cpu_profiler") { - ostringstream ss; - cpu_profiler_handle_command(args, ss); - clog->info() << ss.str(); - } - else if (args[0] == "heap") { - if (!ceph_using_tcmalloc()) - clog->info() << "tcmalloc not enabled, can't use heap profiler commands"; - else { - ostringstream ss; - vector cmdargs; - cmdargs.insert(cmdargs.begin(), args.begin()+1, args.end()); - ceph_heap_profiler_handle_command(cmdargs, ss); - clog->info() << ss.str(); - } - } else { - if (!(mds_rank && mds_rank->handle_command_legacy(args))) { - dout(0) << "unrecognized command! " << args << dendl; - } - } - - return 0; -} - /* This function deletes the passed message before returning. */ void MDSDaemon::handle_mds_map(MMDSMap *m) @@ -1187,12 +1128,6 @@ bool MDSDaemon::handle_core_message(Message *m) handle_mds_map(static_cast(m)); break; - // misc - case MSG_MON_COMMAND: - ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON); - handle_command(static_cast(m)); - break; - // OSD case MSG_COMMAND: handle_command(static_cast(m)); @@ -1206,6 +1141,12 @@ bool MDSDaemon::handle_core_message(Message *m) m->put(); break; + case MSG_MON_COMMAND: + ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON); + clog->warn() << "dropping `mds tell` command from legacy monitor"; + m->put(); + break; + default: return false; } diff --git a/src/mds/MDSDaemon.h b/src/mds/MDSDaemon.h index 71f861bd8b4..835fce67d01 100644 --- a/src/mds/MDSDaemon.h +++ b/src/mds/MDSDaemon.h @@ -170,7 +170,6 @@ protected: friend class C_MDS_Send_Command_Reply; static void send_command_reply(MCommand *m, MDSRank* mds_rank, int r, bufferlist outbl, const std::string& outs); - int _handle_command_legacy(std::vector args); int _handle_command( const cmdmap_t &cmdmap, MCommand *m, @@ -178,7 +177,6 @@ protected: std::string *outs, Context **run_later, bool *need_reply); - void handle_command(class MMonCommand *m); void handle_command(class MCommand *m); void handle_mds_map(class MMDSMap *m); void _handle_mds_map(MDSMap *oldmap); diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 6ebf5a5988b..46a39dc8f46 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -2517,91 +2517,6 @@ void MDSRank::bcast_mds_map() last_client_mdsmap_bcast = mdsmap->get_epoch(); } - -bool MDSRankDispatcher::handle_command_legacy(std::vector args) -{ - if (args[0] == "dumpcache") { - if (args.size() > 1) - mdcache->dump_cache(args[1].c_str()); - else - mdcache->dump_cache(); - } - else if (args[0] == "session" && args[1] == "kill") { - std::stringstream ss; - bool killed = kill_session(strtol(args[2].c_str(), 0, 10), false, ss); - if (!killed) - dout(15) << ss.str() << dendl; - - } else if (args[0] == "issue_caps") { - long inum = strtol(args[1].c_str(), 0, 10); - CInode *in = mdcache->get_inode(inodeno_t(inum)); - if (in) { - bool r = locker->issue_caps(in); - dout(20) << "called issue_caps on inode " << inum - << " with result " << r << dendl; - } else dout(15) << "inode " << inum << " not in mdcache!" << dendl; - } else if (args[0] == "try_eval") { - long inum = strtol(args[1].c_str(), 0, 10); - int mask = strtol(args[2].c_str(), 0, 10); - CInode * ino = mdcache->get_inode(inodeno_t(inum)); - if (ino) { - locker->try_eval(ino, mask); - dout(20) << "try_eval(" << inum << ", " << mask << ")" << dendl; - } else dout(15) << "inode " << inum << " not in mdcache!" << dendl; - } else if (args[0] == "fragment_dir") { - if (mdsmap->allows_dirfrags()) { - if (args.size() == 4) { - filepath fp(args[1].c_str()); - CInode *in = mdcache->cache_traverse(fp); - if (in) { - frag_t fg; - if (fg.parse(args[2].c_str())) { - CDir *dir = in->get_dirfrag(fg); - if (dir) { - if (dir->is_auth()) { - int by = atoi(args[3].c_str()); - if (by) - mdcache->split_dir(dir, by); - else - dout(0) << "need to split by >0 bits" << dendl; - } else dout(0) << "dir " << dir->dirfrag() << " not auth" << dendl; - } else dout(0) << "dir " << in->ino() << " " << fg << " dne" << dendl; - } else dout(0) << " frag " << args[2] << " does not parse" << dendl; - } else dout(0) << "path " << fp << " not found" << dendl; - } else dout(0) << "bad syntax" << dendl; - } else dout(0) << "dirfrags are disallowed by the mds map!" << dendl; - } else if (args[0] == "merge_dir") { - if (args.size() == 3) { - filepath fp(args[1].c_str()); - CInode *in = mdcache->cache_traverse(fp); - if (in) { - frag_t fg; - if (fg.parse(args[2].c_str())) { - mdcache->merge_dir(in, fg); - } else dout(0) << " frag " << args[2] << " does not parse" << dendl; - } else dout(0) << "path " << fp << " not found" << dendl; - } else dout(0) << "bad syntax" << dendl; - } else if (args[0] == "export_dir") { - if (args.size() == 3) { - filepath fp(args[1].c_str()); - mds_rank_t target = mds_rank_t(atoi(args[2].c_str())); - if (target != whoami && mdsmap->is_up(target) && mdsmap->is_in(target)) { - CInode *in = mdcache->cache_traverse(fp); - if (in) { - CDir *dir = in->get_dirfrag(frag_t()); - if (dir && dir->is_auth()) { - mdcache->migrator->export_dir(dir, target); - } else dout(0) << "bad export_dir path dirfrag frag_t() or dir not auth" << dendl; - } else dout(0) << "bad export_dir path" << dendl; - } else dout(0) << "bad export_dir target syntax" << dendl; - } else dout(0) << "bad export_dir syntax" << dendl; - } else { - return false; - } - - return true; -} - MDSRankDispatcher::MDSRankDispatcher( mds_rank_t whoami_, Mutex &mds_lock_, diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index c8749ff33a9..e8d7af2fc5c 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -515,7 +515,6 @@ public: void handle_osd_map(); bool kill_session(int64_t session_id, bool wait, std::stringstream& ss); void update_log_config(); - bool handle_command_legacy(std::vector args); bool handle_command( const cmdmap_t &cmdmap, -- 2.47.3