]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: clear SharedBlob cache in dtor 11068/head
authorSage Weil <sage@redhat.com>
Wed, 14 Sep 2016 13:55:08 +0000 (09:55 -0400)
committerSage Weil <sage@redhat.com>
Wed, 14 Sep 2016 15:33:55 +0000 (11:33 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 0f15de97242970a71e760fe4ff47d6088b5a6632..c9e513a708646ee847eaa387e44b65d55e006117 100644 (file)
@@ -1177,6 +1177,21 @@ ostream& operator<<(ostream& out, const BlueStore::SharedBlob& sb)
   return out << ")";
 }
 
+BlueStore::SharedBlob::SharedBlob(uint64_t i, const string& k, Cache *c)
+  : sbid(i),
+    key(k),
+    bc(c)
+{
+}
+
+BlueStore::SharedBlob::~SharedBlob()
+{
+  if (bc.cache) {   // the dummy instances have a nullptr
+    std::lock_guard<std::recursive_mutex> l(bc.cache->lock);
+    bc._clear();
+  }
+}
+
 void BlueStore::SharedBlob::put()
 {
   if (--nref == 0) {
index 2a836f8f72951b1eb6a4b0bab0ed7906bbe242e4..c90f4d3314d95336307a02fb460e436b2a28c4ee 100644 (file)
@@ -314,10 +314,8 @@ public:
 
     BufferSpace bc;             ///< buffer cache
 
-    SharedBlob(uint64_t i, const string& k, Cache *c) : sbid(i), key(k), bc(c) {}
-    ~SharedBlob() {
-      assert(bc.empty());
-    }
+    SharedBlob(uint64_t i, const string& k, Cache *c);
+    ~SharedBlob();
 
     friend void intrusive_ptr_add_ref(SharedBlob *b) { b->get(); }
     friend void intrusive_ptr_release(SharedBlob *b) { b->put(); }