]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: should not look up an empty pg
authorKefu Chai <kchai@redhat.com>
Fri, 23 Sep 2016 06:20:37 +0000 (14:20 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 23 Sep 2016 06:50:03 +0000 (14:50 +0800)
this fixes the scrub timeouts we spotted in jenkins run and qa run.
it's a regression introduced by c2b7cdb

Fixes: http://tracker.ceph.com/issues/17380
Signed-off-by: Loic Dachary <loic@dachary.org>
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/osd/OSD.cc

index 09924c9a5ab1585eb391b29ad5bcf94cd62b79a0..bc18041bf69e1addd346b8c31d6375b1fba47b59 100644 (file)
@@ -6377,10 +6377,12 @@ void OSD::handle_scrub(MOSDScrub *m)
         p != m->scrub_pgs.end();
         ++p) {
       spg_t pcand;
-      auto pg_map_entry = pg_map.find(pcand);
-      if (osdmap->get_primary_shard(*p, &pcand) &&
-         pg_map_entry != pg_map.end())
-       handle_pg_scrub(m, pg_map_entry->second);
+      if (osdmap->get_primary_shard(*p, &pcand)) {
+       auto pg_map_entry = pg_map.find(pcand);
+       if (pg_map_entry != pg_map.end()) {
+         handle_pg_scrub(m, pg_map_entry->second);
+       }
+      }
     }
   }