]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: always cleanup the scrub results 7792/head
authorKefu Chai <kchai@redhat.com>
Thu, 25 Feb 2016 13:06:04 +0000 (21:06 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 25 Feb 2016 13:47:30 +0000 (21:47 +0800)
the destructor of Scrub::Store asserts that `this->results` should
always be empty when it is free'd. before this change, if we are
repairing, the results is not flushed or cleaned up, this crashes
osd daemon when a new PG internval comes. also we should not keep
the results around even we don't want to populate them to the omap
if we are repairing, it's just a waste.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/osd/PG.cc
src/osd/ScrubStore.cc

index 919e699a4a34aeb569e035975e65242e1f849fc8..ced7a2caf22e0256d3c99738c874536eaa234c78 100644 (file)
@@ -4361,11 +4361,16 @@ void PG::scrub_compare_maps()
 
   // ok, do the pg-type specific scrubbing
   _scrub(authmap, missing_digest);
-  if (!state_test(PG_STATE_REPAIR) && !scrubber.store->empty()) {
-    dout(10) << __func__ << ": updating scrub object" << dendl;
-    ObjectStore::Transaction t;
-    scrubber.store->flush(&t);
-    osd->store->queue_transaction(osr.get(), std::move(t), nullptr);
+  if (!scrubber.store->empty()) {
+    if (state_test(PG_STATE_REPAIR)) {
+      dout(10) << __func__ << ": discarding scrub results" << dendl;
+      scrubber.store->flush(nullptr);
+    } else {
+      dout(10) << __func__ << ": updating scrub object" << dendl;
+      ObjectStore::Transaction t;
+      scrubber.store->flush(&t);
+      osd->store->queue_transaction(osr.get(), std::move(t), nullptr);
+    }
   }
 }
 
index 774569e0d702b8305390bba5bb9cfb241d2fd2ae..84865c1e4b68a72ef187cab4e8aaff6abd3d5ecc 100644 (file)
@@ -140,8 +140,10 @@ bool Store::empty() const
 
 void Store::flush(ObjectStore::Transaction* t)
 {
-  OSDriver::OSTransaction txn = driver.get_transaction(t);
-  backend.set_keys(results, &txn);
+  if (t) {
+    OSDriver::OSTransaction txn = driver.get_transaction(t);
+    backend.set_keys(results, &txn);
+  }
   results.clear();
 }