From 851395a803138d2c58fe9b2ce0011e8f73a3bd1c Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 9 Feb 2016 12:10:10 -0500 Subject: [PATCH] librbd: do not fire flush completions before associated write Prevents a race condition in journal replay when committing events to the journal. Signed-off-by: Jason Dillaman --- src/librbd/AioCompletion.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librbd/AioCompletion.cc b/src/librbd/AioCompletion.cc index ab71c3c268ea1..765c4cfe5f210 100644 --- a/src/librbd/AioCompletion.cc +++ b/src/librbd/AioCompletion.cc @@ -91,12 +91,7 @@ namespace librbd { ictx->journal->commit_io_event(journal_tid, rval); } - // note: possible for image to be closed after op marked finished done = true; - if (async_op.started()) { - async_op.finish_op(); - } - if (complete_cb) { lock.Unlock(); complete_cb(rbd_comp, complete_arg); @@ -110,6 +105,11 @@ namespace librbd { ictx->event_socket.notify(); } cond.Signal(); + + // note: possible for image to be closed after op marked finished + if (async_op.started()) { + async_op.finish_op(); + } tracepoint(librbd, aio_complete_exit); } -- 2.39.5