From: Jimyeong Lee Date: Sun, 30 Jul 2023 09:22:23 +0000 (+0900) Subject: client: Fix 1 active, multi standy mds condition timing issue X-Git-Tag: v18.2.4~170^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0ac70e184fa56c1942b8e87fe2f0c03ed2ceade7;p=ceph.git client: Fix 1 active, multi standy mds condition timing issue When there are 1 active MDS and several standby MDSs and the result of standby-MDS comes after the active-MDS's, the closing square bracket cannot be added. To Fix this issue, add one more condition Signed-off-by: Jimyeong Lee (cherry picked from commit 7cd12779c63a4159eb5388d699e92051fbfd7067) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 21940dde6f3..6a56f8073ec 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -6414,7 +6414,6 @@ void Client::handle_command_reply(const MConstRef& m) if (op.outbl) { if (multi_id != 0 && m->r == 0) { string prefix; - string suffix = "}"; string mds_name = fmt::format("mds.{}", fsmap->get_info_gid(op.mds_gid).name); if (op.outbl->length() == 0) { // very first command result @@ -6423,19 +6422,20 @@ void Client::handle_command_reply(const MConstRef& m) else { prefix = fmt::format(",{{\"{}\":", mds_name); } - op.outbl->append(prefix); op.outbl->append(m->get_data()); - op.outbl->append(suffix); + op.outbl->append("}"); + } + if (multi_id == 0) { + *op.outbl = m->get_data(); + } + else { // when this command is the last one - if (command_table.count_multi_commands(multi_id) == 1) { + if (command_table.count_multi_commands(multi_id) <= 1) { op.outbl->append("]"); } } - else if (multi_id == 0) { - *op.outbl = m->get_data(); - } } if (op.outs) { *op.outs = m->rs;