From: Xiubo Li Date: Mon, 8 Jul 2024 07:42:14 +0000 (+0800) Subject: mds: add 'mds_allow_async_dirops' opt to allow/disable async dirop X-Git-Tag: v20.0.0~314^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a86ee496be932290650a069ee5750557df5054a6;p=ceph.git mds: add 'mds_allow_async_dirops' opt to allow/disable async dirop The lock cache is buggy and we need to disable it as a workaround. Fixes: https://tracker.ceph.com/issues/65607 Signed-off-by: Xiubo Li --- diff --git a/src/common/options/mds.yaml.in b/src/common/options/mds.yaml.in index 03a53cd7cea..f8cb897dacd 100644 --- a/src/common/options/mds.yaml.in +++ b/src/common/options/mds.yaml.in @@ -990,6 +990,14 @@ options: - mds fmt_desc: Ceph will randomly fragment or merge directories. with_legacy: true +- name: mds_allow_async_dirops + type: bool + level: advanced + default: true + services: + - mds + fmt_desc: MDS will enable/disable the async dirop feature. + with_legacy: true - name: mds_dump_cache_on_map type: bool level: dev diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 52ed930d71b..9448e63749f 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -4116,7 +4116,8 @@ const char** MDSRankDispatcher::get_tracked_conf_keys() const "mds_session_cap_acquisition_throttle", \ "mds_session_max_caps_throttle_ratio", \ "mds_session_metadata_threshold", \ - "mds_symlink_recovery" + "mds_symlink_recovery", \ + "mds_allow_async_dirops" constexpr bool is_sorted = [] () constexpr { constexpr auto arr = std::to_array({KEYS}); diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 5874a3dce56..311bedef793 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -1350,6 +1350,9 @@ void Server::evict_cap_revoke_non_responders() { } void Server::handle_conf_change(const std::set& changed) { + if (changed.count("mds_allow_async_dirops")){ + mds_allow_async_dirops = g_conf().get_val("mds_allow_async_dirops"); + } if (changed.count("mds_forward_all_requests_to_auth")){ forward_all_requests_to_auth = g_conf().get_val("mds_forward_all_requests_to_auth"); } @@ -2522,7 +2525,7 @@ void Server::set_reply_extra_bl(const cref_t &req, inodeno_t ino { Session *session = mds->get_session(req); - if (session->info.has_feature(CEPHFS_FEATURE_DELEG_INO)) { + if (mds_allow_async_dirops && session->info.has_feature(CEPHFS_FEATURE_DELEG_INO)) { openc_response_t ocresp; dout(10) << "adding created_ino and delegated_inos" << dendl; @@ -4815,7 +4818,7 @@ void Server::handle_client_openc(const MDRequestRef& mdr) if (!check_dir_max_entries(mdr, dir)) return; - if (mdr->dn[0].size() == 1) + if (mds_allow_async_dirops && mdr->dn[0].size() == 1) mds->locker->create_lock_cache(mdr, diri, &mdr->dir_layout); // create inode. @@ -8196,7 +8199,7 @@ void Server::handle_client_unlink(const MDRequestRef& mdr) return; // we're waiting for a witness. } - if (!rmdir && dnl->is_primary() && mdr->dn[0].size() == 1) + if (mds_allow_async_dirops && !rmdir && dnl->is_primary() && mdr->dn[0].size() == 1) mds->locker->create_lock_cache(mdr, diri); // ok! diff --git a/src/mds/Server.h b/src/mds/Server.h index 5f9a763e550..0a6391d5b68 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -544,6 +544,7 @@ private: feature_bitset_t supported_metric_spec; feature_bitset_t required_client_features; + bool mds_allow_async_dirops = true; bool forward_all_requests_to_auth = false; bool replay_unsafe_with_closed_session = false; double cap_revoke_eviction_timeout = 0;