From 66827facc3aec2e9ebad890f42c9126c88dfe705 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Mon, 3 Aug 2020 23:58:52 +0530 Subject: [PATCH] cephfs: make use of expand operation lock in ControllerExpandVolume Signed-off-by: Humble Chirammal --- internal/cephfs/controllerserver.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/cephfs/controllerserver.go b/internal/cephfs/controllerserver.go index d6d0a8ad7..675f157d6 100644 --- a/internal/cephfs/controllerserver.go +++ b/internal/cephfs/controllerserver.go @@ -269,6 +269,13 @@ func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi } 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) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error())