]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: check if a mds rank is `up` before fetching connection addr 42070/head
authorVenky Shankar <vshankar@redhat.com>
Wed, 16 Jun 2021 04:53:16 +0000 (00:53 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 28 Jun 2021 19:50:24 +0000 (12:50 -0700)
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 <vshankar@redhat.com>
(cherry picked from commit 951483fd36c28c65f12da7c058132d14a99ac5a9)

src/client/Client.cc

index f541c2637789786569c5db859d6e34d563eee250..5a524c73792806bbfccca6b21dfa1902fd0d1211 100644 (file)
@@ -14963,7 +14963,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;
        }