From d8000a556a3390317fb4eca0621cf36ff2e5eb82 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Thu, 31 Jan 2019 20:43:42 -0800 Subject: [PATCH] mds: resolve memory leak of recall gather Small change in behavior: after all clients respond to session flush, immediate begin next recall instead of waiting a whole second. Fixes: http://tracker.ceph.com/issues/38137 Signed-off-by: Patrick Donnelly --- src/mds/MDSRank.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 810eb0b8fa1..a42121bff5e 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -326,10 +326,13 @@ private: caps_recalled += count; 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); + C_ContextTimeout *ctx = new C_ContextTimeout( + mds, 1, new FunctionContext([this](int r) { + recall_client_state(); + })); + ctx->start_timer(); + gather->set_finisher(new MDSInternalContextWrapper(mds, ctx)); + gather->activate(); } else { if (!gather->has_subs()) { delete gather; -- 2.39.5