mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-18 02:39:30 +00:00
rbd: free snapshot resources after allocation
Not all snapshot objects are free'd correctly after they were allocated. It is possible that some connections to the Ceph cluster were never closed. This does not need to be a noticeable problem, as connections are re-used where possible, but it isn't clean either. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
694672b154
commit
8b959f2b6d
@ -348,6 +348,12 @@ func (cs *ControllerServer) CreateVolume(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if parentVol != nil {
|
||||||
|
defer parentVol.Destroy()
|
||||||
|
}
|
||||||
|
if rbdSnap != nil {
|
||||||
|
defer rbdSnap.Destroy()
|
||||||
|
}
|
||||||
|
|
||||||
err = updateTopologyConstraints(rbdVol, rbdSnap)
|
err = updateTopologyConstraints(rbdVol, rbdSnap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -655,6 +661,7 @@ func (cs *ControllerServer) createVolumeFromSnapshot(
|
|||||||
|
|
||||||
return status.Error(codes.Internal, err.Error())
|
return status.Error(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
defer rbdSnap.Destroy()
|
||||||
|
|
||||||
// update parent name(rbd image name in snapshot)
|
// update parent name(rbd image name in snapshot)
|
||||||
rbdSnap.RbdImageName = rbdSnap.RbdSnapName
|
rbdSnap.RbdImageName = rbdSnap.RbdSnapName
|
||||||
@ -1458,6 +1465,7 @@ func (cs *ControllerServer) DeleteSnapshot(
|
|||||||
|
|
||||||
return nil, status.Error(codes.Internal, err.Error())
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
defer rbdSnap.Destroy()
|
||||||
|
|
||||||
// safeguard against parallel create or delete requests against the same
|
// safeguard against parallel create or delete requests against the same
|
||||||
// name
|
// name
|
||||||
|
Loading…
Reference in New Issue
Block a user