]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix standby replay thread creation 7132/head
authorJohn Spray <john.spray@redhat.com>
Wed, 6 Jan 2016 15:12:23 +0000 (15:12 +0000)
committerJohn Spray <john.spray@redhat.com>
Wed, 6 Jan 2016 18:56:02 +0000 (18:56 +0000)
When replay() is called more than once, we must
make sure previous instance of thread is joined
before calling create() again.

Fixes: #14144
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDLog.cc

index 43cdc48503548bb4b9a5250d04cea635cf5886f2..3aea9df34e04211defcfda4c428202db6dbf6709 100644 (file)
@@ -176,6 +176,7 @@ void MDLog::open(MDSInternalContextBase *c)
 {
   dout(5) << "open discovering log bounds" << dendl;
 
+  assert(!recovery_thread.is_started());
   recovery_thread.set_completion(c);
   recovery_thread.create();
 
@@ -215,6 +216,11 @@ void MDLog::reopen(MDSInternalContextBase *c)
   delete journaler;
   journaler = NULL;
 
+  // recovery_thread was started at some point in the past.  Although
+  // it has called it's completion if we made it back here, it might
+  // still not have been cleaned up: join it.
+  recovery_thread.join();
+
   recovery_thread.set_completion(new C_ReopenComplete(this, c));
   recovery_thread.create();
 }
@@ -840,6 +846,11 @@ void MDLog::replay(MDSInternalContextBase *c)
           << " to " << journaler->get_write_pos() << dendl;
 
   assert(num_events == 0 || already_replayed);
+  if (already_replayed) {
+    // Ensure previous instance of ReplayThread is joined before
+    // we create another one
+    replay_thread.join();
+  }
   already_replayed = true;
 
   replay_thread.create();