]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
include/encoding.h: Fix message on compat failure
authorAdam Kupczyk <akupczyk@ibm.com>
Tue, 21 May 2024 09:07:49 +0000 (09:07 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Wed, 17 Jul 2024 14:28:39 +0000 (14:28 +0000)
Change misleading message printed when compat is not met.
Was:
FUNC no longer understand old encoding version 5 < 7
Is:
Decoder at FUNC v=5 cant decode v=11 minimal_decoder=7

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
(cherry picked from commit ebd8283e2f2923ca5787483919bb1ab9a3faddea)

src/include/encoding.h

index 575580f41a8ff7698af6787d5020b7d81dd3dacb..d970d28b9944156cbe3fbb54d8596e36250f49e7 100644 (file)
@@ -1466,7 +1466,11 @@ decode(std::array<T, N>& v, bufferlist::const_iterator& p)
 #define ENCODE_FINISH(bl) ENCODE_FINISH_NEW_COMPAT(bl, 0)
 
 #define DECODE_ERR_OLDVERSION(func, v, compatv)                                        \
-  (std::string(func) + " no longer understand old encoding version " #v " < " + std::to_string(compatv))
+  (std::string(func) + " no longer understands old encoding version " #v " < " + std::to_string(compatv))
+
+#define DECODE_ERR_NO_COMPAT(func, code_v, v, compatv)                                 \
+  ("Decoder at '" + std::string(func) + "' v=" + std::to_string(code_v) +              \
+  " cannot decode v=" + std::to_string(v) + " minimal_decoder=" + std::to_string(compatv))
 
 #define DECODE_ERR_PAST(func) \
   (std::string(func) + " decode past end of struct encoding")
@@ -1494,7 +1498,7 @@ decode(std::array<T, N>& v, bufferlist::const_iterator& p)
   decode(struct_v, bl);                                                \
   decode(struct_compat, bl);                                           \
   if (v < struct_compat)                                               \
-    throw ::ceph::buffer::malformed_input(DECODE_ERR_OLDVERSION(__PRETTY_FUNCTION__, v, struct_compat)); \
+    throw ::ceph::buffer::malformed_input(DECODE_ERR_NO_COMPAT(__PRETTY_FUNCTION__, v, struct_v, struct_compat)); \
   __u32 struct_len;                                                    \
   decode(struct_len, bl);                                              \
   if (struct_len > bl.get_remaining())                                 \
@@ -1512,7 +1516,7 @@ decode(std::array<T, N>& v, bufferlist::const_iterator& p)
     __u8 struct_compat;                                                        \
     decode(struct_compat, bl);                                 \
     if (v < struct_compat)                                             \
-      throw ::ceph::buffer::malformed_input(DECODE_ERR_OLDVERSION(__PRETTY_FUNCTION__, v, struct_compat)); \
+      throw ::ceph::buffer::malformed_input(DECODE_ERR_NO_COMPAT(__PRETTY_FUNCTION__, v, struct_v, struct_compat)); \
   } else if (skip_v) {                                                 \
     if (bl.get_remaining() < skip_v)                                   \
       throw ::ceph::buffer::malformed_input(DECODE_ERR_PAST(__PRETTY_FUNCTION__)); \
@@ -1554,8 +1558,8 @@ decode(std::array<T, N>& v, bufferlist::const_iterator& p)
     __u8 struct_compat;                                                        \
     decode(struct_compat, bl);                                         \
     if (v < struct_compat)                                             \
-      throw ::ceph::buffer::malformed_input(DECODE_ERR_OLDVERSION(     \
-       __PRETTY_FUNCTION__, v, struct_compat));                        \
+      throw ::ceph::buffer::malformed_input(DECODE_ERR_NO_COMPAT(      \
+       __PRETTY_FUNCTION__, v, struct_v, struct_compat));              \
   }                                                                    \
   unsigned struct_end = 0;                                             \
   if (struct_v >= lenv) {                                              \