mirror of
https://github.com/ceph/ceph
synced 2025-02-23 11:07:35 +00:00
mon/Session: only index osd ids >= 0
This ensures that get_random_osd_session behaves when it does int n = by_osd.rbegin()->first + 1; int r = rand() % n; Fixes: https://tracker.ceph.com/issues/43552 Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
057391854c
commit
d6f0642b82
@ -139,7 +139,8 @@ struct MonSessionMap {
|
||||
}
|
||||
s->sub_map.clear();
|
||||
s->item.remove_myself();
|
||||
if (s->name.is_osd()) {
|
||||
if (s->name.is_osd() &&
|
||||
s->name.num() >= 0) {
|
||||
for (auto p = by_osd.find(s->name.num());
|
||||
p->first == s->name.num();
|
||||
++p)
|
||||
@ -168,7 +169,8 @@ struct MonSessionMap {
|
||||
void add_session(MonSession *s) {
|
||||
sessions.push_back(&s->item);
|
||||
s->get();
|
||||
if (s->name.is_osd()) {
|
||||
if (s->name.is_osd() &&
|
||||
s->name.num() >= 0) {
|
||||
by_osd.insert(std::pair<int,MonSession*>(s->name.num(), s));
|
||||
}
|
||||
if (s->con_features) {
|
||||
|
Loading…
Reference in New Issue
Block a user