From: Jason Dillaman Date: Wed, 9 Dec 2015 21:21:04 +0000 (-0500) Subject: librbd: fix test case race condition for journaling ops X-Git-Tag: v10.0.2~71^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7f5ee3378c646b6fec5f90b79d508635cddbd1d2;p=ceph.git librbd: fix test case race condition for journaling ops Signed-off-by: Jason Dillaman --- 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