]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
journal: avoid holding lock while marking ops are complete
authorJason Dillaman <dillaman@redhat.com>
Fri, 13 Nov 2015 07:00:21 +0000 (02:00 -0500)
committerJason Dillaman <dillaman@redhat.com>
Fri, 13 Nov 2015 07:00:21 +0000 (02:00 -0500)
There is a possibility of a race if the JournalTrimmer destructor is
waiting for an async op to complete but the op is flagged as complete
while the mutex is being held.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/journal/JournalTrimmer.cc
src/journal/JournalTrimmer.h

index 2af67a8298393ba5e90c42353230ebb37ae9760f..33e3be2c5b0d1f7967c36e30120cef5726defbd0 100644 (file)
@@ -147,7 +147,6 @@ void JournalTrimmer::handle_commit_position_safe(
       trim_objects(object_set_position.object_number / splay_width);
     }
   }
-  m_async_op_tracker.finish_op();
 }
 
 void JournalTrimmer::handle_set_removed(int r, uint64_t object_set) {
@@ -175,7 +174,6 @@ void JournalTrimmer::handle_set_removed(int r, uint64_t object_set) {
     ldout(m_cct, 20) << "completing remove set context" << dendl;
     m_remove_set_ctx->complete(r);
   }
-  m_async_op_tracker.finish_op();
 }
 
 JournalTrimmer::C_RemoveSet::C_RemoveSet(JournalTrimmer *_journal_trimmer,
index 937340733d703f18aa3fdef7f2e5528bdd030322..9f557a7671bc9d4465e2499ef6ca44ec1e0e5962 100644 (file)
@@ -37,6 +37,7 @@ private:
 
     virtual void finish(int r) {
       journal_trimmer->handle_commit_position_safe(r, object_set_position);
+      journal_trimmer->m_async_op_tracker.finish_op();
     }
   };
   struct C_RemoveSet : public Context {
@@ -51,6 +52,7 @@ private:
     virtual void complete(int r);
     virtual void finish(int r) {
       journal_trimmer->handle_set_removed(r, object_set);
+      journal_trimmer->m_async_op_tracker.finish_op();
     }
   };