]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
cifs: detect dead connections only when echoes are enabled.
authorShyam Prasad N <sprasad@microsoft.com>
Thu, 29 Apr 2021 07:53:18 +0000 (07:53 +0000)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 19 May 2021 08:31:55 +0000 (10:31 +0200)
BugLink: https://bugs.launchpad.net/bugs/1928857
commit f4916649f98e2c7bdba38c6597a98c456c17317d upstream.

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>
CC: <stable@vger.kernel.org> # v5.8+
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/cifs/connect.c

index 2b72b8893affa594e87c29075cedd66f5e512010..832b8b5b44370c3611e361938ae90a1b3c4cf168 100644 (file)
@@ -488,6 +488,7 @@ server_unresponsive(struct TCP_Server_Info *server)
         */
        if ((server->tcpStatus == CifsGood ||
            server->tcpStatus == CifsNeedNegotiate) &&
+           (!server->ops->can_echo || server->ops->can_echo(server)) &&
            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);