]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: remove 'fs_name' from MDSRank
authorRamana Raja <rraja@redhat.com>
Tue, 18 May 2021 05:00:29 +0000 (01:00 -0400)
committerRamana Raja <rraja@redhat.com>
Thu, 17 Jun 2021 16:48:59 +0000 (12:48 -0400)
There isn't a need to store a file system's name in a MDSRank
object. The MDSRank has a pointer to a MDSMap object, which already
stores the name.

Also, there isn't a need to pass the file system name in the MMDSMap
message. It should be sufficient to pass the MDSMap in the MMDSMap
message as the the file system name is stored in the MDSMap. Pass a
empty string as map_fs_name in the MMDSMap message. It is  simpler than
removing map_fs_name from the message payload altogether.

Fixes: https://tracker.ceph.com/issues/50852
Signed-off-by: Ramana Raja <rraja@redhat.com>
src/mds/MDSDaemon.cc
src/mds/MDSRank.cc
src/mds/MDSRank.h
src/mds/Server.cc
src/messages/MMDSMap.h
src/mon/MDSMonitor.cc

index 729902a878e8094857b818b670189a2af6d4d4d6..8b82385a2d212430fd6148752a7b1e0ae359e32e 100644 (file)
@@ -759,7 +759,7 @@ void MDSDaemon::handle_mds_map(const cref_t<MMDSMap> &m)
 
     // Did I previously not hold a rank?  Initialize!
     if (mds_rank == NULL) {
-      mds_rank = new MDSRankDispatcher(whoami, m->map_fs_name, mds_lock, clog,
+      mds_rank = new MDSRankDispatcher(whoami, mds_lock, clog,
           timer, beacon, mdsmap, messenger, monc, &mgrc,
           new LambdaContext([this](int r){respawn();}),
           new LambdaContext([this](int r){suicide();}),
index f085e266979c0ed25abce20050606fa9a4e3bdf4..2baa37698dc930f0baa4b72cb1fe99ecae9bebb9 100644 (file)
@@ -476,7 +476,6 @@ private:
 
 MDSRank::MDSRank(
     mds_rank_t whoami_,
-    std::string fs_name_,
     ceph::mutex &mds_lock_,
     LogChannelRef &clog_,
     SafeTimer &timer_,
@@ -494,7 +493,7 @@ MDSRank::MDSRank(
     damage_table(whoami_), sessionmap(this),
     op_tracker(g_ceph_context, g_conf()->mds_enable_op_tracker,
                g_conf()->osd_num_op_tracker_shard),
-    progress_thread(this), whoami(whoami_), fs_name(fs_name_),
+    progress_thread(this), whoami(whoami_),
     purge_queue(g_ceph_context, whoami_,
       mdsmap_->get_metadata_pool(), objecter,
       new LambdaContext([this](int r) {
@@ -1429,8 +1428,7 @@ void MDSRank::send_message_mds(const ref_t<Message>& m, mds_rank_t mds)
   // send mdsmap first?
   auto addrs = mdsmap->get_addrs(mds);
   if (mds != whoami && peer_mdsmap_epoch[mds] < mdsmap->get_epoch()) {
-    auto _m = make_message<MMDSMap>(monc->get_fsid(), *mdsmap,
-                                   std::string(mdsmap->get_fs_name()));
+    auto _m = make_message<MMDSMap>(monc->get_fsid(), *mdsmap);
     send_message_mds(_m, addrs);
     peer_mdsmap_epoch[mds] = mdsmap->get_epoch();
   }
@@ -3219,7 +3217,7 @@ void MDSRank::command_dump_inode(Formatter *f, const cmdmap_t &cmdmap, std::ostr
 
 void MDSRank::dump_status(Formatter *f) const
 {
-  f->dump_string("fs_name", fs_name);
+  f->dump_string("fs_name", std::string(mdsmap->get_fs_name()));
   if (state == MDSMap::STATE_REPLAY ||
       state == MDSMap::STATE_STANDBY_REPLAY) {
     mdlog->dump_replay_status(f);
@@ -3611,7 +3609,6 @@ bool MDSRank::evict_client(int64_t session_id,
 
 MDSRankDispatcher::MDSRankDispatcher(
     mds_rank_t whoami_,
-    std::string fs_name_,
     ceph::mutex &mds_lock_,
     LogChannelRef &clog_,
     SafeTimer &timer_,
@@ -3623,7 +3620,7 @@ MDSRankDispatcher::MDSRankDispatcher(
     Context *respawn_hook_,
     Context *suicide_hook_,
     boost::asio::io_context& ioc)
-  : MDSRank(whoami_, fs_name_, mds_lock_, clog_, timer_, beacon_, mdsmap_,
+  : MDSRank(whoami_, mds_lock_, clog_, timer_, beacon_, mdsmap_,
             msgr, monc_, mgrc, respawn_hook_, suicide_hook_, ioc)
 {
     g_conf().add_observer(this);
index 7ec785c14ffccddaed7c1e7a0a974408d0ca6e4b..a67f6f1c6b97a54fa70e075c72db7fcaf14341b2 100644 (file)
@@ -164,7 +164,6 @@ class MDSRank {
 
     MDSRank(
         mds_rank_t whoami_,
-       std::string fs_name_,
         ceph::mutex &mds_lock_,
         LogChannelRef &clog_,
         SafeTimer &timer_,
@@ -178,7 +177,6 @@ class MDSRank {
        boost::asio::io_context& ioc);
 
     mds_rank_t get_nodeid() const { return whoami; }
-    std::string_view get_fs_name() const { return fs_name; }
     int64_t get_metadata_pool() const
     {
         return metadata_pool;
@@ -443,7 +441,6 @@ class MDSRank {
     friend class C_MDS_MonCommand;
 
     const mds_rank_t whoami;
-    std::string fs_name;
 
     ~MDSRank();
 
@@ -660,7 +657,6 @@ class MDSRankDispatcher : public MDSRank, public md_config_obs_t
 public:
   MDSRankDispatcher(
       mds_rank_t whoami_,
-      std::string fs_name,
       ceph::mutex &mds_lock_,
       LogChannelRef &clog_,
       SafeTimer &timer_,
index 63ebc303a044eb377af1fce195f7dc4f3913ef33..605e1af1dd78e310e94b29cb3f5cdb53c31535f2 100644 (file)
@@ -508,7 +508,7 @@ void Server::handle_client_reclaim(const cref_t<MClientReclaim> &m)
     return;
   }
 
-  std::string_view fs_name = mds->get_fs_name();
+  std::string_view fs_name = mds->mdsmap->get_fs_name();
   if (!fs_name.empty() && !session->fs_name_capable(fs_name, MAY_READ)) {
     dout(0) << " dropping message not allowed for this fs_name: " << *m << dendl;
     return;
@@ -542,7 +542,7 @@ void Server::handle_client_session(const cref_t<MClientSession> &m)
     return;
   }
 
-  std::string_view fs_name = mds->get_fs_name();
+  std::string_view fs_name = mds->mdsmap->get_fs_name();
   if (!fs_name.empty() && !session->fs_name_capable(fs_name, MAY_READ)) {
     dout(0) << " dropping message not allowed for this fs_name: " << *m << dendl;
     auto reply = make_message<MClientSession>(CEPH_SESSION_REJECT);
index 9ea18131127a617b5ee88bc142b8d810e10df4b9..700cd2121bd5036e9208721d8906e0e41e5fddd6 100644 (file)
@@ -28,7 +28,9 @@ public:
   uuid_d fsid;
   epoch_t epoch = 0;
   ceph::buffer::list encoded;
-  std::string map_fs_name;
+  // don't really need map_fs_name. it was accidentally added in 51af2346fdf
+  // set it to empty string.
+  std::string map_fs_name = std::string();
 
   version_t get_epoch() const { return epoch; }
   const ceph::buffer::list& get_encoded() const { return encoded; }
@@ -37,10 +39,9 @@ protected:
   MMDSMap() : 
     SafeMessage{CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION} {}
 
-  MMDSMap(const uuid_d &f, const MDSMap &mm,
-          const std::string mf = std::string()) :
+  MMDSMap(const uuid_d &f, const MDSMap &mm) :
     SafeMessage{CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION},
-    fsid(f), map_fs_name(mf) {
+    fsid(f) {
     epoch = mm.get_epoch();
     mm.encode(encoded, -1);  // we will reencode with fewer features as necessary
   }
index 4af783ba93f85fc9e64aee49ca685badcccca510..82b6843264cfc75d222e80b7fb80532582a5c9a2 100644 (file)
@@ -1808,8 +1808,7 @@ void MDSMonitor::check_sub(Subscription *sub)
     if (sub->next > mds_map->epoch) {
       return;
     }
-    auto msg = make_message<MMDSMap>(mon.monmap->fsid, *mds_map,
-                                    mds_map->fs_name);
+    auto msg = make_message<MMDSMap>(mon.monmap->fsid, *mds_map);
 
     sub->session->con->send_message(msg.detach());
     if (sub->onetime) {