From: Kefu Chai Date: Mon, 29 Apr 2019 10:20:46 +0000 (+0800) Subject: mds: handle min_compat_client type change X-Git-Tag: v15.1.0~2713^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e9e6c64c803c94f9f77e001321029fa63b6cf6ed;p=ceph.git mds: handle min_compat_client type change in previous change, MDSMap::min_compat_client was changed from int8_t to ceph_release_t, i.e. uint8_t, and in Server::update_required_client_features(), we check the MDSMap::min_compat_client to see if it is greater than given version, so a negative "-1" would overflow and be interpreted as a 255, hence will be always greater than whatever version is compared. so we need to bump up the encoding version, and * normalize the number if it is -1 * ignore the number which is way too large. Signed-off-by: Kefu Chai --- diff --git a/src/mds/MDSMap.cc b/src/mds/MDSMap.cc index 17c19aa01be6..4de759fa11f4 100644 --- a/src/mds/MDSMap.cc +++ b/src/mds/MDSMap.cc @@ -690,7 +690,7 @@ void MDSMap::encode(bufferlist& bl, uint64_t features) const encode(cas_pool, bl); // kclient ignores everything from here - __u16 ev = 14; + __u16 ev = 15; encode(ev, bl); encode(compat, bl); encode(metadata_pool, bl); @@ -840,7 +840,15 @@ void MDSMap::decode(bufferlist::const_iterator& p) decode(old_max_mds, p); } - if (ev >= 14) { + if (ev == 14) { + int8_t r; + decode(r, p); + if (r < 0) { + min_compat_client = ceph_release_t::unknown; + } else { + min_compat_client = ceph_release_t{static_cast(r)}; + } + } else if (ev > 14) { decode(min_compat_client, p); } diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index a17bbe7008f0..f683a7bdd117 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -2168,7 +2168,8 @@ void MDSRankDispatcher::handle_mds_map( if (objecter->get_client_incarnation() != incarnation) objecter->set_client_incarnation(incarnation); - if (oldmap.get_min_compat_client() != mdsmap->get_min_compat_client()) + if (mdsmap->get_min_compat_client() < ceph_release_t::max && + oldmap.get_min_compat_client() != mdsmap->get_min_compat_client()) server->update_required_client_features(); // for debug