linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: detect dead connections only when echoes are enabled.
@ 2021-04-29  8:12 Shyam Prasad N
  2021-04-29 11:46 ` Aurélien Aptel
  0 siblings, 1 reply; 7+ messages in thread
From: Shyam Prasad N @ 2021-04-29  8:12 UTC (permalink / raw)
  To: Steve French, CIFS, Pavel Shilovsky, Aurélien Aptel

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

Hi,

Recently, some xfstests and later some manual testing on multi-channel
revealed that we detect unresponsive servers on some of the channels
to the same server.

The issue is seen when a channel is setup and sits idle without any
traffic. Generally, we enable echoes and oplocks on a channel during
the first request, based on the number of credits available on the
channel. So on idle channels, we trip in our logic to check server
unresponsiveness.

Attached a one-line fix for this. Have tested it in my environment.
Another approach to fix this could be to enable echoes during
initialization of a server struct. Or soon after the session setup.
But I felt that this approach is better. Let me know if you feel
otherwise.

Please review and comment.

-- 
Regards,
Shyam

[-- Attachment #2: 0001-cifs-detect-dead-connections-only-when-echoes-are-en.patch --]
[-- Type: application/octet-stream, Size: 1286 bytes --]

From dc604e09eadf0603e2f3ddc7eeee0f81e8d5652c Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Thu, 29 Apr 2021 07:53:18 +0000
Subject: [PATCH] cifs: detect dead connections only when echoes are enabled.

We can detect server unresponsiveness only if echoes are enabled.
Echoes can be disabled under two scenarios:
1. The connection is low on credits, so we've disabled echoes/oplocks.
2. The connection has not seen any request till now (other than
negotiate/sess-setup), which is when we enable these two, based on
the credits available.

So this fix will check for dead connection, only when echo is enabled.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
 fs/cifs/connect.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 121d8b4535b0..d430e57e74bc 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -476,6 +476,7 @@ server_unresponsive(struct TCP_Server_Info *server)
 	 */
 	if ((server->tcpStatus == CifsGood ||
 	    server->tcpStatus == CifsNeedNegotiate) &&
+		server->echoes &&
 	    time_after(jiffies, server->lstrp + 3 * server->echo_interval)) {
 		cifs_server_dbg(VFS, "has not responded in %lu seconds. Reconnecting...\n",
 			 (3 * server->echo_interval) / HZ);
-- 
2.25.1


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

end of thread, other threads:[~2021-05-01 16:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29  8:12 [PATCH] cifs: detect dead connections only when echoes are enabled Shyam Prasad N
2021-04-29 11:46 ` Aurélien Aptel
2021-04-29 12:29   ` Shyam Prasad N
2021-04-29 15:47     ` Shyam Prasad N
2021-04-29 17:37       ` Steve French
2021-04-29 18:52       ` Steve French
2021-05-01 16:40         ` Shyam Prasad N

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).