public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Call echo service immediately after socket reconnect
@ 2017-05-25 16:46 Pavel Shilovsky
  0 siblings, 0 replies; 6+ messages in thread
From: Pavel Shilovsky @ 2017-05-25 16:46 UTC (permalink / raw)
  To: stable; +Cc: Sachin Prabhu

From: Sachin Prabhu <sprabhu@redhat.com>

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.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Acked-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
---
 fs/cifs/connect.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 156bc18..53a827c 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -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;
-- 
2.7.4

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

* [PATCH] Call echo service immediately after socket reconnect
@ 2017-06-05 19:15 Pavel Shilovsky
  2017-06-12 12:30 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Shilovsky @ 2017-06-05 19:15 UTC (permalink / raw)
  To: stable; +Cc: Sachin Prabhu, Steve French, Pavel Shilovsky

From: Sachin Prabhu <sprabhu@redhat.com>

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.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Acked-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
---
 fs/cifs/connect.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 156bc18..53a827c 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -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;
-- 
2.7.4

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

* Re: [PATCH] Call echo service immediately after socket reconnect
  2017-06-05 19:15 [PATCH] Call echo service immediately after socket reconnect Pavel Shilovsky
@ 2017-06-12 12:30 ` Greg KH
  2017-06-12 19:08   ` Pavel Shilovskiy
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2017-06-12 12:30 UTC (permalink / raw)
  To: Pavel Shilovsky; +Cc: stable, Sachin Prabhu, Steve French, Pavel Shilovsky

On Mon, Jun 05, 2017 at 12:15:21PM -0700, Pavel Shilovsky wrote:
> From: Sachin Prabhu <sprabhu@redhat.com>
> 
> 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.
> 
> Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
> Signed-off-by: Steve French <smfrench@gmail.com>
> Acked-by: Sachin Prabhu <sprabhu@redhat.com>
> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
> ---
>  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

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

* RE: [PATCH] Call echo service immediately after socket reconnect
  2017-06-12 12:30 ` Greg KH
@ 2017-06-12 19:08   ` Pavel Shilovskiy
  2017-06-12 19:16     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Shilovskiy @ 2017-06-12 19:08 UTC (permalink / raw)
  To: Greg KH
  Cc: stable@vger.kernel.org, Sachin Prabhu, Steve French,
	Pavel Shilovsky

2017-06-12 5:30 GMT-07:00 Greg KH <gregkh@linuxfoundation.org>:
> On Mon, Jun 05, 2017 at 12:15:21PM -0700, Pavel Shilovsky wrote:
>> From: Sachin Prabhu <sprabhu@redhat.com>
>>
>> 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.
>>
>> Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
>> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
>> Signed-off-by: Steve French <smfrench@gmail.com>
>> Acked-by: Sachin Prabhu <sprabhu@redhat.com>
>> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
>> ---
>>  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.

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

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

* Re: [PATCH] Call echo service immediately after socket reconnect
  2017-06-12 19:08   ` Pavel Shilovskiy
@ 2017-06-12 19:16     ` Greg KH
  2017-06-12 19:44       ` Pavel Shilovskiy
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2017-06-12 19:16 UTC (permalink / raw)
  To: Pavel Shilovskiy
  Cc: stable@vger.kernel.org, Sachin Prabhu, Steve French,
	Pavel Shilovsky

On Mon, Jun 12, 2017 at 07:08:51PM +0000, Pavel Shilovskiy wrote:
> 2017-06-12 5:30 GMT-07:00 Greg KH <gregkh@linuxfoundation.org>:
> > On Mon, Jun 05, 2017 at 12:15:21PM -0700, Pavel Shilovsky wrote:
> >> From: Sachin Prabhu <sprabhu@redhat.com>
> >>
> >> 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.
> >>
> >> Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
> >> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
> >> Signed-off-by: Steve French <smfrench@gmail.com>
> >> Acked-by: Sachin Prabhu <sprabhu@redhat.com>
> >> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
> >> ---
> >>  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.
> 
> 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.

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

* RE: [PATCH] Call echo service immediately after socket reconnect
  2017-06-12 19:16     ` Greg KH
@ 2017-06-12 19:44       ` Pavel Shilovskiy
  0 siblings, 0 replies; 6+ messages in thread
From: Pavel Shilovskiy @ 2017-06-12 19:44 UTC (permalink / raw)
  To: Greg KH
  Cc: stable@vger.kernel.org, Sachin Prabhu, Steve French,
	Pavel Shilovsky

2017-06-12 12:16 GMT-07:00 Greg KH <gregkh@linuxfoundation.org>:
> On Mon, Jun 12, 2017 at 07:08:51PM +0000, Pavel Shilovskiy wrote:
>> 2017-06-12 5:30 GMT-07:00 Greg KH <gregkh@linuxfoundation.org>:
>> > On Mon, Jun 05, 2017 at 12:15:21PM -0700, Pavel Shilovsky wrote:
>> >> From: Sachin Prabhu <sprabhu@redhat.com>
>> >>
>> >> 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.
>> >>
>> >> Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
>> >> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
>> >> Signed-off-by: Steve French <smfrench@gmail.com>
>> >> Acked-by: Sachin Prabhu <sprabhu@redhat.com>
>> >> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
>> >> ---
>> >>  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.
>>
>> 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: <stable@vger.kernel.org> # 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

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

end of thread, other threads:[~2017-06-12 19:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-05 19:15 [PATCH] Call echo service immediately after socket reconnect Pavel Shilovsky
2017-06-12 12:30 ` Greg KH
2017-06-12 19:08   ` Pavel Shilovskiy
2017-06-12 19:16     ` Greg KH
2017-06-12 19:44       ` Pavel Shilovskiy
  -- strict thread matches above, loose matches on Subject: below --
2017-05-25 16:46 Pavel Shilovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox