]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
rbd-mirror: fix race preventing local image deletion 52057/head
authorN Balachandran <nibalach@redhat.com>
Fri, 14 Jul 2023 12:56:15 +0000 (18:26 +0530)
committerN Balachandran <nibalach@redhat.com>
Fri, 14 Jul 2023 12:56:15 +0000 (18:26 +0530)
commit1df7921b916579c273cb597e234c9c6b721674d7
tree8de1f53e7b8468df39f9acd770b37f81ca847e74
parent2f8a7159a338024ba8897cf625c8f8221d0dfaee
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>
src/test/rbd_mirror/image_replayer/test_mock_BootstrapRequest.cc
src/test/rbd_mirror/test_mock_ImageReplayer.cc
src/tools/rbd_mirror/ImageReplayer.cc