@@ -240,10 +240,11 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
240240 return nil , status .Errorf (codes .InvalidArgument , "fsGroupChangePolicy(%s) is not supported, supported fsGroupChangePolicy list: %v" , fsGroupChangePolicy , supportedFSGroupChangePolicyList )
241241 }
242242
243- if acquired := d .volumeLocks .TryAcquire (volumeID ); ! acquired {
243+ lockKey := fmt .Sprintf ("%s-%s" , volumeID , targetPath )
244+ if acquired := d .volumeLocks .TryAcquire (lockKey ); ! acquired {
244245 return nil , status .Errorf (codes .Aborted , volumeOperationAlreadyExistsFmt , volumeID )
245246 }
246- defer d .volumeLocks .Release (volumeID )
247+ defer d .volumeLocks .Release (lockKey )
247248
248249 if strings .TrimSpace (storageEndpointSuffix ) == "" {
249250 if d .cloud .Environment .StorageEndpointSuffix != "" {
@@ -393,10 +394,11 @@ func (d *Driver) NodeUnstageVolume(_ context.Context, req *csi.NodeUnstageVolume
393394 return nil , status .Error (codes .InvalidArgument , "Staging target not provided" )
394395 }
395396
396- if acquired := d .volumeLocks .TryAcquire (volumeID ); ! acquired {
397+ lockKey := fmt .Sprintf ("%s-%s" , volumeID , stagingTargetPath )
398+ if acquired := d .volumeLocks .TryAcquire (lockKey ); ! acquired {
397399 return nil , status .Errorf (codes .Aborted , volumeOperationAlreadyExistsFmt , volumeID )
398400 }
399- defer d .volumeLocks .Release (volumeID )
401+ defer d .volumeLocks .Release (lockKey )
400402
401403 mc := metrics .NewMetricContext (azureFileCSIDriverName , "node_unstage_volume" , d .cloud .ResourceGroup , "" , d .Name )
402404 isOperationSucceeded := false
0 commit comments