linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to automatically drop unresponsive CIFS /SMB connections
@ 2024-02-03 22:48 R. Diez
  2024-02-04 23:26 ` Lucy Kueny
  0 siblings, 1 reply; 5+ messages in thread
From: R. Diez @ 2024-02-03 22:48 UTC (permalink / raw)
  To: linux-cifs

Hi all:

I have been mounting Windows shares for years with this script, which just boils down to "sudo mount -t cifs":

https://github.com/rdiez/Tools/blob/master/MountWindowsShares/mount-windows-shares-sudo.sh

I noticed under Linux that some applications (like Emacs), the desktop's file manager (like Caja) or even the whole desktop sometimes hang for a number of seconds. It is very annoying. It turns out the reason is that the hanging software is trying to look at a file or a directory on an unresponsive CIFS / SMB mount.

The easiest way to reproduce this issue is from outside the office: I start the VPN, connect to the Windows shares, and then tear down the VPN.

I have tried mount option "echo_interval=4", but that does not really help. The Kernel does seem to notice more quickly that the connection has become unresponsive:

Feb 03 23:24:37 rdiez4 kernel: CIFS: VFS: \\192.168.1.3 has not responded in 12 seconds. Reconnecting...

The trouble is, it tries to reconnect automatically. That means that the next application which attempts to access something under the unresponsive mount will hang again. I think the pauses last 10 seconds, it must be hard-coded in the CIFS Kernel code. If the application retries itself, or tries to look at more than 1 file before failing the whole operation, then the time adds up accordingly. If the shell's current directory is on such a failing path, it bugs you for a while.

What I need is for the connection to automatically drop when it becomes unresponsive, and do not retry to connect again.

Alternatively, applications should fail immediately if a connection has been deemed unresponsive in the meantime, and hasn't been successfully re-established yet.

Is there a way to achieve that behaviour?

Thanks in advance,
   rdiez

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-05 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-03 22:48 How to automatically drop unresponsive CIFS /SMB connections R. Diez
2024-02-04 23:26 ` Lucy Kueny
2024-02-05  9:07   ` R. Diez
2024-02-05 12:10     ` Lucy Kueny
2024-02-05 15:22       ` R. Diez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).