From 7f5ee3378c646b6fec5f90b79d508635cddbd1d2 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 9 Dec 2015 16:21:04 -0500 Subject: [PATCH] librbd: fix test case race condition for journaling ops Signed-off-by: Jason Dillaman --- src/librbd/operation/Request.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/librbd/operation/Request.cc b/src/librbd/operation/Request.cc index ce036842d753..6a96d85687cc 100644 --- a/src/librbd/operation/Request.cc +++ b/src/librbd/operation/Request.cc @@ -39,18 +39,19 @@ void Request::send() { template void Request::finish(int r) { - AsyncRequest::finish(r); - - I &image_ctx = this->m_image_ctx; - RWLock::RLocker snap_locker(image_ctx.snap_lock); - if (m_tid != 0 && - image_ctx.journal != NULL && - !image_ctx.journal->is_journal_replaying()) { - // ops will be canceled / completed before closing journal - assert(image_ctx.journal->is_journal_ready()); + { + I &image_ctx = this->m_image_ctx; + RWLock::RLocker snap_locker(image_ctx.snap_lock); + if (m_tid != 0 && image_ctx.journal != NULL && + !image_ctx.journal->is_journal_replaying()) { + // ops will be canceled / completed before closing journal + assert(image_ctx.journal->is_journal_ready()); - image_ctx.journal->commit_op_event(m_tid, r); + image_ctx.journal->commit_op_event(m_tid, r); + } } + + AsyncRequest::finish(r); } template -- 2.47.3