From: Samuel Just Date: Fri, 28 Jan 2011 22:07:47 +0000 (-0800) Subject: OSD: update_osd_stat take heartbeat_lock X-Git-Tag: v0.24.3~13 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0f3198e8c6318bf10fa782aa10be02df321debee;p=ceph.git OSD: update_osd_stat take heartbeat_lock Previously update_osd_stat had a race with code modifying heartbeat_from causing the iterator increment to occasionally segfault. Signed-off-by: Samuel Just --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 925ac42c1432d..bf2da5a219340 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1115,6 +1115,7 @@ void OSD::update_osd_stat() void OSD::_refresh_my_stat(utime_t now) { + assert(heartbeat_lock.is_locked()); assert(peer_stat_lock.is_locked()); // refresh? @@ -1175,6 +1176,7 @@ void OSD::_refresh_my_stat(utime_t now) osd_peer_stat_t OSD::get_my_stat_for(utime_t now, int peer) { + Mutex::Locker hlock(heartbeat_lock); Mutex::Locker lock(peer_stat_lock); _refresh_my_stat(now); my_stat_on_peer[peer] = my_stat;