]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: avoid processing new events after stop requested 14531/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 6 Jan 2017 20:59:22 +0000 (15:59 -0500)
committerNathan Cutler <ncutler@suse.com>
Thu, 13 Apr 2017 20:56:15 +0000 (22:56 +0200)
Fixes: http://tracker.ceph.com/issues/18441
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit d30873b269441815b5fc7de14c7d9a1077a17d8d)

src/tools/rbd_mirror/ImageReplayer.cc

index ff2fa32623bad34153e15dd72ec8b10e459e2135..3b674d8efb17d078546abd2b5be51c5caa34b7dd 100644 (file)
@@ -604,6 +604,7 @@ void ImageReplayer<I>::on_start_fail(int r, const std::string &desc)
   Context *ctx = new FunctionContext([this, r, desc](int _r) {
       {
         Mutex::Locker locker(m_lock);
+        assert(m_state == STATE_STARTING);
         m_state = STATE_STOPPING;
         if (r < 0 && r != -ECANCELED) {
           derr << "start failed: " << cpp_strerror(r) << dendl;
@@ -1058,6 +1059,12 @@ void ImageReplayer<I>::process_entry() {
   dout(20) << "processing entry tid=" << m_replay_entry.get_commit_tid()
            << dendl;
 
+  // stop replaying events if stop has been requested
+  if (on_replay_interrupted()) {
+    m_event_replay_tracker.finish_op();
+    return;
+  }
+
   Context *on_ready = create_context_callback<
     ImageReplayer, &ImageReplayer<I>::handle_process_entry_ready>(this);
   Context *on_commit = new C_ReplayCommitted(this, std::move(m_replay_entry));