From: Sage Weil Date: Mon, 13 Mar 2017 11:32:12 +0000 (-0400) Subject: os/bluestore: only discard deallocated regions of a blob if !shared X-Git-Tag: v12.0.1~12^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=44d498332c4da6d6340c05ad9cce2d37cbcc5951;p=ceph.git 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index e98badf45c6c..c47894fb65f8 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;