From 6d88e0a4c761f00bba14f9d1093f593bcb7784c7 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 30 Oct 2024 09:47:04 +0100 Subject: [PATCH] rbd: close the RBD-image after adding it to a VolumeGroup When the image is not closed, it keeps a watch open. This prevents the CSI Controller to delete the Volume, as there is still a user of it. Fixes: f9ab14e826 "rbd: check if an image is part of a group before adding it" Signed-off-by: Niels de Vos --- internal/rbd/group.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/rbd/group.go b/internal/rbd/group.go index d0a390322..701e3b47d 100644 --- a/internal/rbd/group.go +++ b/internal/rbd/group.go @@ -44,6 +44,7 @@ func (rv *rbdVolume) AddToGroup(ctx context.Context, vg types.VolumeGroup) error if err != nil { return fmt.Errorf("failed to open image %q: %w", rv, err) } + defer image.Close() info, err := image.GetGroup() if err != nil {