Repository navigation
squid: librbd: avoid losing sparseness in read_parent() - #68462
Conversation
When read_parent() constructs a read for image_ctx->parent, it employs a thick bufferlist (either re-using the bufferlist on the object extent or creating a temporary one inside of C_ObjectReadMergedExtents). This forgoes any sparseness: even if the result obtained by ObjectRequest is sparse, it's thickened by ReadResult's handler for Bufferlist type. This behavior is very old and hasn't been a problem for regular clones because the public API returns a thick bufferlist in the case of C++ or equivalent char* buf/struct iovec iov[] buffers in the case of C anyway. ObjectCacher isn't sparse-aware but it's also not used for caching reads by default and reading from parent for the purposes of a copyup is done in CopyupRequest in a way that preserves sparseness. However, when it comes to migration, source image reads go through read_parent() and the destination image gets thickened as an inadvertent side effect. Fix this by introducing a new ChildObject type for ReadResult whose handler would plant the result obtained by parent's ObjectRequest into child's ObjectRequest, as if read_parent() wasn't even called. Fixes: https://tracker.ceph.com/issues/73831 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit bd2204f) Conflicts: src/librbd/io/ReadResult.h [ commit 786ea20 ("librbd, tools: migrate from boost::variant to std::variant") not in squid ]
It's similar in concept to the handler for the new ChildObject type. To highlight that, make comments and log messages consistent between the two. Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit aad0285)
There was a problem hiding this comment.
Automated Backport Parity Review - Backport Deviation Alert
A conflict or unapproved deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.
How to proceed:
- Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git
Conflicts:block intact) and include an explanation for changes. - Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
- Component Leads (Review): Please review the Range Diff below to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting
/audit override.
Be familiar with the rules and guidelines for writing backports.
Affected File(s)
src/librbd/io/ReadResult.h
Range Diff
Click to expand
--- Original (bd2204f7)
+++ Backport (4c453822)
@@ -21,3 +21,9 @@
Fixes: https://tracker.ceph.com/issues/73831
Signed-off-by: Ilya Dryomov <[email protected]>
+(cherry picked from commit bd2204f7283a30d699778834280eed908440fd62)
+
+Conflicts:
+ src/librbd/io/ReadResult.h [ commit 786ea203a283 ("librbd,
+ tools: migrate from boost::variant to std::variant") not in
+ squid ]
================================================================================
RANGE DIFF
================================================================================
1: bd2204f7283 ! 1: 4c453822a86 librbd: avoid losing sparseness in read_parent()
@@ Commit message
Fixes: https://tracker.ceph.com/issues/73831
Signed-off-by: Ilya Dryomov <[email protected]>
+ (cherry picked from commit bd2204f7283a30d699778834280eed908440fd62)
+
+ Conflicts:
+ src/librbd/io/ReadResult.h [ commit 786ea203a283 ("librbd,
+ tools: migrate from boost::variant to std::variant") not in
+ squid ]
## src/librbd/io/ReadResult.cc ##
-@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor {
+@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor : public boost::static_visitor<void> {
sbl.image_extents = image_extents;
}
@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor {
template <typename T>
void operator()(T &t) const {
}
-@@ src/librbd/io/ReadResult.cc: struct ReadResult::AssembleResultVisitor {
+@@ src/librbd/io/ReadResult.cc: struct ReadResult::AssembleResultVisitor : public boost::static_visitor<void> {
<< " bytes to bl "
<< reinterpret_cast<void*>(sparse_bufferlist.bl) << dendl;
}
@@ src/librbd/io/ReadResult.cc: ReadResult::ReadResult(Extents* extent_map, ceph::b
+}
+
void ReadResult::set_image_extents(const Extents& image_extents) {
- std::visit(SetImageExtentsVisitor(image_extents), m_buffer);
+ boost::apply_visitor(SetImageExtentsVisitor(image_extents), m_buffer);
}
## src/librbd/io/ReadResult.h ##
@@ src/librbd/io/ReadResult.h: private:
+ }
+ };
+
- typedef std::variant<std::monostate,
- Linear,
- Vector,
- Bufferlist,
-- SparseBufferlist> Buffer;
-+ SparseBufferlist,
-+ ChildObject> Buffer;
+ typedef boost::variant<Empty,
+ Linear,
+ Vector,
+ Bufferlist,
+- SparseBufferlist> Buffer;
++ SparseBufferlist,
++ ChildObject> Buffer;
struct SetImageExtentsVisitor;
struct AssembleResultVisitor;
Commit Parity Visualizer
| BACKPORT PR #68462 | SOURCE PR | SOURCE STATUS |
|---|---|---|
| 4c45382 librbd: avoid losing sparseness in read_parent() | PR #68202 | bd2204f librbd: avoid losing sparseness in read_parent() |
| 4ebe382 librbd: tweak ReadResult's handler for SparseBufferlist type | aad0285 librbd: tweak ReadResult's handler for SparseBufferlist type |
🛟 Need Help?
If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.
📋 Component Lead / Release Manager
To override the audit failure, apply releng-audit-override label or comment /audit override.
When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.
CI Run Log: View Workflow Details
There was a problem hiding this comment.
Automated Backport Parity Review - Backport Deviation Alert
A conflict or unapproved deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.
How to proceed:
- Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git
Conflicts:block intact) and include an explanation for changes. - Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
- Component Leads (Review): Please review the Range Diff below to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting
/audit override.
Be familiar with the rules and guidelines for writing backports.
Affected File(s)
src/librbd/io/ReadResult.h
Range Diff
Click to expand
--- Original (bd2204f7)
+++ Backport (4c453822)
@@ -21,3 +21,9 @@
Fixes: https://tracker.ceph.com/issues/73831
Signed-off-by: Ilya Dryomov <[email protected]>
+(cherry picked from commit bd2204f7283a30d699778834280eed908440fd62)
+
+Conflicts:
+ src/librbd/io/ReadResult.h [ commit 786ea203a283 ("librbd,
+ tools: migrate from boost::variant to std::variant") not in
+ squid ]
================================================================================
RANGE DIFF
================================================================================
1: bd2204f7283 ! 1: 4c453822a86 librbd: avoid losing sparseness in read_parent()
@@ Commit message
Fixes: https://tracker.ceph.com/issues/73831
Signed-off-by: Ilya Dryomov <[email protected]>
+ (cherry picked from commit bd2204f7283a30d699778834280eed908440fd62)
+
+ Conflicts:
+ src/librbd/io/ReadResult.h [ commit 786ea203a283 ("librbd,
+ tools: migrate from boost::variant to std::variant") not in
+ squid ]
## src/librbd/io/ReadResult.cc ##
-@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor {
+@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor : public boost::static_visitor<void> {
sbl.image_extents = image_extents;
}
@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor {
template <typename T>
void operator()(T &t) const {
}
-@@ src/librbd/io/ReadResult.cc: struct ReadResult::AssembleResultVisitor {
+@@ src/librbd/io/ReadResult.cc: struct ReadResult::AssembleResultVisitor : public boost::static_visitor<void> {
<< " bytes to bl "
<< reinterpret_cast<void*>(sparse_bufferlist.bl) << dendl;
}
@@ src/librbd/io/ReadResult.cc: ReadResult::ReadResult(Extents* extent_map, ceph::b
+}
+
void ReadResult::set_image_extents(const Extents& image_extents) {
- std::visit(SetImageExtentsVisitor(image_extents), m_buffer);
+ boost::apply_visitor(SetImageExtentsVisitor(image_extents), m_buffer);
}
## src/librbd/io/ReadResult.h ##
@@ src/librbd/io/ReadResult.h: private:
+ }
+ };
+
- typedef std::variant<std::monostate,
- Linear,
- Vector,
- Bufferlist,
-- SparseBufferlist> Buffer;
-+ SparseBufferlist,
-+ ChildObject> Buffer;
+ typedef boost::variant<Empty,
+ Linear,
+ Vector,
+ Bufferlist,
+- SparseBufferlist> Buffer;
++ SparseBufferlist,
++ ChildObject> Buffer;
struct SetImageExtentsVisitor;
struct AssembleResultVisitor;
Commit Parity Visualizer
| BACKPORT PR #68462 | SOURCE PR | SOURCE STATUS |
|---|---|---|
| 4c45382 librbd: avoid losing sparseness in read_parent() | PR #68202 | bd2204f librbd: avoid losing sparseness in read_parent() |
| 4ebe382 librbd: tweak ReadResult's handler for SparseBufferlist type | aad0285 librbd: tweak ReadResult's handler for SparseBufferlist type |
🛟 Need Help?
If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.
📋 Component Lead / Release Manager
To override the audit failure, apply releng-audit-override label or comment /audit override.
When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.
CI Run Log: View Workflow Details
|
@idryomov I see it's behaving oddly. I'm looking into it. |
There was a problem hiding this comment.
Automated Backport Parity Review - Backport Deviation Alert
A conflict or unapproved deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.
How to proceed:
- Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git
Conflicts:block intact) and include an explanation for changes. - Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
- Component Leads (Review): Please review the Range Diff below to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting
/audit override.
Be familiar with the rules and guidelines for writing backports.
Affected File(s)
src/librbd/io/ReadResult.h
Range Diff
Click to expand
--- Original (bd2204f7)
+++ Backport (4c453822)
@@ -21,3 +21,9 @@
Fixes: https://tracker.ceph.com/issues/73831
Signed-off-by: Ilya Dryomov <[email protected]>
+(cherry picked from commit bd2204f7283a30d699778834280eed908440fd62)
+
+Conflicts:
+ src/librbd/io/ReadResult.h [ commit 786ea203a283 ("librbd,
+ tools: migrate from boost::variant to std::variant") not in
+ squid ]
================================================================================
RANGE DIFF
================================================================================
1: bd2204f7283 ! 1: 4c453822a86 librbd: avoid losing sparseness in read_parent()
@@ Commit message
Fixes: https://tracker.ceph.com/issues/73831
Signed-off-by: Ilya Dryomov <[email protected]>
+ (cherry picked from commit bd2204f7283a30d699778834280eed908440fd62)
+
+ Conflicts:
+ src/librbd/io/ReadResult.h [ commit 786ea203a283 ("librbd,
+ tools: migrate from boost::variant to std::variant") not in
+ squid ]
## src/librbd/io/ReadResult.cc ##
-@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor {
+@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor : public boost::static_visitor<void> {
sbl.image_extents = image_extents;
}
@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor {
template <typename T>
void operator()(T &t) const {
}
-@@ src/librbd/io/ReadResult.cc: struct ReadResult::AssembleResultVisitor {
+@@ src/librbd/io/ReadResult.cc: struct ReadResult::AssembleResultVisitor : public boost::static_visitor<void> {
<< " bytes to bl "
<< reinterpret_cast<void*>(sparse_bufferlist.bl) << dendl;
}
@@ src/librbd/io/ReadResult.cc: ReadResult::ReadResult(Extents* extent_map, ceph::b
+}
+
void ReadResult::set_image_extents(const Extents& image_extents) {
- std::visit(SetImageExtentsVisitor(image_extents), m_buffer);
+ boost::apply_visitor(SetImageExtentsVisitor(image_extents), m_buffer);
}
## src/librbd/io/ReadResult.h ##
@@ src/librbd/io/ReadResult.h: private:
+ }
+ };
+
- typedef std::variant<std::monostate,
- Linear,
- Vector,
- Bufferlist,
-- SparseBufferlist> Buffer;
-+ SparseBufferlist,
-+ ChildObject> Buffer;
+ typedef boost::variant<Empty,
+ Linear,
+ Vector,
+ Bufferlist,
+- SparseBufferlist> Buffer;
++ SparseBufferlist,
++ ChildObject> Buffer;
struct SetImageExtentsVisitor;
struct AssembleResultVisitor;
Commit Parity Visualizer
| BACKPORT PR #68462 | SOURCE PR | SOURCE STATUS |
|---|---|---|
| 4c45382 librbd: avoid losing sparseness in read_parent() | PR #68202 | bd2204f librbd: avoid losing sparseness in read_parent() |
| 4ebe382 librbd: tweak ReadResult's handler for SparseBufferlist type | aad0285 librbd: tweak ReadResult's handler for SparseBufferlist type |
🛟 Need Help?
If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.
📋 Component Lead / Release Manager
To override the audit failure, apply releng-audit-override label or comment /audit override.
When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.
CI Run Log: View Workflow Details
There was a problem hiding this comment.
Automated Backport Parity Review - Backport Deviation Alert
A conflict or unapproved deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.
How to proceed:
- Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git
Conflicts:block intact) and include an explanation for changes. - Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
- Component Leads (Review): Please review the Range Diff below to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting
/audit override.
Be familiar with the rules and guidelines for writing backports.
Affected File(s)
src/librbd/io/ReadResult.h
Range Diff
Click to expand
--- Original (bd2204f7)
+++ Backport (4c453822)
@@ -21,3 +21,9 @@
Fixes: https://tracker.ceph.com/issues/73831
Signed-off-by: Ilya Dryomov <[email protected]>
+(cherry picked from commit bd2204f7283a30d699778834280eed908440fd62)
+
+Conflicts:
+ src/librbd/io/ReadResult.h [ commit 786ea203a283 ("librbd,
+ tools: migrate from boost::variant to std::variant") not in
+ squid ]
================================================================================
RANGE DIFF
================================================================================
1: bd2204f7283 ! 1: 4c453822a86 librbd: avoid losing sparseness in read_parent()
@@ Commit message
Fixes: https://tracker.ceph.com/issues/73831
Signed-off-by: Ilya Dryomov <[email protected]>
+ (cherry picked from commit bd2204f7283a30d699778834280eed908440fd62)
+
+ Conflicts:
+ src/librbd/io/ReadResult.h [ commit 786ea203a283 ("librbd,
+ tools: migrate from boost::variant to std::variant") not in
+ squid ]
## src/librbd/io/ReadResult.cc ##
-@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor {
+@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor : public boost::static_visitor<void> {
sbl.image_extents = image_extents;
}
@@ src/librbd/io/ReadResult.cc: struct ReadResult::SetImageExtentsVisitor {
template <typename T>
void operator()(T &t) const {
}
-@@ src/librbd/io/ReadResult.cc: struct ReadResult::AssembleResultVisitor {
+@@ src/librbd/io/ReadResult.cc: struct ReadResult::AssembleResultVisitor : public boost::static_visitor<void> {
<< " bytes to bl "
<< reinterpret_cast<void*>(sparse_bufferlist.bl) << dendl;
}
@@ src/librbd/io/ReadResult.cc: ReadResult::ReadResult(Extents* extent_map, ceph::b
+}
+
void ReadResult::set_image_extents(const Extents& image_extents) {
- std::visit(SetImageExtentsVisitor(image_extents), m_buffer);
+ boost::apply_visitor(SetImageExtentsVisitor(image_extents), m_buffer);
}
## src/librbd/io/ReadResult.h ##
@@ src/librbd/io/ReadResult.h: private:
+ }
+ };
+
- typedef std::variant<std::monostate,
- Linear,
- Vector,
- Bufferlist,
-- SparseBufferlist> Buffer;
-+ SparseBufferlist,
-+ ChildObject> Buffer;
+ typedef boost::variant<Empty,
+ Linear,
+ Vector,
+ Bufferlist,
+- SparseBufferlist> Buffer;
++ SparseBufferlist,
++ ChildObject> Buffer;
struct SetImageExtentsVisitor;
struct AssembleResultVisitor;
Commit Parity Visualizer
| BACKPORT PR #68462 | SOURCE PR | SOURCE STATUS |
|---|---|---|
| 4c45382 librbd: avoid losing sparseness in read_parent() | PR #68202 | bd2204f librbd: avoid losing sparseness in read_parent() |
| 4ebe382 librbd: tweak ReadResult's handler for SparseBufferlist type | aad0285 librbd: tweak ReadResult's handler for SparseBufferlist type |
🛟 Need Help?
If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.
📋 Component Lead / Release Manager
To override the audit failure, apply releng-audit-override label or comment /audit override.
When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.
CI Run Log: View Workflow Details
|
This PR has been added to wip-yuri7-testing-20260521.154841-squid. |
backport tracker: https://tracker.ceph.com/issues/76087
backport of #68202
parent tracker: https://tracker.ceph.com/issues/73831