]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: When deep-scrub errors present upgrade regular scrubs
authorDavid Zafman <dzafman@redhat.com>
Fri, 2 Dec 2016 00:39:42 +0000 (16:39 -0800)
committerDavid Zafman <dzafman@redhat.com>
Thu, 8 Dec 2016 22:25:23 +0000 (14:25 -0800)
Previously, if a weekly deep-scrub found errors the next daily scrub
would cause the deep-scrub information to be removed.

Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/PG.cc

index 6daf383cbc25adcd9d889f65de825434845ffd96..29f4d1613d6887e6b1ac6fc3b8a078ed760f7600 100644 (file)
@@ -3378,6 +3378,7 @@ void PG::requeue_ops(list<OpRequestRef> &ls)
 // returns true if a scrub has been newly kicked off
 bool PG::sched_scrub()
 {
+  bool nodeep_scrub = false;
   assert(_lock.is_locked());
   if (!(is_primary() && is_active() && is_clean() && !is_scrubbing())) {
     return false;
@@ -3401,8 +3402,10 @@ bool PG::sched_scrub()
 
   //NODEEP_SCRUB so ignore time initiated deep-scrub
   if (osd->osd->get_osdmap()->test_flag(CEPH_OSDMAP_NODEEP_SCRUB) ||
-      pool.info.has_flag(pg_pool_t::FLAG_NODEEP_SCRUB))
+      pool.info.has_flag(pg_pool_t::FLAG_NODEEP_SCRUB)) {
     time_for_deep = false;
+    nodeep_scrub = true;
+  }
 
   if (!scrubber.must_scrub) {
     assert(!scrubber.must_deep_scrub);
@@ -3460,6 +3463,24 @@ bool PG::sched_scrub()
       if (time_for_deep) {
        dout(10) << "sched_scrub: scrub will be deep" << dendl;
        state_set(PG_STATE_DEEP_SCRUB);
+      } else if (!scrubber.must_deep_scrub && info.stats.stats.sum.num_deep_scrub_errors) {
+       if (!nodeep_scrub) {
+         osd->clog->info() << "osd." << osd->whoami
+                           << " pg " << info.pgid
+                           << " Deep scrub errors, upgrading scrub to deep-scrub";
+         state_set(PG_STATE_DEEP_SCRUB);
+       } else if (!scrubber.must_scrub) {
+         osd->clog->error() << "osd." << osd->whoami
+                            << " pg " << info.pgid
+                            << " Regular scrub skipped due to deep-scrub errors and nodeep-scrub set";
+         clear_scrub_reserved();
+         scrub_unreserve_replicas();
+         return false;
+       } else {
+         osd->clog->error() << "osd." << osd->whoami
+                            << " pg " << info.pgid
+                            << " Regular scrub request, losing deep-scrub details";
+       }
       }
       queue_scrub();
     } else {
@@ -4567,7 +4588,7 @@ void PG::scrub_finish()
       oss << "ok";
     if (!deep_scrub && info.stats.stats.sum.num_deep_scrub_errors)
       oss << " ( " << info.stats.stats.sum.num_deep_scrub_errors
-          << " remaining deep scrub error(s) )";
+          << " remaining deep scrub error details lost)";
     if (repair)
       oss << ", " << scrubber.fixed << " fixed";
     oss << "\n";