]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
src/mds: fix MDSMap upgrade decoding 13139/head
authorJohn Spray <john.spray@redhat.com>
Mon, 21 Nov 2016 12:10:05 +0000 (12:10 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 26 Jan 2017 17:26:43 +0000 (17:26 +0000)
Hammer MDSMonitors did not validate the state in beacons
and would apply anything to the mds_info_t for a standby,
such as setting it to down:dne.  We must handle this
case during upgrade.

Fixes: http://tracker.ceph.com/issues/17837
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit a977c9029ff80b4eb4f3b128965693694b729425)

src/mds/FSMap.cc

index f038b49d098cf86594812d2d3f95814f100b275e..a4db701589fc76bdf3a0cd11e6d89e304d5d3de4 100644 (file)
@@ -421,6 +421,9 @@ void FSMap::decode(bufferlist::iterator& p)
       migrate_fs->mds_map.epoch = epoch;
       filesystems[migrate_fs->fscid] = migrate_fs;
 
+      // List of GIDs that had invalid states
+      std::set<mds_gid_t> drop_gids;
+
       // Construct mds_roles, standby_daemons, and remove
       // standbys from the MDSMap in the Filesystem.
       for (auto &p : migrate_fs->mds_map.mds_info) {
@@ -430,14 +433,27 @@ void FSMap::decode(bufferlist::iterator& p)
           p.second.rank = p.second.standby_for_rank;
         }
         if (p.second.rank == MDS_RANK_NONE) {
-          insert(p.second); // into standby_daemons
+          if (p.second.state != MDSMap::STATE_STANDBY) {
+            // Old MDSMaps can have down:dne here, which
+            // is invalid in an FSMap (#17837)
+            drop_gids.insert(p.first);
+          } else {
+            insert(p.second); // into standby_daemons
+          }
         } else {
           mds_roles[p.first] = migrate_fs->fscid;
         }
       }
       for (const auto &p : standby_daemons) {
+        // Erase from this Filesystem's MDSMap, because it has
+        // been copied into FSMap::Standby_daemons above
         migrate_fs->mds_map.mds_info.erase(p.first);
       }
+      for (const auto &gid : drop_gids) {
+        // Throw away all info for this MDS because it was identified
+        // as having invalid state above.
+        migrate_fs->mds_map.mds_info.erase(gid);
+      }
 
       legacy_client_fscid = migrate_fs->fscid;
     } else {