1
0
mirror of https://github.com/ceph/ceph synced 2024-12-25 04:43:17 +00:00

mon: Monitor: fix bug on _pick_random_mon() that would choose an invalid rank

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
This commit is contained in:
Joao Eduardo Luis 2013-04-30 17:12:05 +01:00 committed by Sage Weil
parent 7f48fd0643
commit bb270f86a4

View File

@ -1071,6 +1071,8 @@ int Monitor::_pick_random_mon(int other)
return 0;
int max = monmap->size();
if (other >= 0)
max--;
int n = sync_rng() % max;
if (other >= 0 && n >= other)
n++;