From: Patrick Donnelly Date: Thu, 24 Jan 2019 22:22:42 +0000 (-0800) Subject: mds: adapt drop cache for incremental recall X-Git-Tag: v14.1.0~240^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7244cae4b8b4455e6b66fcaa5299905c839bee24;p=ceph.git mds: adapt drop cache for incremental recall Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 222bb0d4714..76539437544 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -256,6 +256,7 @@ public: assert(mds->mds_lock.is_locked()); dout(20) << __func__ << dendl; + f->open_object_section("result"); recall_client_state(); } @@ -314,8 +315,8 @@ private: void recall_client_state() { dout(20) << __func__ << dendl; - - f->open_object_section("result"); + auto now = mono_clock::now(); + auto duration = std::chrono::duration(recall_start-now).count(); MDSGatherBuilder *gather = new MDSGatherBuilder(g_ceph_context); auto [throttled, count] = server->recall_client_state(gather, Server::RecallFlags::STEADY); @@ -323,19 +324,30 @@ private: << (throttled ? " (throttled)" : "") << " recalled " << count << " caps" << dendl; - if (!gather->has_subs()) { - delete gather; - return handle_recall_client_state(0); + if ((throttled || count > 0) && (recall_timeout == 0 || duration < recall_timeout)) { + auto timer = new FunctionContext([this](int _) { + recall_client_state(); + }); + mds->timer.add_event_after(1.0, timer); + } else { + if (!gather->has_subs()) { + delete gather; + return handle_recall_client_state(0); + } else if (recall_timeout > 0 && duration > recall_timeout) { + delete gather; + return handle_recall_client_state(-ETIMEDOUT); + } else { + uint64_t remaining = (recall_timeout == 0 ? 0 : recall_timeout-duration); + C_ContextTimeout *ctx = new C_ContextTimeout( + mds, remaining, new FunctionContext([this](int r) { + handle_recall_client_state(r); + })); + + ctx->start_timer(); + gather->set_finisher(new MDSInternalContextWrapper(mds, ctx)); + gather->activate(); + } } - - C_ContextTimeout *ctx = new C_ContextTimeout( - mds, recall_timeout, new FunctionContext([this](int r) { - handle_recall_client_state(r); - })); - - ctx->start_timer(); - gather->set_finisher(new MDSInternalContextWrapper(mds, ctx)); - gather->activate(); } void handle_recall_client_state(int r) {