]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: fix test case race condition for journaling ops 6877/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 9 Dec 2015 21:21:04 +0000 (16:21 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 9 Dec 2015 21:21:04 +0000 (16:21 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/operation/Request.cc

index ce036842d753ec4dde9c14de818893da179416e6..6a96d85687ccc59b65382dcba774eb4f34ef1909 100644 (file)
@@ -39,18 +39,19 @@ void Request<I>::send() {
 
 template <typename I>
 void Request<I>::finish(int r) {
-  AsyncRequest<I>::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<I>::finish(r);
 }
 
 template <typename I>