From 3ba1822ee5d0d8eb67971d549ad6129a7a54dd16 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Wed, 29 Jan 2025 11:52:28 +0100 Subject: [PATCH] rbd: fix cleanup of GroupSnapRollback and Sparsify progress callbacks 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 --- rbd/group_snap.go | 2 +- rbd/sparsify.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rbd/group_snap.go b/rbd/group_snap.go index a9994b9d9..ce21499a1 100644 --- a/rbd/group_snap.go +++ b/rbd/group_snap.go @@ -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), diff --git a/rbd/sparsify.go b/rbd/sparsify.go index 7435a1571..13a9dd948 100644 --- a/rbd/sparsify.go +++ b/rbd/sparsify.go @@ -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))