@@ -458,8 +458,10 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
458458 execFunc := func () error {
459459 return SMBMount (d .mounter , source , cifsMountPath , mountFsType , mountOptions , sensitiveMountOptions )
460460 }
461- timeoutFunc := func () error { return fmt .Errorf ("time out" ) }
462- if err := volumehelper .WaitUntilTimeout (90 * time .Second , execFunc , timeoutFunc ); err != nil {
461+ timeoutFunc := func () error {
462+ return fmt .Errorf ("mount operation timed out after %d seconds: source=%s, target=%s" , MountTimeoutInSec , source , cifsMountPath )
463+ }
464+ if err := volumehelper .WaitUntilTimeout (MountTimeoutInSec * time .Second , execFunc , timeoutFunc ); err != nil {
463465 var helpLinkMsg string
464466 if d .appendMountErrorHelpLink {
465467 helpLinkMsg = "\n Please refer to http://aka.ms/filemounterror for possible causes and solutions for mount errors."
@@ -772,7 +774,6 @@ func (d *Driver) mountWithProxy(ctx context.Context, source, target, fsType stri
772774 klog .Error ("failed to close connection to azurefile proxy:" , err )
773775 }
774776 }()
775- klog .V (2 ).Infof ("connected to azurefile proxy successfully" )
776777
777778 mountClient := NewMountClient (conn )
778779 mountreq := mount_azurefile.MountAzureFileRequest {
@@ -783,12 +784,19 @@ func (d *Driver) mountWithProxy(ctx context.Context, source, target, fsType stri
783784 SensitiveOptions : sensitiveMountOptions ,
784785 }
785786 klog .V (2 ).Infof ("begin to mount with azurefile proxy, source: %s, target: %s, fstype: %s, mountOptions: %v" , source , target , fsType , options )
786- _ , err = mountClient .service .MountAzureFile (ctx , & mountreq )
787- if err != nil {
788- klog .Error ("GRPC call returned with an error:" , err )
787+ newCtx , cancel := context .WithTimeout (ctx , MountTimeoutInSec * time .Second )
788+ defer cancel ()
789+ execFunc := func () error {
790+ _ , err := mountClient .service .MountAzureFile (newCtx , & mountreq )
789791 return err
790792 }
793+ timeoutFunc := func () error {
794+ return fmt .Errorf ("mount with azurefile proxy timed out after %d seconds: source=%s, target=%s" , MountTimeoutInSec , source , target )
795+ }
791796
797+ if err = volumehelper .WaitUntilTimeout (MountTimeoutInSec * time .Second , execFunc , timeoutFunc ); err != nil {
798+ klog .Error ("GRPC call returned with an error:" , err )
799+ }
792800 return err
793801}
794802
0 commit comments