]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: only discard deallocated regions of a blob if !shared
authorSage Weil <sage@redhat.com>
Mon, 13 Mar 2017 11:32:12 +0000 (07:32 -0400)
committerSage Weil <sage@redhat.com>
Tue, 21 Mar 2017 18:56:29 +0000 (13:56 -0500)
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 <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index e98badf45c6cbf2c6f8f79774545a358af2919f9..c47894fb65f863078a1f712d724aaa464a546722 100644 (file)
@@ -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;