]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: only enqueue flush completion if a flush is pending
authorJason Dillaman <dillaman@redhat.com>
Mon, 30 Nov 2015 21:30:51 +0000 (16:30 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 30 Nov 2015 21:30:51 +0000 (16:30 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/AsyncOperation.cc

index 7cfc2d74f7fa60dbed8766e5686e79b53fe36bae..7e015d3d034d9d26ecefd69da3942616e6ce3ec6 100644 (file)
@@ -63,9 +63,11 @@ void AsyncOperation::finish_op() {
     }
   }
 
-  C_CompleteFlushes *ctx = new C_CompleteFlushes(m_image_ctx,
-                                                 std::move(m_flush_contexts));
-  m_image_ctx->op_work_queue->queue(ctx);
+  if (!m_flush_contexts.empty()) {
+    C_CompleteFlushes *ctx = new C_CompleteFlushes(m_image_ctx,
+                                                   std::move(m_flush_contexts));
+    m_image_ctx->op_work_queue->queue(ctx);
+  }
 }
 
 void AsyncOperation::add_flush_context(Context *on_finish) {