From: John Spray Date: Mon, 21 Nov 2016 12:10:05 +0000 (+0000) Subject: src/mds: fix MDSMap upgrade decoding X-Git-Tag: v10.2.6~34^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=21622c13468d85f017d139a376097267943ea328;p=ceph.git src/mds: fix MDSMap upgrade decoding 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 (cherry picked from commit a977c9029ff80b4eb4f3b128965693694b729425) --- diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc index f038b49d098c..a4db701589fc 100644 --- a/src/mds/FSMap.cc +++ b/src/mds/FSMap.cc @@ -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 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 {