From: Pere Diaz Bou Date: Mon, 27 Nov 2023 14:26:25 +0000 (+0100) Subject: os/bluestore: create dummy blob on dummy onodes X-Git-Tag: v19.3.0~3^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=07f08183a963aa7c001f9a7b9fdeb2e8f00837e0;p=ceph.git os/bluestore: create dummy blob on dummy onodes dummy onodes don't have a collection, consequentially, we need to create a blob without a collection. Signed-off-by: Pere Diaz Bou --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 9e3c72f6e3d8..3e08056bf935 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -4023,7 +4023,8 @@ void BlueStore::ExtentMap::ExtentDecoder::decode_extent( if (blobid) { consume_blobid(le, false, blobid - 1); } else { - BlobRef b = c->new_blob(); + // dummy onodes might not have collections, we need a check for it. + BlobRef b = c ? c->new_blob() : new Blob(nullptr); uint64_t sbid = 0; b->decode(p, struct_v, &sbid, false, c); consume_blob(le, extent_pos, sbid, b); @@ -4071,7 +4072,7 @@ void BlueStore::ExtentMap::ExtentDecoder::decode_spanning_blobs( unsigned n; denc_varint(n, p); while (n--) { - BlueStore::BlobRef b = c->new_blob(); + BlobRef b = c ? c->new_blob() : new Blob(nullptr); denc_varint(b->id, p); uint64_t sbid = 0; b->decode(p, struct_v, &sbid, true, c); @@ -11051,7 +11052,7 @@ void BlueStore::inject_zombie_spanning_blob(coll_t cid, ghobject_t oid, o->extent_map.fault_range(db, 0, OBJECT_MAX_SIZE); } - BlobRef b = c->new_blob(); + BlobRef b = c ? c->new_blob() : new Blob(nullptr); b->id = blob_id; o->extent_map.spanning_blob_map[blob_id] = b; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 7baaf503e39a..9985ea5752ae 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -728,7 +728,7 @@ public: return shared_blob && shared_blob->is_loaded(); } inline BufferCacheShard* get_cache() { - return collection->cache; + return collection ? collection->cache : nullptr; } uint64_t get_sbid() const { return shared_blob ? shared_blob->get_sbid() : 0;