]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: take heartbeat_lock when calling heartbeat() 27729/head
authorSage Weil <sage@redhat.com>
Tue, 23 Apr 2019 18:03:42 +0000 (13:03 -0500)
committerSage Weil <sage@redhat.com>
Tue, 23 Apr 2019 18:04:13 +0000 (13:04 -0500)
Fixes: http://tracker.ceph.com/issues/39439
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc

index 750b94abbb2cb33fd43f3eca55f02d5e79b5c9b4..93aecf6911156cf5611730a57353369159f53f8f 100644 (file)
@@ -5212,6 +5212,7 @@ void OSD::heartbeat_check()
 
 void OSD::heartbeat()
 {
+  ceph_assert(heartbeat_lock.is_locked_by_me());
   dout(30) << "heartbeat" << dendl;
 
   // get CPU load avg
@@ -5861,7 +5862,10 @@ void OSD::_preboot(epoch_t oldest, epoch_t newest)
           << oldest << ".." << newest << dendl;
 
   // ensure our local fullness awareness is accurate
-  heartbeat();
+  {
+    std::lock_guard l(heartbeat_lock);
+    heartbeat();
+  }
 
   // if our map within recent history, try to add ourselves to the osdmap.
   if (osdmap->get_epoch() == 0) {