From: Kefu Chai Date: Thu, 25 Feb 2016 13:06:04 +0000 (+0800) Subject: osd: always cleanup the scrub results X-Git-Tag: v10.1.0~300^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F7792%2Fhead;p=ceph.git osd: always cleanup the scrub results 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 --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 919e699a4a34..ced7a2caf22e 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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); + } } } diff --git a/src/osd/ScrubStore.cc b/src/osd/ScrubStore.cc index 774569e0d702..84865c1e4b68 100644 --- a/src/osd/ScrubStore.cc +++ b/src/osd/ScrubStore.cc @@ -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(); }