From: xie xingguo Date: Mon, 22 Feb 2016 07:23:14 +0000 (+0800) Subject: OSD: put a guard for updating heartbeat peers X-Git-Tag: v10.1.0~311^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4d26000bc22eaae28904150148ad082d4696fb9f;p=ceph.git OSD: put a guard for updating heartbeat peers 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a1c362a1072a..9b05b2a7db2e 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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::iterator p = want.begin(); p != want.end(); ++p) {