From: Sage Weil Date: Fri, 11 Aug 2017 15:58:42 +0000 (-0400) Subject: os/bluestore: do not segv on kraken upgrade debug print X-Git-Tag: v13.0.0~119^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=50523a225b2f415b8c3d82faeae59c0eede54663;p=ceph.git os/bluestore: do not segv on kraken upgrade debug print 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 40e152bcce97..c095ef186f7a 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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; }