]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rbd-mirror: fix race preventing local image deletion 52627/head
authorN Balachandran <nibalach@redhat.com>
Fri, 14 Jul 2023 12:56:15 +0000 (18:26 +0530)
committerN Balachandran <nibalach@redhat.com>
Tue, 25 Jul 2023 12:25:06 +0000 (17:55 +0530)
commit761ec7437d54b64b9984388666bda53159ce2839
treea2520fa5dd6321031af9f800b7ba71e2b4f01a03
parentc1444501ab7918ce42bdc26b9d860ad26e34dd69
rbd-mirror: fix race preventing local image deletion

On primary image deletion, a race between InstanceReplayer::release_image()
(which calls ImageReplayer::stop())and ImageReplayer::handle_bootstrap()
may prevent the non-primary image from being deleted. Because
ImageReplayer::handle_bootstrap() checks if the start has been canceled
before processing -ENOLINK, m_delete_requested is not set to true and the
local image is not deleted.
This commit sets m_delete_requested to true before checking if the
start has been canceled to ensure that the image is deleted during shut_down,
and updates ImageReplayer::bootstrap() to cancel the BootstrapRequest
and prevent a potentially long time spent in an image sync if ImageReplayer
stop is requested.

Fixes: https://tracker.ceph.com/issues/61672
Signed-off-by: N Balachandran <nibalach@redhat.com>
(cherry picked from commit 1df7921b916579c273cb597e234c9c6b721674d7)
src/test/rbd_mirror/image_replayer/test_mock_BootstrapRequest.cc
src/test/rbd_mirror/test_mock_ImageReplayer.cc
src/tools/rbd_mirror/ImageReplayer.cc