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-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3fb9319d6d313c6c25d08cf982e3442e1cacad06;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 5c3dddf5e71b2c1ac7d9184722f72620a610fd29 ("mds: add compile time checks for sortedness") --- diff --git a/src/common/options/mds.yaml.in b/src/common/options/mds.yaml.in index a8f06ecc3ca0..aa9365a843e3 100644 --- a/src/common/options/mds.yaml.in +++ b/src/common/options/mds.yaml.in @@ -892,6 +892,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 9ca24346e58b..04df37dded9e 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -3885,6 +3885,7 @@ const char** MDSRankDispatcher::get_tracked_conf_keys() const "mds_inject_rename_corrupt_dentry_first", "mds_inject_journal_corrupt_dentry_first", "mds_session_metadata_threshold", + "mds_allow_async_dirops", NULL }; return KEYS; diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 563f339dafce..e641dd508b5d 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"); } @@ -2479,7 +2482,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; @@ -4755,7 +4758,7 @@ void Server::handle_client_openc(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. @@ -8101,7 +8104,7 @@ void Server::handle_client_unlink(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 df276c66f0b1..c96caa77de8c 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -540,6 +540,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;