Skip to content

Commit 6352952

Browse files
committed
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 <[email protected]>
1 parent 731cee7 commit 6352952

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/librbd/crypto/LoadRequest.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LoadRequest<I>::LoadRequest(
3131
Context* on_finish) : m_image_ctx(image_ctx),
3232
m_on_finish(on_finish),
3333
m_format_idx(0),
34-
m_is_current_format_cloned(false),
34+
m_is_current_format_assumed(false),
3535
m_formats(std::move(formats)) {
3636
}
3737

@@ -108,7 +108,7 @@ void LoadRequest<I>::handle_load(int r) {
108108
ldout(m_image_ctx->cct, 20) << "r=" << r << dendl;
109109

110110
if (r < 0) {
111-
if (m_is_current_format_cloned &&
111+
if (m_is_current_format_assumed &&
112112
m_detected_format_name == UNKNOWN_FORMAT) {
113113
// encryption format was not detected, assume plaintext
114114
ldout(m_image_ctx->cct, 5) << "assuming plaintext for image "
@@ -125,7 +125,7 @@ void LoadRequest<I>::handle_load(int r) {
125125
}
126126

127127
ldout(m_image_ctx->cct, 5) << "loaded format " << m_detected_format_name
128-
<< (m_is_current_format_cloned ? " (cloned)" : "")
128+
<< (m_is_current_format_assumed ? " (assumed)" : "")
129129
<< " for image " << m_current_image_ctx->name
130130
<< dendl;
131131

@@ -136,8 +136,8 @@ void LoadRequest<I>::handle_load(int r) {
136136
if (m_format_idx >= m_formats.size()) {
137137
// try to load next ancestor using the same format
138138
ldout(m_image_ctx->cct, 20) << "cloning format" << dendl;
139-
m_is_current_format_cloned = true;
140139
m_formats.push_back(m_formats[m_formats.size() - 1]->clone());
140+
m_is_current_format_assumed = true;
141141
}
142142

143143
load();

src/librbd/crypto/LoadRequest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class LoadRequest {
4444
Context* m_on_finish;
4545

4646
size_t m_format_idx;
47-
bool m_is_current_format_cloned;
47+
bool m_is_current_format_assumed;
4848
std::vector<EncryptionFormat> m_formats;
4949
I* m_current_image_ctx;
5050
std::string m_detected_format_name;

0 commit comments

Comments
 (0)