]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: restore out-of-band future callbacks to avoid lock cycles 8477/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 6 Apr 2016 21:30:11 +0000 (17:30 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 7 Apr 2016 14:25:24 +0000 (10:25 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/Journal.cc
src/test/librbd/test_mock_Journal.cc

index df30cb349e69d2dc4eb329eda2f68f26bb809a4a..265a869d36f8a6e941dc93b8e3aad1ebc9003930 100644 (file)
@@ -827,7 +827,8 @@ uint64_t Journal<I>::append_io_event(AioCompletion *aio_comp,
                  << "length=" << length << ", "
                  << "flush=" << flush_entry << ", tid=" << tid << dendl;
 
-  Context *on_safe = new C_IOEventSafe(this, tid);
+  Context *on_safe = create_async_context_callback(
+    m_image_ctx, new C_IOEventSafe(this, tid));
   if (flush_entry) {
     future.flush(on_safe);
   } else {
@@ -942,8 +943,9 @@ void Journal<I>::commit_op_event(uint64_t op_tid, int r) {
     op_finish_future = m_journaler->append(m_tag_tid, bl);
   }
 
-  op_finish_future.flush(new C_OpEventSafe(this, op_tid, op_start_future,
-                                           op_finish_future));
+  op_finish_future.flush(create_async_context_callback(
+    m_image_ctx, new C_OpEventSafe(this, op_tid, op_start_future,
+                                   op_finish_future)));
 }
 
 template <typename I>
@@ -971,7 +973,7 @@ void Journal<I>::flush_event(uint64_t tid, Context *on_safe) {
   }
 
   if (future.is_valid()) {
-    future.flush(NULL);
+    future.flush(nullptr);
   }
 }
 
index 881ac16573fb048c5631877ae7f0e89454971b3d..9ebea8f3e7079e9b86da48a57cc3f837b1a785e6 100644 (file)
@@ -944,6 +944,7 @@ TEST_F(TestMockJournal, EventAndIOCommitOrder) {
 
   // commit journal event followed by IO event (standard)
   on_journal_safe1->complete(0);
+  ictx->op_work_queue->drain();
   expect_future_committed(mock_journaler);
   mock_journal.commit_io_event(1U, 0);
 
@@ -954,6 +955,7 @@ TEST_F(TestMockJournal, EventAndIOCommitOrder) {
   C_SaferCond event_ctx;
   mock_journal.wait_event(2U, &event_ctx);
   on_journal_safe2->complete(0);
+  ictx->op_work_queue->drain();
   ASSERT_EQ(0, event_ctx.wait());
 }
 
@@ -1054,6 +1056,7 @@ TEST_F(TestMockJournal, IOCommitError) {
 
   // failed IO remains uncommitted in journal
   on_journal_safe->complete(0);
+  ictx->op_work_queue->drain();
   mock_journal.commit_io_event(1U, -EINVAL);
 }