From: Yan, Zheng Date: Thu, 23 Jan 2020 02:15:11 +0000 (+0800) Subject: mds: don't delegate inos when handling replayed requests X-Git-Tag: v15.1.1~500^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d3c233b8a92c291b355e9defebe1e36da1ba9285;p=ceph.git mds: don't delegate inos when handling replayed requests Otherwise mds may delegate inos that are already used by other replayed requests. Signed-off-by: "Yan, Zheng" --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 4094c11ac7ac..c8e4d049d5ca 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -230,6 +230,7 @@ Server::Server(MDSRank *m) : replay_unsafe_with_closed_session = g_conf().get_val("mds_replay_unsafe_with_closed_session"); cap_revoke_eviction_timeout = g_conf().get_val("mds_cap_revoke_eviction_timeout"); max_snaps_per_dir = g_conf().get_val("mds_max_snaps_per_dir"); + delegate_inos_pct = g_conf().get_val("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& 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("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("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); } diff --git a/src/mds/Server.h b/src/mds/Server.h index 705f1bf1a5dc..316447a4c837 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -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;