Skip to content

Commit 41d995b

Browse files
kaovilaiclaudehappy-otter
committed
rbd: fix DiffIterateByID Length to exclude startingOffset
The Length parameter in DiffIterateByIDConfig was set to the full VolSize, but rbd_diff_iterate3 treats len as the number of bytes to scan from ofs. When startingOffset > 0, this caused the scan range to extend past the image end (scanning [startingOffset, startingOffset + VolSize) instead of [startingOffset, VolSize)). Fix by subtracting startingOffset from VolSize to get the correct scan length. Ref: kaovilai/cephcsi-cbt-e2e#2 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering> Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
1 parent b2f6300 commit 41d995b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/rbd/snap_diff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (rbdSnap *rbdSnapshot) ProcessMetadata(
9898
)
9999
diffIterateByIDConfig := librbd.DiffIterateByIDConfig{
100100
Offset: uint64(startingOffset),
101-
Length: uint64(rbdSnap.VolSize),
101+
Length: uint64(rbdSnap.VolSize) - uint64(startingOffset),
102102
Callback: cb,
103103
}
104104
if baseSnap != nil {

0 commit comments

Comments
 (0)