diff --git a/internal/cephfs/controllerserver.go b/internal/cephfs/controllerserver.go index 277f7fcb9..4cab838fb 100644 --- a/internal/cephfs/controllerserver.go +++ b/internal/cephfs/controllerserver.go @@ -236,6 +236,13 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol } defer cs.VolumeLocks.Release(string(volID)) + // lock out volumeID for clone and expand operation + if err := cs.OperationLocks.GetDeleteLock(req.GetVolumeId()); err != nil { + klog.Error(util.Log(ctx, err.Error())) + return nil, status.Error(codes.Aborted, err.Error()) + } + defer cs.OperationLocks.ReleaseDeleteLock(req.GetVolumeId()) + // Find the volume using the provided VolumeID volOptions, vID, err := newVolumeOptionsFromVolID(ctx, string(volID), nil, secrets) if err != nil { @@ -252,6 +259,8 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol return &csi.DeleteVolumeResponse{}, nil } + klog.Errorf(util.Log(ctx, "Error returned from newVolumeOptionsFromVolID: %v"), err) + // All errors other than ErrVolumeNotFound should return an error back to the caller if !errors.Is(err, ErrVolumeNotFound) { return nil, status.Error(codes.Internal, err.Error()) @@ -286,7 +295,7 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol } defer cr.DeleteCredentials() - if err = purgeVolume(ctx, volumeID(vID.FsSubvolName), cr, volOptions); err != nil { + if err = purgeVolume(ctx, volumeID(vID.FsSubvolName), cr, volOptions, false); err != nil { klog.Errorf(util.Log(ctx, "failed to delete volume %s: %v"), volID, err) // All errors other than ErrVolumeNotFound should return an error back to the caller if !errors.Is(err, ErrVolumeNotFound) {