From 4d26000bc22eaae28904150148ad082d4696fb9f Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 22 Feb 2016 15:23:14 +0800 Subject: [PATCH] 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 --- src/osd/OSD.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a1c362a1072..9b05b2a7db2 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) { -- 2.47.3