]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: instantiate the status formatter before changing state 24181/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 19 Sep 2018 18:24:31 +0000 (14:24 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 19 Sep 2018 18:27:24 +0000 (14:27 -0400)
This will avoid a possible race between pre-queued status updates
firing between the time the state has been changed and the formatter
has been instantiated.

Fixes: http://tracker.ceph.com/issues/36084
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/ImageReplayer.cc

index bca0f7a6506286cf5d60fd2cd0f131712375be2e..35650e5d3e485b5ceebfc0eabc333bd01265da1d 100644 (file)
@@ -630,6 +630,9 @@ void ImageReplayer<I>::handle_start_replay(int r) {
     return;
   }
 
+  m_replay_status_formatter =
+    ReplayStatusFormatter<I>::create(m_remote_journaler, m_local_mirror_uuid);
+
   Context *on_finish(nullptr);
   {
     Mutex::Locker locker(m_lock);
@@ -641,8 +644,6 @@ void ImageReplayer<I>::handle_start_replay(int r) {
   m_event_preprocessor = EventPreprocessor<I>::create(
     *m_local_image_ctx, *m_remote_journaler, m_local_mirror_uuid,
     &m_client_meta, m_threads->work_queue);
-  m_replay_status_formatter =
-    ReplayStatusFormatter<I>::create(m_remote_journaler, m_local_mirror_uuid);
 
   update_mirror_image_status(true, boost::none);
   reschedule_update_status_task(30);