]> 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)
committerIgor Fedotov <ifedotov@suse.com>
Tue, 20 Mar 2018 12:50:17 +0000 (15:50 +0300)
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>
(cherry picked from commit 196c71f4657ba19924e371e54b9d88c35448a2c5)

src/os/bluestore/BlueStore.cc

index 66f21c598dfdbfd5170e6f31dfb466f8f18301a6..6c4295e059ee3cbbf0896f2e8e2227942a2fdf0b 100644 (file)
@@ -6263,17 +6263,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) {
@@ -6285,15 +6286,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);
   }
 }