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:
parent
7f48fd0643
commit
bb270f86a4
@ -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++;
|
||||
|
Loading…
Reference in New Issue
Block a user