]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't delegate inos when handling replayed requests
authorYan, Zheng <zyan@redhat.com>
Thu, 23 Jan 2020 02:15:11 +0000 (10:15 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 4 Feb 2020 02:17:35 +0000 (10:17 +0800)
Otherwise mds may delegate inos that are already used by other replayed
requests.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/Server.cc
src/mds/Server.h

index 4094c11ac7ac4bac54572eaa8730c38f1b759d4e..c8e4d049d5cae24051a9cc2a5490c45fb9f7338d 100644 (file)
@@ -230,6 +230,7 @@ Server::Server(MDSRank *m) :
   replay_unsafe_with_closed_session = g_conf().get_val<bool>("mds_replay_unsafe_with_closed_session");
   cap_revoke_eviction_timeout = g_conf().get_val<double>("mds_cap_revoke_eviction_timeout");
   max_snaps_per_dir = g_conf().get_val<uint64_t>("mds_max_snaps_per_dir");
+  delegate_inos_pct = g_conf().get_val<uint64_t>("mds_client_delegate_inos_pct");
   supported_features = feature_bitset_t(CEPHFS_FEATURES_MDS_SUPPORTED);
 }
 
@@ -1151,6 +1152,9 @@ void Server::handle_conf_change(const std::set<std::string>& changed) {
     dout(20) << __func__ << " max snapshots per directory changed to "
             << max_snaps_per_dir << dendl;
   }
+  if (changed.count("mds_client_delegate_inos_pct")) {
+    delegate_inos_pct = g_conf().get_val<uint64_t>("mds_client_delegate_inos_pct");
+  }
 }
 
 /*
@@ -4375,10 +4379,9 @@ void Server::handle_client_openc(MDRequestRef& mdr)
     dout(10) << "adding created_ino and delegated_inos" << dendl;
     ocresp.created_ino = in->inode.ino;
 
-    // Try to delegate some prealloc_inos to the client, if it's down to half the max
-    auto pct = g_conf().get_val<uint64_t>("mds_client_delegate_inos_pct");
-    if (pct) {
-      unsigned frac = 100 / pct;
+    if (delegate_inos_pct && !req->is_queued_for_replay()) {
+      // Try to delegate some prealloc_inos to the client, if it's down to half the max
+      unsigned frac = 100 / delegate_inos_pct;
       if (mdr->session->delegated_inos.size() < (unsigned)g_conf()->mds_client_prealloc_inos / frac / 2)
        mdr->session->delegate_inos(g_conf()->mds_client_prealloc_inos / frac, ocresp.delegated_inos);
     }
index 705f1bf1a5dc69a1cabd780cbae9499be76fbf58..316447a4c837fca3b795327941dfabb0f43c489b 100644 (file)
@@ -343,6 +343,7 @@ private:
   bool replay_unsafe_with_closed_session = false;
   double cap_revoke_eviction_timeout = 0;
   uint64_t max_snaps_per_dir = 100;
+  unsigned delegate_inos_pct = 0;
 
   DecayCounter recall_throttle;
   time last_recall_state;