From ef25a816a75d31b2787e2f763db23988868de8f7 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 13 Feb 2024 14:24:45 +0100 Subject: [PATCH] cephfs: add locks for volumegroup Adding a lock for the volumegroup so that we can take care of serializing the same requests to ensure same requests are not served in parallel. Signed-off-by: Madhu Rajanna --- internal/cephfs/controllerserver.go | 4 ++++ internal/cephfs/driver.go | 1 + 2 files changed, 5 insertions(+) diff --git a/internal/cephfs/controllerserver.go b/internal/cephfs/controllerserver.go index dac4bad3b..e6de82ea5 100644 --- a/internal/cephfs/controllerserver.go +++ b/internal/cephfs/controllerserver.go @@ -56,6 +56,10 @@ type ControllerServer struct { // A map storing all volumes/snapshots with ongoing operations. OperationLocks *util.OperationLock + // A map storing all volumes with ongoing operations so that additional operations + // for that same volume (as defined by volumegroup ID/volumegroup name) return an Aborted error + VolumeGroupLocks *util.VolumeLocks + // Cluster name ClusterName string diff --git a/internal/cephfs/driver.go b/internal/cephfs/driver.go index d0f90c1e4..dd78cf5c8 100644 --- a/internal/cephfs/driver.go +++ b/internal/cephfs/driver.go @@ -67,6 +67,7 @@ func NewControllerServer(d *csicommon.CSIDriver) *ControllerServer { DefaultControllerServer: csicommon.NewDefaultControllerServer(d), VolumeLocks: util.NewVolumeLocks(), SnapshotLocks: util.NewVolumeLocks(), + VolumeGroupLocks: util.NewVolumeLocks(), OperationLocks: util.NewOperationLock(), } }