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>
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) {