]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: instantiate the status formatter before changing state 24321/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 19 Sep 2018 18:24:31 +0000 (14:24 -0400)
committerNathan Cutler <ncutler@suse.com>
Fri, 28 Sep 2018 07:59:42 +0000 (09:59 +0200)
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>
(cherry picked from commit bbdc545ec1602f928c89c85d61c975abdf67be5b)

src/tools/rbd_mirror/ImageReplayer.cc

index 471cf82169f24227e044d0f742da64c079414918..e2b340bf5dfcaf335832730ae973face42b1f9f4 100644 (file)
@@ -631,6 +631,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);
@@ -642,8 +645,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);