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: v19.2.3~193^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f9f6bf94457d9ccd979691b5124e1001e67fd596;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 (cherry picked from commit a86ee496be932290650a069ee5750557df5054a6) Conflicts: src/mds/MDSRank.cc Lack of 5c3dddf ("mds: add compile time checks for sortedness") --- diff --git a/src/common/options/mds.yaml.in b/src/common/options/mds.yaml.in index dfd0696392f..05fa4fca9a6 100644 --- a/src/common/options/mds.yaml.in +++ b/src/common/options/mds.yaml.in @@ -963,6 +963,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 0bbd9a07548..2330a269961 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -4125,6 +4125,7 @@ const char** MDSRankDispatcher::get_tracked_conf_keys() const "mds_session_metadata_threshold", "mds_log_trim_threshold", "mds_log_trim_decay_rate", + "mds_allow_async_dirops", NULL }; return KEYS; diff --git a/src/mds/Server.cc b/src/mds/Server.cc index b54d755f453..c76c090540e 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -1319,6 +1319,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"); } @@ -2481,7 +2484,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; @@ -4766,7 +4769,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. @@ -8148,7 +8151,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 c410281f511..a95ce9db338 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -543,6 +543,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;