]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: handle min_compat_client type change 27855/head
authorKefu Chai <kchai@redhat.com>
Mon, 29 Apr 2019 10:20:46 +0000 (18:20 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 4 May 2019 06:51:27 +0000 (02:51 -0400)
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 <kchai@redhat.com>
src/mds/MDSMap.cc
src/mds/MDSRank.cc

index 17c19aa01be655913ef6fe321ea9c3e68bfc8d02..4de759fa11f4458bc8878bc48826000339994183 100644 (file)
@@ -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<uint8_t>(r)};
+    }
+  } else if (ev > 14) {
     decode(min_compat_client, p);
   }
 
index a17bbe7008f0d3e22293eb28aa25e08a83223775..f683a7bdd1179ea4538040616f2cdc2dfb27e8f0 100644 (file)
@@ -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