]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: clean up ImageReplayer before stopping state machine 9958/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 27 Jun 2016 13:05:33 +0000 (09:05 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 27 Jun 2016 13:05:33 +0000 (09:05 -0400)
Fixes: http://tracker.ceph.com/issues/16489
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/ImageReplayer.cc

index 19da8882f7edb3aee6f95e1a9f38aef42a9e0cff..c46be344ef044110b1fbed8477c5622fa886418b 100644 (file)
@@ -1325,7 +1325,6 @@ template <typename I>
 void ImageReplayer<I>::handle_shut_down(int r, Context *on_start) {
   reschedule_update_status_task(-1);
 
-  Context *on_stop = nullptr;
   {
     Mutex::Locker locker(m_lock);
 
@@ -1357,7 +1356,18 @@ void ImageReplayer<I>::handle_shut_down(int r, Context *on_start) {
                                                    ctx, false);
       return;
     }
+  }
+
+  dout(20) << "stop complete" << dendl;
+  m_local_ioctx.close();
+  m_remote_ioctx.close();
 
+  delete m_replay_status_formatter;
+  m_replay_status_formatter = nullptr;
+
+  Context *on_stop = nullptr;
+  {
+    Mutex::Locker locker(m_lock);
     std::swap(on_stop, m_on_stop_finish);
     m_stop_requested = false;
     assert(m_state == STATE_STOPPING);
@@ -1365,13 +1375,6 @@ void ImageReplayer<I>::handle_shut_down(int r, Context *on_start) {
     m_state_desc.clear();
     m_last_r = 0;
   }
-  dout(20) << "stop complete" << dendl;
-
-  m_local_ioctx.close();
-  m_remote_ioctx.close();
-
-  delete m_replay_status_formatter;
-  m_replay_status_formatter = nullptr;
 
   if (on_start != nullptr) {
     dout(20) << "on start finish complete, r=" << r << dendl;