From b3c7efbd452f2980e058dae0d5aa59bd0a66d14d Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 16 Mar 2020 09:13:56 -0400 Subject: [PATCH] rbd-mirror: hold lock while updating local image name 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 --- src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc index 0ec96c58f8f..7241618be2b 100644 --- a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc +++ b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc @@ -113,8 +113,12 @@ void BootstrapRequest::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::handle_prepare_local_image>(this); auto req = image_replayer::PrepareLocalImageRequest::create( -- 2.39.5