]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/MMgrReport: default-initialize PerfCounterType members 69604/head
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Fri, 19 Jun 2026 17:13:41 +0000 (01:13 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Sun, 21 Jun 2026 01:21:13 +0000 (09:21 +0800)
readable.sh can fail decoding pre-v3 corpus objects that predate the
unit field, e.g.:

  **** reencode of .../objects/PerfCounterType/... resulted in a different dump ****
  7c7
  <     "unit": 36
  ---
  >     "unit": 101

For struct_v < 3 unit is never decoded and had no in-class default, so
it read indeterminate memory and differed between the two ceph-dencoder
processes readable.sh compares. Default it to UNIT_NONE.

Also default-initialize type to PERFCOUNTER_NONE for consistency.

Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
src/messages/MMgrReport.h

index 71e233048ab1e52fa23cb26d1f7da4e9a29a3c4f..06d413834a9cfca8aba1c89bb761390de832f9f9 100644 (file)
@@ -32,13 +32,13 @@ public:
   std::string path;
   std::string description;
   std::string nick;
-  enum perfcounter_type_d type;
+  enum perfcounter_type_d type = PERFCOUNTER_NONE;
 
   // For older clients that did not send priority, pretend everything
   // is "useful" so that mgr plugins filtering on prio will get some
   // data (albeit probably more than they wanted)
   uint8_t priority = PerfCountersBuilder::PRIO_USEFUL;
-  enum unit_t unit;
+  enum unit_t unit = UNIT_NONE;
 
   void encode(ceph::buffer::list &bl) const
   {