cephfs: make use of expand operation lock in ControllerExpandVolume

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2020-08-03 23:58:52 +05:30 committed by mergify[bot]
parent 074feddaf3
commit 66827facc3

View File

@ -269,6 +269,13 @@ func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi
} }
defer cs.VolumeLocks.Release(volID) defer cs.VolumeLocks.Release(volID)
// lock out volumeID for clone and delete operation
if err := cs.OperationLocks.GetExpandLock(volID); err != nil {
klog.Error(util.Log(ctx, err.Error()))
return nil, status.Error(codes.Aborted, err.Error())
}
defer cs.OperationLocks.ReleaseExpandLock(volID)
cr, err := util.NewAdminCredentials(secret) cr, err := util.NewAdminCredentials(secret)
if err != nil { if err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error()) return nil, status.Error(codes.InvalidArgument, err.Error())