]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: hold lock while updating local image name 33988/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 16 Mar 2020 13:13:56 +0000 (09:13 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 16 Mar 2020 13:16:03 +0000 (09:16 -0400)
There is a potential for an independently scheduled status update to
request the local image name from the bootstrap state machine during its
initialization.

Fixes: https://tracker.ceph.com/issues/44391
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc

index 0ec96c58f8f9c393a76a903f0b9e8168e980e9f7..7241618be2b9a81c4462ba39acd168a689f7f1a1 100644 (file)
@@ -113,8 +113,12 @@ void BootstrapRequest<I>::prepare_local_image() {
   dout(10) << dendl;
   update_progress("PREPARE_LOCAL_IMAGE");
 
+  {
+    std::unique_lock locker{m_lock};
+    m_local_image_name = m_global_image_id;
+  }
+
   ceph_assert(*m_state_builder == nullptr);
-  m_local_image_name = m_global_image_id;
   auto ctx = create_context_callback<
     BootstrapRequest, &BootstrapRequest<I>::handle_prepare_local_image>(this);
   auto req = image_replayer::PrepareLocalImageRequest<I>::create(