@@ -229,10 +229,11 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
229
229
return nil , status .Error (codes .InvalidArgument , "Volume capability not provided" )
230
230
}
231
231
232
- if acquired := d .volumeLocks .TryAcquire (volumeID ); ! acquired {
232
+ lockKey := fmt .Sprintf ("%s-%s" , volumeID , targetPath )
233
+ if acquired := d .volumeLocks .TryAcquire (lockKey ); ! acquired {
233
234
return nil , status .Errorf (codes .Aborted , volumeOperationAlreadyExistsFmt , volumeID )
234
235
}
235
- defer d .volumeLocks .Release (volumeID )
236
+ defer d .volumeLocks .Release (lockKey )
236
237
237
238
mountFlags := req .GetVolumeCapability ().GetMount ().GetMountFlags ()
238
239
attrib := req .GetVolumeContext ()
@@ -437,10 +438,11 @@ func (d *Driver) NodeUnstageVolume(_ context.Context, req *csi.NodeUnstageVolume
437
438
return nil , status .Error (codes .InvalidArgument , "Staging target not provided" )
438
439
}
439
440
440
- if acquired := d .volumeLocks .TryAcquire (volumeID ); ! acquired {
441
+ lockKey := fmt .Sprintf ("%s-%s" , volumeID , stagingTargetPath )
442
+ if acquired := d .volumeLocks .TryAcquire (lockKey ); ! acquired {
441
443
return nil , status .Errorf (codes .Aborted , volumeOperationAlreadyExistsFmt , volumeID )
442
444
}
443
- defer d .volumeLocks .Release (volumeID )
445
+ defer d .volumeLocks .Release (lockKey )
444
446
445
447
klog .V (2 ).Infof ("NodeUnstageVolume: volume %s unmounting on %s" , volumeID , stagingTargetPath )
446
448
err := mount .CleanupMountPoint (stagingTargetPath , d .mounter , true /*extensiveMountPointCheck*/ )
0 commit comments