From 0014a9e284c6cfc7678e63b56d707a8ad9b93127 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 7 Jun 2016 01:01:09 -0400 Subject: [PATCH] librbd: flush journal commit positions before starting op Ensure all IO has been properly flushed and committed to the journal before starting an op that could affect the IO path. Signed-off-by: Jason Dillaman (cherry picked from commit 636129653c7cac9665d0c423f6aafad5fd0c480a) --- src/librbd/Journal.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librbd/Journal.cc b/src/librbd/Journal.cc index 8e59356afbf9..b24e8611e0bb 100644 --- a/src/librbd/Journal.cc +++ b/src/librbd/Journal.cc @@ -965,6 +965,10 @@ void Journal::append_op_event(uint64_t op_tid, } on_safe = create_async_context_callback(m_image_ctx, on_safe); + on_safe = new FunctionContext([this, on_safe](int r) { + // ensure all committed IO before this op is committed + m_journaler->flush_commit_position(on_safe); + }); future.flush(on_safe); CephContext *cct = m_image_ctx.cct; -- 2.47.3