]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: only access failure_queue while under heartbeat_lock.
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 5 Aug 2010 17:22:39 +0000 (10:22 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 5 Aug 2010 18:09:36 +0000 (11:09 -0700)
src/osd/OSD.cc

index a1848c3d913525beffb1ca83e80385f458a9b8f2..ddfae632aae2a8db41622799ab291a4979a2fd56 100644 (file)
@@ -1285,9 +1285,9 @@ void OSD::reset_heartbeat_peers()
   heartbeat_from.clear();
   heartbeat_from_stamp.clear();
   heartbeat_inst.clear();
+  failure_queue.clear();
   heartbeat_lock.Unlock();
 
-  failure_queue.clear();
 }
 
 void OSD::handle_osd_ping(MOSDPing *m)
@@ -1623,12 +1623,18 @@ void OSD::send_pg_temp()
 
 void OSD::send_failures()
 {
+  bool locked = false;
+  if (!failure_queue.empty()) {
+    heartbeat_lock.Lock();
+    locked = true;
+  }
   while (!failure_queue.empty()) {
     int osd = *failure_queue.begin();
     monc->send_mon_message(new MOSDFailure(monc->get_fsid(), osdmap->get_inst(osd), osdmap->get_epoch()));
     failure_queue.erase(osd);
     failure_pending.insert(osd);
   }
+  if (locked) heartbeat_lock.Unlock();
 }
 
 void OSD::send_still_alive(int osd)