From: Venky Shankar Date: Thu, 11 Oct 2018 06:26:29 +0000 (-0400) Subject: mds: make timeout parameter optional for "cache drop" X-Git-Tag: v12.2.11~95^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3715525403ad2d1f296bcc7a27887003d6caaf73;p=ceph.git mds: make timeout parameter optional for "cache drop" Fixes: http://tracker.ceph.com/issues/36695 Signed-off-by: Venky Shankar (cherry picked from commit 73459619747046d38df5f4ec6707db12dce77317) Conflicts: src/mds/MDSDaemon.cc --- diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 1571fa4d9689..c444c5e533f2 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -252,7 +252,7 @@ void MDSDaemon::set_up_admin_socket() "show cache status"); assert(r == 0); r = admin_socket->register_command("cache drop", - "cache drop name=timeout,type=CephInt,range=1", + "cache drop name=timeout,type=CephInt,range=0,req=false", asok_hook, "drop cache"); assert(r == 0); @@ -653,7 +653,6 @@ void MDSDaemon::handle_command(MCommand *m) m->put(); } - struct MDSCommand { string cmdstring; string helpstring; @@ -707,7 +706,7 @@ COMMAND("heap " \ "name=heapcmd,type=CephChoices,strings=dump|start_profiler|stop_profiler|release|stats", \ "show heap usage info (available only if compiled with tcmalloc)", \ "mds", "*", "cli,rest") -COMMAND("cache drop name=timeout,type=CephInt,range=1", "trim cache and optionally " +COMMAND("cache drop name=timeout,type=CephInt,range=0,req=false", "trim cache and optionally " "request client to release all caps and flush the journal", "mds", "r", "cli,rest") }; diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index b81017a748aa..ce82e3707e56 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -279,6 +279,10 @@ private: } void start_timer() { + if (!timeout) { + return; + } + timer_task = new FunctionContext([this](int _) { timer_task = nullptr; complete(-ETIMEDOUT); @@ -2397,7 +2401,7 @@ bool MDSRankDispatcher::handle_asok_command( } else if (command == "cache drop") { int64_t timeout; if (!cmd_getval(g_ceph_context, cmdmap, "timeout", timeout)) { - return false; + timeout = 0; } C_SaferCond cond; @@ -3235,7 +3239,7 @@ bool MDSRankDispatcher::handle_command( } else if (prefix == "cache drop") { int64_t timeout; if (!cmd_getval(g_ceph_context, cmdmap, "timeout", timeout)) { - return false; + timeout = 0; } JSONFormatter *f = new JSONFormatter(true);