From 8010d919603f2631637f85bef600bf926ca436fc Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 29 Nov 2018 15:44:55 +0800 Subject: [PATCH] mgr: don't write to output if EOPNOTSUPP if process_pg_map_command() fails to fulfill the request, we should keep the odata intact. and let the module take care of it. before this change, we always write to odata even if process_pg_map_command() returns -EOPNOTSUPP, this leaves unnecessary leftover in the output, like pg_info,pg_ready. after this change, we won't touch odata if process_pg_map_command() returns -EOPNOTSUPP. and odata will be filled with whatever the python module returns. Fixes: http://tracker.ceph.com/issues/37444 Signed-off-by: Kefu Chai --- src/mgr/DaemonServer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mgr/DaemonServer.cc b/src/mgr/DaemonServer.cc index 4069715e8b7..eea7503caf2 100644 --- a/src/mgr/DaemonServer.cc +++ b/src/mgr/DaemonServer.cc @@ -2050,9 +2050,11 @@ bool DaemonServer::_handle_command( if (f) { f->close_section(); - f->flush(cmdctx->odata); } if (r != -EOPNOTSUPP) { + if (f) { + f->flush(cmdctx->odata); + } cmdctx->reply(r, ss); return true; } -- 2.39.5