]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Output Base64 encoding of CRC header if binary data present 27961/head
authorDavid Zafman <dzafman@redhat.com>
Sat, 4 May 2019 18:32:40 +0000 (11:32 -0700)
committerDavid Zafman <dzafman@redhat.com>
Mon, 6 May 2019 03:23:47 +0000 (20:23 -0700)
Add optional paramter so cleanbin() for bufferlist can include "Base64:"

Fixes: https://tracker.ceph.com/issues/39582
Signed-off-by: David Zafman <dzafman@redhat.com>
src/common/util.cc
src/include/util.h
src/osd/ReplicatedBackend.cc

index dc79648b7a049f2fcce854872970bb47bd94d351..3448eb2bfa37bd028ff8ef190d33c63788640018 100644 (file)
@@ -329,7 +329,7 @@ void dump_services(Formatter* f, const map<string, list<string> >& services, con
 
 // If non-printable characters found then convert bufferlist to
 // base64 encoded string indicating whether it did.
-string cleanbin(bufferlist &bl, bool &base64)
+string cleanbin(bufferlist &bl, bool &base64, bool show)
 {
   bufferlist::iterator it;
   for (it = bl.begin(); it != bl.end(); ++it) {
@@ -345,6 +345,8 @@ string cleanbin(bufferlist &bl, bool &base64)
   bufferlist b64;
   bl.encode_base64(b64);
   string encoded(b64.c_str(), b64.length());
+  if (show)
+    encoded = "Base64:" + encoded;
   base64 = true;
   return encoded;
 }
@@ -356,9 +358,7 @@ string cleanbin(string &str)
   bool base64;
   bufferlist bl;
   bl.append(str);
-  string result = cleanbin(bl, base64);
-  if (base64)
-    result = "Base64:" + result;
+  string result = cleanbin(bl, base64, true);
   return result;
 }
 
index 1268288e2770f6c3faa94a689875a8a7c868ab3a..e8b9861e9e5bd531338ad85a9c3f5665aab35dcd 100644 (file)
@@ -93,7 +93,7 @@ void dump_services(ceph::Formatter* f,
 void dump_services(ceph::Formatter* f, const std::map<std::string,
                   std::list<std::string> >& services, const char* type);
 
-std::string cleanbin(ceph::buffer::list &bl, bool &b64);
+std::string cleanbin(ceph::buffer::list &bl, bool &b64, bool show = false);
 std::string cleanbin(std::string &str);
 
 namespace ceph::util {
index 8063e0a9e132a139c1c4941ea631206582694413..6fbfc251298db50b8ece873b8cef2060b10c5df9 100644 (file)
@@ -21,6 +21,7 @@
 #include "messages/MOSDPGPushReply.h"
 #include "common/EventTrace.h"
 #include "include/random.h"
+#include "include/util.h"
 #include "OSD.h"
 
 #define dout_context cct
@@ -659,8 +660,8 @@ int ReplicatedBackend::be_deep_scrub(
       return 0;
     }
     if (r == 0 && hdrbl.length()) {
-      dout(25) << "CRC header " << string(hdrbl.c_str(), hdrbl.length())
-              << dendl;
+      bool encoded = false;
+      dout(25) << "CRC header " << cleanbin(hdrbl, encoded, true) << dendl;
       pos.omap_hash << hdrbl;
     }
   }