]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: clean up ImageReplayer before stopping state machine
authorJason Dillaman <dillaman@redhat.com>
Mon, 27 Jun 2016 13:05:33 +0000 (09:05 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 17 Aug 2016 17:22:03 +0000 (13:22 -0400)
Fixes: http://tracker.ceph.com/issues/16489
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit c97f7245a015dbdda25584134840d023fd65cdd1)

src/tools/rbd_mirror/ImageReplayer.cc

index 1f5e83256d889476f79f1790ed2b177132511fb5..4f369d2bbfa0e3c84b41cb0315b01663136d06b1 100644 (file)
@@ -1328,7 +1328,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);
 
@@ -1351,7 +1350,18 @@ void ImageReplayer<I>::handle_shut_down(int r, Context *on_start) {
                                              m_global_image_id);
       m_stopping_for_resync = false;
     }
+  }
+
+  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);
@@ -1359,13 +1369,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;