]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Return error message instead of asserting 14469/head
authorBrad Hubbard <bhubbard@redhat.com>
Wed, 12 Apr 2017 06:21:51 +0000 (16:21 +1000)
committerBrad Hubbard <bhubbard@redhat.com>
Thu, 13 Apr 2017 00:05:19 +0000 (10:05 +1000)
For "session evict" admin socket command return an error message when we
receive an invalid/missing client_id parameter rather than asserting.

Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
src/mds/MDSRank.cc

index eb538f9c849e214bb3a92a1fdba2cdeb78457bfc..83cd92796d6357616e7efbe1aa0df5e2258bf69b 100644 (file)
@@ -1760,13 +1760,18 @@ bool MDSRankDispatcher::handle_asok_command(
   } else if (command == "session evict") {
     std::string client_id;
     const bool got_arg = cmd_getval(g_ceph_context, cmdmap, "client_id", client_id);
-    assert(got_arg == true);
+    if(!got_arg) {
+      ss << "Invalid client_id specified";
+      return true;
+    }
 
     mds_lock.Lock();
-    std::stringstream ss;
-    bool killed = kill_session(strtol(client_id.c_str(), 0, 10), true, ss);
-    if (!killed)
-      dout(15) << ss.str() << dendl;
+    stringstream dss;
+    bool killed = kill_session(strtol(client_id.c_str(), 0, 10), true, dss);
+    if (!killed) {
+      dout(15) << dss.str() << dendl;
+      ss << dss.str();
+    }
     mds_lock.Unlock();
   } else if (command == "scrub_path") {
     string path;