blob: allow bdev_lvol_set_parent when child has more clusters than parent#73
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR relaxes the blob parent/child size constraint in spdk_bs_blob_set_parent() so a thin-provisioned child blob may be reparented to a snapshot with fewer clusters (child ≥ parent), which is a scenario encountered by Longhorn during rebuild and is already handled by the I/O path.
Changes:
- Update the parent/child cluster-count validation to only reject the semantically invalid case where the child has fewer clusters than the parent snapshot.
- Update the associated error log text (noting: the new log message currently doesn’t match the new condition and should be corrected).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
shuo-wu
force-pushed
the
master
branch
3 times, most recently
from
June 11, 2026 00:22
1552a5c to
2051513
Compare
…rent The I/O path already handles parent < child correctly: - blob_bs_dev_read zeros trailing bytes beyond the parent blockcnt - blob_bs_is_range_valid returns false for out-of-range clusters - bdev_lvol_snapshot already creates this parent < child relationship when snapshotting a resized lvol Relax the check to only reject child < parent (which would be semantically invalid), allowing child >= parent as a valid reparenting operation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Shuo Wu <shuo.wu@suse.com>
Comment on lines
+925
to
+928
| * The blob must have at least as many clusters as the parent snapshot | ||
| * (child cluster count >= parent cluster count). A child with more clusters | ||
| * than the parent is valid; reads beyond the parent range return zeros via | ||
| * thin provisioning. |
Comment on lines
+10456
to
+10459
| /* Call set_parent with blob that has more clusters than snapshot (child > parent, now succeeds) */ | ||
| spdk_bs_blob_set_parent(bs, blobid2, snapshotid1, blob_op_complete, NULL); | ||
| poll_threads(); | ||
| CU_ASSERT(g_bserrno == -EINVAL); | ||
| CU_ASSERT(g_bserrno == 0); |
derekbit
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The I/O path already handles parent < child correctly:
Relax the check to only reject child < parent (which would be semantically invalid), allowing child >= parent as a valid reparenting operation, as the Longhorn SPDK server will encounter this case during rebuild.
Which issue(s) this PR fixes:
Issue longhorn/longhorn#12552
What this PR does / why we need it:
Special notes for your reviewer:
Additional documentation or context