]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: make timeout parameter optional for "cache drop" 25118/head
authorVenky Shankar <vshankar@redhat.com>
Thu, 11 Oct 2018 06:26:29 +0000 (02:26 -0400)
committerVenky Shankar <vshankar@redhat.com>
Thu, 15 Nov 2018 13:14:17 +0000 (08:14 -0500)
Fixes: http://tracker.ceph.com/issues/36694
Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit 73459619747046d38df5f4ec6707db12dce77317)

 Conflicts:
        src/mds/MDSDaemon.cc

src/mds/MDSDaemon.cc
src/mds/MDSRank.cc

index 76d658ddde309a512e9ff1ad810bfcb66fe32659..09bc9b5b882817d3df1d73b870e085d23540e906 100644 (file)
@@ -251,7 +251,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);
@@ -666,7 +666,6 @@ void MDSDaemon::handle_command(MCommand *m)
   m->put();
 }
 
-
 struct MDSCommand {
   string cmdstring;
   string helpstring;
@@ -724,7 +723,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")
 };
index b99e46283ea23be67fbcc13bf28259f7d0c2c6e7..9ef53b14f5002869f33ddcd5f1548b30c6eed792 100644 (file)
@@ -279,6 +279,10 @@ private:
     }
 
     void start_timer() {
+      if (!timeout) {
+        return;
+      }
+
       timer_task = new FunctionContext([this](int _) {
           timer_task = nullptr;
           complete(-ETIMEDOUT);
@@ -2513,7 +2517,7 @@ bool MDSRankDispatcher::handle_asok_command(std::string_view 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;
@@ -3380,7 +3384,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);