From dd8d7978bac8b6c85bf56fb3ca78a0d018503d4e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 19 Nov 2019 09:48:57 +0800 Subject: [PATCH] mon: s/reply_command/reply_tell_command/ * s/reply_command/reply_tell_command/, otherwise `Monitor::reply_command()` panics, because it expects a `MMonCommand`. * do not handle a tell command twice Signed-off-by: Kefu Chai --- src/mon/Monitor.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index f582624f312..b96f1071220 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3173,8 +3173,7 @@ void Monitor::handle_tell_command(MonOpRequestRef op) MCommand *m = static_cast(op->get_req()); if (m->fsid != monmap->fsid) { dout(0) << "handle_command on fsid " << m->fsid << " != " << monmap->fsid << dendl; - reply_command(op, -EACCES, "wrong fsid", 0); - return; + return reply_tell_command(op, -EACCES, "wrong fsid"); } MonSession *session = op->get_session(); if (!session) { @@ -3186,13 +3185,13 @@ void Monitor::handle_tell_command(MonOpRequestRef op) cmdmap_t cmdmap; stringstream ss; if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) { - reply_command(op, -EINVAL, ss.str(), 0); + return reply_tell_command(op, -EINVAL, ss.str()); } map param_str_map; _generate_command_map(cmdmap, param_str_map); string prefix; if (!cmd_getval(g_ceph_context, cmdmap, "prefix", prefix)) { - reply_command(op, -EINVAL, "no prefix", 0); + return reply_tell_command(op, -EINVAL, "no prefix"); } if (!session->caps.is_capable( g_ceph_context, @@ -3200,7 +3199,7 @@ void Monitor::handle_tell_command(MonOpRequestRef op) "mon", prefix, param_str_map, true, true, true, session->get_peer_socket_addr())) { - reply_tell_command(op, -EACCES, "insufficient caps"); + return reply_tell_command(op, -EACCES, "insufficient caps"); } } // pass it to asok -- 2.39.5