[08/23] CIFS: Count credits for malformed error pending responses
diff mbox series

Message ID 1549051452-5968-9-git-send-email-pshilov@microsoft.com
State New
Headers show
Series
  • Improve credits and error handling on reconnects
Related show

Commit Message

Pavel Shilovsky Feb. 1, 2019, 8:03 p.m. UTC
Even if the response is malformed, we should count credits
granted by the server to avoid miscalculations and unnecessary
reconnects due to client or server bugs. If the response has
been received partially, the session will be reconnected anyway
on the next iteration of the demultiplex thread, so counting
credits for such cases shouldn't break things.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pavel Shilovsky Feb. 1, 2019, 10:28 p.m. UTC | #1
пт, 1 февр. 2019 г. в 12:04, Pavel Shilovsky <piastryyy@gmail.com>:
>
> Even if the response is malformed, we should count credits
> granted by the server to avoid miscalculations and unnecessary
> reconnects due to client or server bugs. If the response has
> been received partially, the session will be reconnected anyway
> on the next iteration of the demultiplex thread, so counting
> credits for such cases shouldn't break things.
>
> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> ---
>  fs/cifs/smb2ops.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 49667ae..79e23c3 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -1761,7 +1761,7 @@ smb2_is_status_pending(char *buf, struct TCP_Server_Info *server, int length)
>         if (shdr->Status != STATUS_PENDING)
>                 return false;
>
> -       if (!length) {
> +       if (shdr->CreditRequest) {
>                 spin_lock(&server->req_lock);
>                 server->credits += le16_to_cpu(shdr->CreditRequest);
>                 spin_unlock(&server->req_lock);
> --
> 2.7.4
>

This is old version of the patch which has been sent together with the
new version:

"CIFS: Count SMB3 credits for malformed pending responses"

Please discard this one.

--
Best regards,
Pavel Shilovsky

Patch
diff mbox series

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 49667ae..79e23c3 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1761,7 +1761,7 @@  smb2_is_status_pending(char *buf, struct TCP_Server_Info *server, int length)
 	if (shdr->Status != STATUS_PENDING)
 		return false;
 
-	if (!length) {
+	if (shdr->CreditRequest) {
 		spin_lock(&server->req_lock);
 		server->credits += le16_to_cpu(shdr->CreditRequest);
 		spin_unlock(&server->req_lock);