]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Re-record unclean removed-collection.
authorJianpeng Ma <jianpeng.ma@intel.com>
Thu, 16 Nov 2017 13:50:56 +0000 (21:50 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Fri, 17 Nov 2017 10:14:59 +0000 (18:14 +0800)
In _reap_collection, if removed-collection still has object which in
flushing. Collection don't clean cache and  it can't
record anymore which cause can't handle in the next time.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/os/bluestore/BlueStore.cc

index 66c5b29582a5045c9ca3303b8941cb871aadca1b..1a888d3b7c001686fea4ba4e8eaf13323051e2b8 100644 (file)
@@ -6301,17 +6301,18 @@ void BlueStore::_queue_reap_collection(CollectionRef& c)
 
 void BlueStore::_reap_collections()
 {
+
   list<CollectionRef> removed_colls;
   {
     std::lock_guard<std::mutex> l(reap_lock);
-    removed_colls.swap(removed_collections);
+    if (!removed_collections.empty())
+      removed_colls.swap(removed_collections);
+    else
+      return;
   }
 
-  bool all_reaped = true;
-
-  for (list<CollectionRef>::iterator p = removed_colls.begin();
-       p != removed_colls.end();
-       ++p) {
+  list<CollectionRef>::iterator p = removed_colls.begin();
+  while (p != removed_colls.end()) {
     CollectionRef c = *p;
     dout(10) << __func__ << " " << c << " " << c->cid << dendl;
     if (c->onode_map.map_any([&](OnodeRef o) {
@@ -6323,15 +6324,18 @@ void BlueStore::_reap_collections()
          }
          return true;
        })) {
-      all_reaped = false;
+      ++p;
       continue;
     }
     c->onode_map.clear();
+    p = removed_colls.erase(p);
     dout(10) << __func__ << " " << c << " " << c->cid << " done" << dendl;
   }
-
-  if (all_reaped) {
+  if (removed_colls.empty()) {
     dout(10) << __func__ << " all reaped" << dendl;
+  } else {
+    std::lock_guard<std::mutex> l(reap_lock);
+    removed_collections.splice(removed_collections.begin(), removed_colls);
   }
 }