You are not logged in.

#1 2019-12-10 12:11:37

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,464

[SOLVED] Is it possible to lower (if any) Linux file access timeout?

I work alot with network files (sshfs,nfs and samba).
When a share goes down, the applications trying to use files shared by it waits for undefined (read: too long for me to wait) time and it is frozen meanwhile.
Plasma, in particular freezes the whole session (maybe because it tries to reach recent files? I don't know), forcing me to restart plasmashell.

Does Linux provide a way to tell the application that the file is not available after a defined timeout, maybe telling the application that the file is just not found?

Thanks.

Last edited by kokoko3k (2019-12-11 14:51:44)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#2 2019-12-10 12:19:10

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,653
Website

Re: [SOLVED] Is it possible to lower (if any) Linux file access timeout?

I think not. At least I could not find such an environment variable.
Within the GNU C library, the function select() has a parameter to set a custom timeout:
https://www.gnu.org/software/libc/manua … 002fO.html
But this will obviously only work on source code level.


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#3 2019-12-10 12:32:28

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,462
Website

Re: [SOLVED] Is it possible to lower (if any) Linux file access timeout?

The timeout in 'select()' isn't relevant here.  That's a client side setting specifying how long it will wait if it gets *no* response.  The data provider (device, network service, etc) could respond with an error due to it's own timeout long before the client/select specified timeout value.

For example, local storage devices have their own timeout values in /sys/block/<device>/device/timeout which you can set as you wish.  If that file shows a timeout of 30s, it doesn't matter if a client program uses a select call with a 60s timeout ... it will never get to wait 60 seconds, as the system would reply with an error by 30 seconds (if it was waiting on the device).  Further, select is not likely what is used in the problematic situations - more likely it is a call to read which does not have a timeout parameter.

For cifs mounts, you'd want to check the man page as there are a few 'timeout' related options directly relevant to this question.  I've not tinkered with them myself, so I don't know which settings would best acheive the goal here, but mount options would be the place to do it.

For sshfs you'd use the 'ServerAliveInterval' interval as described in the section of the man page devoted specifically to this problem (titled "SHFS hangs after the connection was interrupted").

Last edited by Trilby (2019-12-10 12:36:52)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2019-12-11 14:51:33

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,464

Re: [SOLVED] Is it possible to lower (if any) Linux file access timeout?

Ok, thanks, i guess i've to see case by case then.


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

Board footer

Powered by FluxBB