@@ -273,6 +273,8 @@ Server::Server(MDSRank *m, MetricsHandler *metrics_handler) :
273273 caps_throttle_retry_request_timeout = g_conf ().get_val <double >(" mds_cap_acquisition_throttle_retry_request_timeout" );
274274 dir_max_entries = g_conf ().get_val <uint64_t >(" mds_dir_max_entries" );
275275 bal_fragment_size_max = g_conf ().get_val <int64_t >(" mds_bal_fragment_size_max" );
276+ dispatch_client_request_delay = g_conf ().get_val <std::chrono::milliseconds>(" mds_server_dispatch_client_request_delay" );
277+ dispatch_killpoint_random = g_conf ().get_val <double >(" mds_server_dispatch_killpoint_random" );
276278 supported_features = feature_bitset_t (CEPHFS_FEATURES_MDS_SUPPORTED);
277279 supported_metric_spec = feature_bitset_t (CEPHFS_METRIC_FEATURES_ALL);
278280}
@@ -1375,6 +1377,16 @@ void Server::handle_conf_change(const std::set<std::string>& changed) {
13751377 if (changed.count (" mds_inject_rename_corrupt_dentry_first" )) {
13761378 inject_rename_corrupt_dentry_first = g_conf ().get_val <double >(" mds_inject_rename_corrupt_dentry_first" );
13771379 }
1380+ if (changed.count (" mds_server_dispatch_client_request_delay" )) {
1381+ dispatch_client_request_delay = g_conf ().get_val <std::chrono::milliseconds>(" mds_server_dispatch_client_request_delay" );
1382+ dout (20 ) << __func__ << " mds_server_dispatch_client_request_delay now "
1383+ << dispatch_client_request_delay << dendl;
1384+ }
1385+ if (changed.count (" mds_server_dispatch_killpoint_random" )) {
1386+ dispatch_killpoint_random = g_conf ().get_val <double >(" mds_server_dispatch_killpoint_random" );
1387+ dout (20 ) << __func__ << " mds_server_dispatch_killpoint_random now "
1388+ << dispatch_killpoint_random << dendl;
1389+ }
13781390}
13791391
13801392/*
@@ -2667,6 +2679,14 @@ void Server::dispatch_client_request(const MDRequestRef& mdr)
26672679
26682680 dout (7 ) << " dispatch_client_request " << *req << dendl;
26692681
2682+ auto zeroms = std::chrono::milliseconds::zero ();
2683+ if (unlikely (dispatch_client_request_delay > zeroms)) {
2684+ std::this_thread::sleep_for (dispatch_client_request_delay);
2685+ }
2686+ if (unlikely (dispatch_killpoint_random > 0.0 ) && dispatch_killpoint_random >= ceph::util::generate_random_number (0.0 , 1.0 )) {
2687+ ceph_abort (" dispatch_killpoint_random" );
2688+ }
2689+
26702690 if (req->may_write () && mdcache->is_readonly ()) {
26712691 dout (10 ) << " read-only FS" << dendl;
26722692 respond_to_request (mdr, -CEPHFS_EROFS);
0 commit comments