From 7863d7c6c49347db97a6bca36f63fc35741ac0e5 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 23 Apr 2019 13:03:42 -0500 Subject: [PATCH] osd: take heartbeat_lock when calling heartbeat() Fixes: http://tracker.ceph.com/issues/39439 Signed-off-by: Sage Weil --- src/osd/OSD.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 750b94abbb2..93aecf69111 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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) { -- 2.47.3