From: Venky Shankar Date: Wed, 16 Jun 2021 04:53:16 +0000 (-0400) Subject: client: check if a mds rank is `up` before fetching connection addr X-Git-Tag: v17.1.0~1587^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F41875%2Fhead;p=ceph.git client: check if a mds rank is `up` before fetching connection addr Client segfaults when trying to infer which mds rank a connection reset call is coming from. It does this by iterating `mds_sessions` and checking the mds addr (in mdsmap) to the `Connection *`. However, cases where the mds is blocklisted, the client receives an updated mdsmap in which the corresponding mds is not in `up` set thereby resulting in a segfault when calling `mdsmap->get_addrs` since it expects that the mds should be in `up` state. Note that this leaves the `Connection *` as it is and does not clean it up. That needs to fixed separately probably by maintaining a map of `Connection *` to mds rank for lookup. Fixes: http://tracker.ceph.com/issues/50530 Signed-off-by: Venky Shankar --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 4494fc2a74f9..3533f3d6f4b7 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -14970,7 +14970,7 @@ void Client::ms_handle_remote_reset(Connection *con) mds_rank_t mds = MDS_RANK_NONE; MetaSession *s = NULL; for (auto &p : mds_sessions) { - if (mdsmap->get_addrs(p.first) == con->get_peer_addrs()) { + if (mdsmap->have_inst(p.first) && mdsmap->get_addrs(p.first) == con->get_peer_addrs()) { mds = p.first; s = &p.second; }