]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: do not segv on kraken upgrade debug print
authorSage Weil <sage@redhat.com>
Fri, 11 Aug 2017 15:58:42 +0000 (11:58 -0400)
committerSage Weil <sage@redhat.com>
Sat, 12 Aug 2017 02:37:18 +0000 (22:37 -0400)
When loading an onode from kraken we have a compat path that calls
get_ref before the SharedBlob pointer is initialized.  This is fine except
that if debugging is enabled the operator<< on the Blob will segv on
printing *b.shared_blob (which is NULL).

Fix operator<< to print something else if it is NULL.  shared_blob does
get set up right after the call to decode() so having it be NULL at this
point is otherwise harmless.

Fixes: http://tracker.ceph.com/issues/20977
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 50523a225b2f415b8c3d82faeae59c0eede54663)

src/os/bluestore/BlueStore.cc

index 0dd11937d492142a5471965ad064c59d52eadeae..4d5b989ffe2e8ec28ea0b8255ebcdd7385a589d0 100644 (file)
@@ -1703,9 +1703,13 @@ ostream& operator<<(ostream& out, const BlueStore::Blob& b)
   if (b.is_spanning()) {
     out << " spanning " << b.id;
   }
-  out << " " << b.get_blob() << " " << b.get_blob_use_tracker()
-      << " " << *b.shared_blob
-      << ")";
+  out << " " << b.get_blob() << " " << b.get_blob_use_tracker();
+  if (b.shared_blob) {
+    out << " " << *b.shared_blob;
+  } else {
+    out << " (shared_blob=NULL)";
+  }
+  out << ")";
   return out;
 }