]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMap: adjust scrub checks to avoid overflow for future stamps 15643/head
authorSage Weil <sage@redhat.com>
Wed, 12 Jul 2017 13:17:55 +0000 (09:17 -0400)
committerSage Weil <sage@redhat.com>
Wed, 12 Jul 2017 16:52:03 +0000 (12:52 -0400)
Avoid an overflow (and false warning) when scrub stamps are in the future.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/PGMap.cc

index ac42d3a747647184d1c37193224af0dc7142094e..913e035f7ef21e6d9f6a25549e209d4406370846 100644 (file)
@@ -3181,20 +3181,22 @@ void PGMap::get_health_checks(
   // PG_NOT_DEEP_SCRUBBED
   {
     list<string> detail, deep_detail;
-    const int age = cct->_conf->mon_warn_not_scrubbed +
+    const double age = cct->_conf->mon_warn_not_scrubbed +
       cct->_conf->mon_scrub_interval;
-    const int deep_age = cct->_conf->mon_warn_not_deep_scrubbed +
+    utime_t cutoff = now;
+    cutoff -= age;
+    const double deep_age = cct->_conf->mon_warn_not_deep_scrubbed +
       cct->_conf->osd_deep_scrub_interval;
+    utime_t deep_cutoff = now;
+    deep_cutoff -= deep_age;
     for (auto& p : pg_stat) {
-      const utime_t time_since_ls = now - p.second.last_scrub_stamp;
-      if (time_since_ls > age) {
+      if (p.second.last_scrub_stamp < cutoff) {
        ostringstream ss;
        ss << "pg " << p.first << " not scrubbed since "
           << p.second.last_scrub_stamp;
         detail.push_back(ss.str());
       }
-      const utime_t time_since_lds = now - p.second.last_deep_scrub_stamp;
-      if (time_since_lds > deep_age) {
+      if (p.second.last_deep_scrub_stamp < deep_cutoff) {
        ostringstream ss;
        ss << "pg " << p.first << " not deep-scrubbed since "
           << p.second.last_deep_scrub_stamp;