]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD: drop osd_lock only if pg osdmaps are truly laggy 24287/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 26 Sep 2018 09:03:50 +0000 (17:03 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 26 Sep 2018 09:24:10 +0000 (17:24 +0800)
We only need to drop the lock if we are going to block.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/OSD.cc

index 4b19739f0406531d6551660de3352ff234a27895..4bc4977df930b7776432a6a5f872f04f1469f83d 100644 (file)
@@ -7445,7 +7445,6 @@ void OSD::handle_osd_map(MOSDMap *m)
       epoch_t need = osdmap->get_epoch() - max_lag;
       dout(10) << __func__ << " waiting for pgs to catch up (need " << need
               << " max_lag " << max_lag << ")" << dendl;
-      osd_lock.Unlock();
       for (auto shard : shards) {
        epoch_t min = shard->get_min_pg_epoch();
        if (need > min) {
@@ -7454,10 +7453,11 @@ void OSD::handle_osd_map(MOSDMap *m)
                   << ", map cache is " << cct->_conf->osd_map_cache_size
                   << ", max_lag_factor " << m_osd_pg_epoch_max_lag_factor
                   << ")" << dendl;
+          osd_lock.Unlock();
          shard->wait_min_pg_epoch(need);
+          osd_lock.Lock();
        }
       }
-      osd_lock.Lock();
     }
   }