Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove global attach/detach mutex #69

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions pkg/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package driver
import (
"context"
"strconv"
"sync"

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

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

d.mux.Lock()
defer d.mux.Unlock()
if err := d.scaleway.DetachVolume(ctx, volumeID, volumeZone); err != nil {
return nil, status.Errorf(codes.Internal, "failed to detach volume: %s", err)
}
Expand Down
Loading