From 6d42d18e112fe09ea72e14de69ff5cd2afd6a56c Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Mon, 16 Sep 2024 11:37:49 +0200 Subject: [PATCH] librbd/crypto/LoadRequest: rename m_is_current_format_cloned Formats must also be cloned if the image is under migration, so rename m_is_current_format_cloned to m_is_current_format_assumed to avoid potential confusion with clone() being called in two places but m_is_current_format_cloned being set in only one place. Signed-off-by: Ilya Dryomov (cherry picked from commit 63529523f5778294fa9e447604f9d18c091b6b12) --- src/librbd/crypto/LoadRequest.cc | 8 ++++---- src/librbd/crypto/LoadRequest.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librbd/crypto/LoadRequest.cc b/src/librbd/crypto/LoadRequest.cc index 5bc57d693c5..a751605e0d5 100644 --- a/src/librbd/crypto/LoadRequest.cc +++ b/src/librbd/crypto/LoadRequest.cc @@ -31,7 +31,7 @@ LoadRequest::LoadRequest( Context* on_finish) : m_image_ctx(image_ctx), m_on_finish(on_finish), m_format_idx(0), - m_is_current_format_cloned(false), + m_is_current_format_assumed(false), m_formats(std::move(formats)) { } @@ -108,7 +108,7 @@ void LoadRequest::handle_load(int r) { ldout(m_image_ctx->cct, 20) << "r=" << r << dendl; if (r < 0) { - if (m_is_current_format_cloned && + if (m_is_current_format_assumed && m_detected_format_name == UNKNOWN_FORMAT) { // encryption format was not detected, assume plaintext ldout(m_image_ctx->cct, 5) << "assuming plaintext for image " @@ -125,7 +125,7 @@ void LoadRequest::handle_load(int r) { } ldout(m_image_ctx->cct, 5) << "loaded format " << m_detected_format_name - << (m_is_current_format_cloned ? " (cloned)" : "") + << (m_is_current_format_assumed ? " (assumed)" : "") << " for image " << m_current_image_ctx->name << dendl; @@ -136,8 +136,8 @@ void LoadRequest::handle_load(int r) { if (m_format_idx >= m_formats.size()) { // try to load next ancestor using the same format ldout(m_image_ctx->cct, 20) << "cloning format" << dendl; - m_is_current_format_cloned = true; m_formats.push_back(m_formats[m_formats.size() - 1]->clone()); + m_is_current_format_assumed = true; } load(); diff --git a/src/librbd/crypto/LoadRequest.h b/src/librbd/crypto/LoadRequest.h index 84f595bb6c6..702748a2418 100644 --- a/src/librbd/crypto/LoadRequest.h +++ b/src/librbd/crypto/LoadRequest.h @@ -44,7 +44,7 @@ private: Context* m_on_finish; size_t m_format_idx; - bool m_is_current_format_cloned; + bool m_is_current_format_assumed; std::vector m_formats; I* m_current_image_ctx; std::string m_detected_format_name; -- 2.39.5