]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: make timeout parameter optional for "cache drop"
authorVenky Shankar <vshankar@redhat.com>
Thu, 11 Oct 2018 06:26:29 +0000 (02:26 -0400)
committerVenky Shankar <vshankar@redhat.com>
Thu, 25 Oct 2018 09:13:05 +0000 (05:13 -0400)
Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/mds/MDSDaemon.cc
src/mds/MDSRank.cc

index 7d20f4143833039d7ba6fda971677cd8d3e1dadb..d8ebd386d4940289b4740276f597e13f1a486dca 100644 (file)
@@ -245,7 +245,7 @@ void MDSDaemon::set_up_admin_socket()
                                      "show cache status");
   ceph_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");
   ceph_assert(r == 0);
@@ -663,7 +663,7 @@ const std::vector<MDSDaemon::MDSCommand>& MDSDaemon::get_commands()
     MDSCommand("heap "
         "name=heapcmd,type=CephChoices,strings=dump|start_profiler|stop_profiler|release|stats",
         "show heap usage info (available only if compiled with tcmalloc)"),
-    MDSCommand("cache drop name=timeout,type=CephInt,range=1", "trim cache and optionally request client to release all caps and flush the journal"),
+    MDSCommand("cache drop name=timeout,type=CephInt,range=0,req=false", "trim cache and optionally request client to release all caps and flush the journal"),
   };
   return commands;
 };
index 728b3301cec817a6373a55dfe23b57a154bae563..faa1a92464df7277935fe2b5abee8fe9a08fac36 100644 (file)
@@ -276,6 +276,10 @@ private:
     }
 
     void start_timer() {
+      if (!timeout) {
+        return;
+      }
+
       timer_task = new FunctionContext([this](int _) {
           timer_task = nullptr;
           complete(-ETIMEDOUT);
@@ -2486,7 +2490,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;
@@ -3368,7 +3372,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);