From 9b2dc5a267e45be2397a915ab9a7ddce914ba3fa Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 10 Mar 2020 19:18:04 -0400 Subject: [PATCH] librbd: peer removal needs to open non-primary images in R/W mode The non-primary image might have mirror snapshots that need to be updated to remove the peer reference. Signed-off-by: Jason Dillaman --- src/librbd/api/Mirror.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librbd/api/Mirror.cc b/src/librbd/api/Mirror.cc index ebdaa4926cb..304611dd9e0 100644 --- a/src/librbd/api/Mirror.cc +++ b/src/librbd/api/Mirror.cc @@ -1544,6 +1544,8 @@ int Mirror::peer_site_remove(librados::IoCtx& io_ctx, // TODO: optimize. I *img_ctx = I::create("", image_id, nullptr, ns_io_ctx, false); + img_ctx->read_only_mask &= ~IMAGE_READ_ONLY_FLAG_NON_PRIMARY; + r = img_ctx->state->open(0); if (r == -ENOENT) { continue; -- 2.39.5