]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: update creating_pgs using pending_creatings 14897/head
authorKefu Chai <kchai@redhat.com>
Mon, 1 May 2017 15:48:51 +0000 (23:48 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 1 May 2017 15:48:59 +0000 (23:48 +0800)
* without this change, in OSDMonitor::update_pending_pgs(), creating_pgs
  is updated directly without lock, and the change will be overwritten
  with pending changes eventually. so we should update it using
  pending_creatings
* also, should acquire the lock in OSDMonitor::send_pg_creates() when
  reading creating_pgs_by_osd_epoch and createing_pgs.

Fixes: http://tracker.ceph.com/issues/19814
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mon/OSDMonitor.cc

index a258d502c9fbb882246f771f0ba9d1f042da6444..3a95d32a54cf2d505067bfc2cffe8c1ff6ebb696 100644 (file)
@@ -935,7 +935,7 @@ OSDMonitor::update_pending_pgs(const OSDMap::Incremental& inc)
       assert(st != pgm.pg_stat.end());
       auto created = make_pair(st->second.created, st->second.last_scrub_stamp);
       // no need to add the pg, if it already exists in creating_pgs
-      creating_pgs.pgs.emplace(pgid, created);
+      pending_creatings.pgs.emplace(pgid, created);
     }
   }
   for (auto old_pool : inc.old_pools) {
@@ -3233,6 +3233,7 @@ epoch_t OSDMonitor::send_pg_creates(int osd, Connection *con, epoch_t next)
 {
   dout(30) << __func__ << " osd." << osd << " next=" << next
           << " " << creating_pgs_by_osd_epoch << dendl;
+  std::lock_guard<std::mutex> l(creating_pgs_lock);
   auto creating_pgs_by_epoch = creating_pgs_by_osd_epoch.find(osd);
   if (creating_pgs_by_epoch == creating_pgs_by_osd_epoch.end())
     return next;