From: Jos Collin Date: Wed, 22 Nov 2017 11:42:43 +0000 (+0530) Subject: mds: Fix error message when mds not active X-Git-Tag: v12.2.3~229^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=42bb91a258512c34ea402f34f130518069db3835;p=ceph.git mds: Fix error message when mds not active Fix error message for mds not active state. Also fixed the 'unrecognized command' logic by avoiding the new stringstream local object. Signed-off-by: Jos Collin (cherry picked from commit 10f93cf5828afbc8ff25ef81b2437ef5c0362396) --- diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 4c30b6747136..6fe1e2488de0 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -823,18 +823,19 @@ int MDSDaemon::_handle_command( cpu_profiler_handle_command(argvec, ds); } else { // Give MDSRank a shot at the command - if (mds_rank) { + if (!mds_rank) { + ss << "MDS not active"; + r = -EINVAL; + } + else { bool handled = mds_rank->handle_command(cmdmap, m, &r, &ds, &ss, need_reply); - if (handled) { - goto out; + if (!handled) { + // MDSDaemon doesn't know this command + ss << "unrecognized command! " << prefix; + r = -EINVAL; } } - - // Neither MDSDaemon nor MDSRank know this command - std::ostringstream ss; - ss << "unrecognized command! " << prefix; - r = -EINVAL; } out: