From a210f7dd3b79f0bad55ce7f5bc1e671da996a5f6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 10 Jan 2019 17:17:24 -0600 Subject: [PATCH] mon/MonClient: be less aggressive/paranoid about reopening mon connections Previously we were reopening any time the name of our mon changed. That was pretty much every time, since we started out with names from the seed monmap like 'noname-[abc]' that never match the real mons. Instead, only reopen if the addr we are connecting to is no longer in the monmap. We don't actually care about the mon's name. Fixes: http://tracker.ceph.com/issues/37868 Signed-off-by: Sage Weil --- src/mon/MonClient.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index a273d6abe10..6917ab2a1bd 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -376,15 +376,17 @@ void MonClient::handle_monmap(MMonMap *m) ldout(cct,10) << " can't identify which mon we were connected to" << dendl; _reopen_session(); } else { - if (monmap.get_rank(old_name) < 0) { - ldout(cct, 10) << "mon." << old_name << " went away" << dendl; + int new_rank = monmap.get_rank(m->get_source_addr()); + if (new_rank < 0) { + ldout(cct, 10) << "mon." << new_rank << " at " << m->get_source_addrs() + << " went away" << dendl; // can't find the mon we were talking to (above) _reopen_session(); - } else if (monmap.get_addrs(old_name) != con_addrs) { + } else if (monmap.get_addrs(new_rank) != con_addrs) { // FIXME: we might make this a more sophisticated check later if we do // multiprotocol IPV4/IPV6 and have a strict preference - ldout(cct,10) << " mon." << old_name << " has addrs " - << monmap.get_addrs(old_name) << " but i'm connected to " + ldout(cct,10) << " mon." << new_rank << " has addrs " + << monmap.get_addrs(new_rank) << " but i'm connected to " << con_addrs << dendl; _reopen_session(); } -- 2.39.5