@@ -230,10 +230,11 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
230
230
return nil , status .Error (codes .InvalidArgument , "Volume capability not provided" )
231
231
}
232
232
233
- if acquired := d .volumeLocks .TryAcquire (volumeID ); ! acquired {
233
+ lockKey := fmt .Sprintf ("%s-%s" , volumeID , targetPath )
234
+ if acquired := d .volumeLocks .TryAcquire (lockKey ); ! acquired {
234
235
return nil , status .Errorf (codes .Aborted , volumeOperationAlreadyExistsFmt , volumeID )
235
236
}
236
- defer d .volumeLocks .Release (volumeID )
237
+ defer d .volumeLocks .Release (lockKey )
237
238
238
239
mountFlags := req .GetVolumeCapability ().GetMount ().GetMountFlags ()
239
240
attrib := req .GetVolumeContext ()
@@ -445,10 +446,11 @@ func (d *Driver) NodeUnstageVolume(_ context.Context, req *csi.NodeUnstageVolume
445
446
return nil , status .Error (codes .InvalidArgument , "Staging target not provided" )
446
447
}
447
448
448
- if acquired := d .volumeLocks .TryAcquire (volumeID ); ! acquired {
449
+ lockKey := fmt .Sprintf ("%s-%s" , volumeID , stagingTargetPath )
450
+ if acquired := d .volumeLocks .TryAcquire (lockKey ); ! acquired {
449
451
return nil , status .Errorf (codes .Aborted , volumeOperationAlreadyExistsFmt , volumeID )
450
452
}
451
- defer d .volumeLocks .Release (volumeID )
453
+ defer d .volumeLocks .Release (lockKey )
452
454
453
455
mc := metrics .NewMetricContext (blobCSIDriverName , "node_unstage_volume" , d .cloud .ResourceGroup , "" , d .Name )
454
456
isOperationSucceeded := false
0 commit comments