From 44d498332c4da6d6340c05ad9cce2d37cbcc5951 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 13 Mar 2017 07:32:12 -0400 Subject: [PATCH] os/bluestore: only discard deallocated regions of a blob if !shared If a blob is shared, we can't discard deallocated regions: there may be deferred buffers in flight and we might get a read via the clone. Signed-off-by: Sage Weil --- src/os/bluestore/BlueStore.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index e98badf45c6cb..c47894fb65f86 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1642,6 +1642,9 @@ ostream& operator<<(ostream& out, const BlueStore::Blob& b) void BlueStore::Blob::discard_unallocated(Collection *coll) { + if (blob.is_shared()) { + return; + } if (blob.is_compressed()) { bool discard = false; bool all_invalid = true; @@ -1661,6 +1664,9 @@ void BlueStore::Blob::discard_unallocated(Collection *coll) size_t pos = 0; for (auto e : blob.extents) { if (!e.is_valid()) { + ldout(coll->store->cct, 20) << __func__ << " 0x" << std::hex << pos + << "~" << e.length + << std::dec << dendl; shared_blob->bc.discard(shared_blob->get_cache(), pos, e.length); } pos += e.length; -- 2.39.5