]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-mirror: ignore non-primary read-only state for remote images
authorJason Dillaman <dillaman@redhat.com>
Tue, 7 Apr 2020 23:12:03 +0000 (19:12 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 9 Apr 2020 14:00:28 +0000 (10:00 -0400)
snapshot-based mirroring needs to be able to potentially delete a
demotion snapshot during the unlink process. Previously, these
snapshots have been left while the read-only error was ignored.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/image_replayer/OpenImageRequest.cc

index 7f55745e1247a77f040ed9d940b01c7d0cc6edab..0827a1dcaa7f6cc17e3dd14f6f044a648de5c67e 100644 (file)
@@ -40,6 +40,11 @@ void OpenImageRequest<I>::send_open_image() {
 
   *m_image_ctx = I::create("", m_image_id, nullptr, m_io_ctx, m_read_only);
 
+  if (!m_read_only) {
+    // ensure non-primary images can be modified
+    (*m_image_ctx)->read_only_mask = ~librbd::IMAGE_READ_ONLY_FLAG_NON_PRIMARY;
+  }
+
   Context *ctx = create_context_callback<
     OpenImageRequest<I>, &OpenImageRequest<I>::handle_open_image>(
       this);