]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: put a guard for updating heartbeat peers 7677/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 22 Feb 2016 07:23:14 +0000 (15:23 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 22 Feb 2016 07:23:14 +0000 (15:23 +0800)
As get_next_up_osd_after() and get_previous_up_osd_before() may refer to the same
osd, so we need to put a guard in case we try to add the same osd into want.
Note that the STL set can handle the above case, so this commit should be only
considered as cleanup, not a big deal.

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

index a1c362a1072a2d73844e427630a7561019880348..9b05b2a7db2e4eba3116a383339bba4dd743dcc2 100644 (file)
@@ -3698,7 +3698,7 @@ void OSD::maybe_update_heartbeat_peers()
   if (next >= 0)
     want.insert(next);
   int prev = osdmap->get_previous_up_osd_before(whoami);
-  if (prev >= 0)
+  if (prev >= 0 && prev != next)
     want.insert(prev);
 
   for (set<int>::iterator p = want.begin(); p != want.end(); ++p) {