]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix re-entrant calls into Journaler from PurgeQueue 15430/head
authorJohn Spray <john.spray@redhat.com>
Thu, 15 Jun 2017 13:17:20 +0000 (09:17 -0400)
committerJohn Spray <john.spray@redhat.com>
Tue, 20 Jun 2017 07:40:59 +0000 (08:40 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/PurgeQueue.cc

index ad82aaefafebbb55d6888534ebde10a98557f844..430d3eee80d8f98fb146db2615573544e629eb9c 100644 (file)
@@ -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();
 }