From 8bc96561f3b61dcb1ad348ee1ad9cd466f3247a6 Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 15 Jun 2017 09:17:20 -0400 Subject: [PATCH] mds: fix re-entrant calls into Journaler from PurgeQueue Signed-off-by: John Spray --- src/mds/PurgeQueue.cc | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/mds/PurgeQueue.cc b/src/mds/PurgeQueue.cc index ad82aaefafe..430d3eee80d 100644 --- a/src/mds/PurgeQueue.cc +++ b/src/mds/PurgeQueue.cc @@ -445,21 +445,12 @@ void PurgeQueue::_execute_item( } assert(gather.has_subs()); - gather.set_finisher(new FunctionContext([this, expire_to](int r){ - if (lock.is_locked_by_me()) { - // Fast completion, Objecter ops completed before we hit gather.activate() - // and we're being called inline. We are still inside _consume so - // no need to call back into it. - _execute_item_complete(expire_to); - } else { - // Normal completion, we're being called back from outside PurgeQueue::lock - // by the Objecter. Take the lock, and call back into _consume to - // find more work. - Mutex::Locker l(lock); - _execute_item_complete(expire_to); + gather.set_finisher(new C_OnFinisher( + new FunctionContext([this, expire_to](int r){ + Mutex::Locker l(lock); + _execute_item_complete(expire_to); - _consume(); - } + _consume(); // Have we gone idle? If so, do an extra write_head now instead of // waiting for next flush after journaler_write_head_interval. @@ -471,7 +462,8 @@ void PurgeQueue::_execute_item( journaler.trim(); })); } - })); + }), &finisher)); + gather.activate(); } -- 2.39.5