Skip to content

Commit da008b4

Browse files
authored
feat: remove global attach/detach mutex (#69)
1 parent c359bc2 commit da008b4

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

pkg/driver/controller.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package driver
33
import (
44
"context"
55
"strconv"
6-
"sync"
76

87
"github.com/container-storage-interface/spec/lib/go/csi"
98
"github.com/scaleway/scaleway-csi/pkg/scaleway"
@@ -61,8 +60,6 @@ var _ csi.ControllerServer = &controllerService{}
6160
type controllerService struct {
6261
scaleway scaleway.Interface
6362
config *DriverConfig
64-
// Global attach/detach mutex.
65-
mux sync.Mutex
6663
// Volume locks ensures we don't run parallel operations on volumes (e.g.
6764
// detaching a volume and taking a snapshot).
6865
locks namedlocker.Store
@@ -220,8 +217,6 @@ func (d *controllerService) ControllerPublishVolume(ctx context.Context, req *cs
220217
return nil, status.Errorf(codes.ResourceExhausted, "max number of volumes reached for instance %s", nodeID)
221218
}
222219

223-
d.mux.Lock()
224-
defer d.mux.Unlock()
225220
if err := d.scaleway.AttachVolume(ctx, nodeID, volumeID, volumeZone); err != nil {
226221
return nil, status.Errorf(codes.Internal, "failed to attach volume to instance: %s", err)
227222
}
@@ -273,8 +268,6 @@ func (d *controllerService) ControllerUnpublishVolume(ctx context.Context, req *
273268
return nil, status.Errorf(code, "failed to get server where to unpublish volume: %s", err)
274269
}
275270

276-
d.mux.Lock()
277-
defer d.mux.Unlock()
278271
if err := d.scaleway.DetachVolume(ctx, volumeID, volumeZone); err != nil {
279272
return nil, status.Errorf(codes.Internal, "failed to detach volume: %s", err)
280273
}

0 commit comments

Comments
 (0)