]> git.apps.os.sepia.ceph.com Git - ceph.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, 9 Feb 2017 17:16:08 +0000 (09:16 -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>
(cherry picked from commit 532a759dca466181f37a329f86045c34f1a2506f)

src/osd/PG.cc

index c11c085022b9b1c32ea3a9ec848055f31229ec40..0504f06cda19c46ce9faf8858605f73337dabd52 100644 (file)
@@ -3328,6 +3328,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;
@@ -3351,8 +3352,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);
@@ -3410,6 +3413,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 {
@@ -4527,7 +4548,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";