Skip to content

Commit

Permalink
rbd: fix cleanup of GroupSnapRollback and Sparsify progress callbacks
Browse files Browse the repository at this point in the history
Instead of removing a respective progress callback, DiffIterate extent
callback is attempted to be removed.  This leaks the progress callback
and on top of that it's quite possible for DiffIterate to be disrupted
as cbIndex is not a unique pointer but just an integer ID.

Signed-off-by: Ilya Dryomov <[email protected]>
  • Loading branch information
idryomov authored and mergify[bot] committed Jan 29, 2025
1 parent d284200 commit df352fd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rbd/group_snap.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func GroupSnapRollbackWithProgress(
data: data,
}
cbIndex := groupSnapRollbackCallbacks.Add(ctx)
defer diffIterateCallbacks.Remove(cbIndex)
defer groupSnapRollbackCallbacks.Remove(cbIndex)

ret := C.wrap_rbd_group_snap_rollback_with_progress(
cephIoctx(ioctx),
Expand Down
2 changes: 1 addition & 1 deletion rbd/sparsify.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (image *Image) SparsifyWithProgress(
data: data,
}
cbIndex := sparsifyCallbacks.Add(ctx)
defer diffIterateCallbacks.Remove(cbIndex)
defer sparsifyCallbacks.Remove(cbIndex)

ret := C.wrap_rbd_sparsify_with_progress(image.image, C.size_t(sparseSize), C.uintptr_t(cbIndex))

Expand Down

0 comments on commit df352fd

Please sign in to comment.