Skip to contentSkip to conversation

Call echo service immediately after socket reconnect

PATCH In review Pavel Shilovsky 2 participants 5 messages Jun 5, 2017 – Jun 12, 2017 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Call echo service immediately after socket reconnect

From: Sachin Prabhu <[email protected]>

Commit b8c600120fc8 ("Call echo service immediately after socket reconnect") upstream.

Commit 4fcd1813e640 ("Fix reconnect to not defer smb3 session reconnect long after socket reconnect") changes the behaviour of the SMB2 echo service and causes it to renegotiate after a socket reconnect. However under default settings, the echo service could take up to 120 seconds to be scheduled.

The patch forces the echo service to be called immediately resulting a negotiate call being made immediately on reconnect.

---
 fs/cifs/connect.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
fs/cifs/connect.c +18 -6
index 156bc18..53a827c 100644
@@ -412,6 +412,9 @@ cifs_reconnect(struct TCP_Server_Info *server)
 		}
 	} while (server->tcpStatus == CifsNeedReconnect);
 
+	if (server->tcpStatus == CifsNeedNegotiate)
+		mod_delayed_work(cifsiod_wq, &server->echo, 0);
+
 	return rc;
 }
 
@@ -421,18 +424,27 @@ cifs_echo_request(struct work_struct *work)
 	int rc;
 	struct TCP_Server_Info *server = container_of(work,
 					struct TCP_Server_Info, echo.work);
+	unsigned long echo_interval;
+
+	/*
+	 * If we need to renegotiate, set echo interval to zero to
+	 * immediately call echo service where we can renegotiate.
+	 */
+	if (server->tcpStatus == CifsNeedNegotiate)
+		echo_interval = 0;
+	else
+		echo_interval = SMB_ECHO_INTERVAL;
 
 	/*
-	 * We cannot send an echo if it is disabled or until the
-	 * NEGOTIATE_PROTOCOL request is done, which is indicated by
-	 * server->ops->need_neg() == true. Also, no need to ping if
-	 * we got a response recently.
+	 * We cannot send an echo if it is disabled.
+	 * Also, no need to ping if we got a response recently.
 	 */
 
 	if (server->tcpStatus == CifsNeedReconnect ||
-	    server->tcpStatus == CifsExiting || server->tcpStatus == CifsNew ||
+	    server->tcpStatus == CifsExiting ||
+	    server->tcpStatus == CifsNew ||
 	    (server->ops->can_echo && !server->ops->can_echo(server)) ||
-	    time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ))
+	    time_before(jiffies, server->lstrp + echo_interval - HZ))
 		goto requeue_echo;
 
 	rc = server->ops->echo ? server->ops->echo(server) : -ENOSYS;
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 14 lines · Pavel Shilovsky

From: Sachin Prabhu <[email protected]>

Commit b8c600120fc8 ("Call echo service immediately after socket reconnect") upstream.

Commit 4fcd1813e640 ("Fix reconnect to not defer smb3 session reconnect long after socket reconnect") changes the behaviour of the SMB2 echo service and causes it to renegotiate after a socket reconnect. However under default settings, the echo service could take up to 120 seconds to be scheduled.

The patch forces the echo service to be called immediately resulting a negotiate call being made immediately on reconnect.

Quoted 8 lines
---
 fs/cifs/connect.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

What stable tree(s) do you want this applied to? Please be specific like the documentation tells you to do :)

And CIFS maintainers, come on, your subject lines for patches suck, please use a prefix like _everyone_ else does to make it more obvious what part of the kernel is being touched.

thanks,

greg k-h

#2 lore raw

2017-06-12 5:30 GMT-07:00 Greg KH <[email protected]>:

Quoted 24 lines · Pavel Shilovsky
Quoted 14 lines

From: Sachin Prabhu <[email protected]>

Commit b8c600120fc8 ("Call echo service immediately after socket reconnect") upstream.

Commit 4fcd1813e640 ("Fix reconnect to not defer smb3 session reconnect long after socket reconnect") changes the behaviour of the SMB2 echo service and causes it to renegotiate after a socket reconnect. However under default settings, the echo service could take up to 120 seconds to be scheduled.

The patch forces the echo service to be called immediately resulting a negotiate call being made immediately on reconnect.

Quoted 8 lines
---
 fs/cifs/connect.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
Quoted 6 lines

What stable tree(s) do you want this applied to? Please be specific like the documentation tells you to do :)

And CIFS maintainers, come on, your subject lines for patches suck, please use a prefix like _everyone_ else does to make it more obvious what part of the kernel is being touched.

This patch is targeted for kernels below v4.9, in particular - for v4.4 and v3.18 stable kernels. Do you want me to re-send the patch to comply with the documentation?

--
Best regards,
Pavel Shilovsky

maintainer
#3 lore raw
Quoted 28 lines · Pavel Shilovskiy

2017-06-12 5:30 GMT-07:00 Greg KH <[email protected]>:

Quoted 27 lines · Pavel Shilovsky
Quoted 14 lines

From: Sachin Prabhu <[email protected]>

Commit b8c600120fc8 ("Call echo service immediately after socket reconnect") upstream.

Commit 4fcd1813e640 ("Fix reconnect to not defer smb3 session reconnect long after socket reconnect") changes the behaviour of the SMB2 echo service and causes it to renegotiate after a socket reconnect. However under default settings, the echo service could take up to 120 seconds to be scheduled.

The patch forces the echo service to be called immediately resulting a negotiate call being made immediately on reconnect.

Quoted 8 lines
---
 fs/cifs/connect.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

What stable tree(s) do you want this applied to? Please be specific like the documentation tells you to do :)

Quoted 7 lines
Quoted 3 lines

And CIFS maintainers, come on, your subject lines for patches suck, please use a prefix like _everyone_ else does to make it more obvious what part of the kernel is being touched.

This patch is targeted for kernels below v4.9, in particular - for v4.4 and v3.18 stable kernels. Do you want me to re-send the patch to comply with the documentation?

Please do.

#4 lore raw

2017-06-12 12:16 GMT-07:00 Greg KH <[email protected]>:

Quoted 33 lines · Pavel Shilovskiy
Quoted 32 lines

2017-06-12 5:30 GMT-07:00 Greg KH <[email protected]>:

Quoted 30 lines · Pavel Shilovsky
Quoted 14 lines

From: Sachin Prabhu <[email protected]>

Commit b8c600120fc8 ("Call echo service immediately after socket reconnect") upstream.

Commit 4fcd1813e640 ("Fix reconnect to not defer smb3 session reconnect long after socket reconnect") changes the behaviour of the SMB2 echo service and causes it to renegotiate after a socket reconnect. However under default settings, the echo service could take up to 120 seconds to be scheduled.

The patch forces the echo service to be called immediately resulting a negotiate call being made immediately on reconnect.

Quoted 8 lines
---
 fs/cifs/connect.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

What stable tree(s) do you want this applied to? Please be specific like the documentation tells you to do :)

And CIFS maintainers, come on, your subject lines for patches suck, please use a prefix like _everyone_ else does to make it more obvious what part of the kernel is being touched.

Quoted 5 lines
Quoted 3 lines

This patch is targeted for kernels below v4.9, in particular - for v4.4 and v3.18 stable kernels. Do you want me to re-send the patch to comply with the documentation?

Please do.

Done. I specified the targeted kernels as a range (Cc: <[email protected]> # 3.18.x-4.4.x). Please let me know if I need to be more specific and specify particular versions instead.

--
Best regards,
Pavel Shilovsky