diff mbox series

add credits we receive from oplock/break PDUs

Message ID 20190123062038.18207-1-lsahlber@redhat.com (mailing list archive)
State New, archived
Headers show
Series add credits we receive from oplock/break PDUs | expand

Commit Message

Ronnie Sahlberg Jan. 23, 2019, 6:20 a.m. UTC
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2misc.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Pavel Shilovsky Jan. 23, 2019, 9:12 p.m. UTC | #1
вт, 22 янв. 2019 г. в 22:24, Ronnie Sahlberg <lsahlber@redhat.com>:
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/smb2misc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
> index 6a9c47541c53..7b8b58fb4d3f 100644
> --- a/fs/cifs/smb2misc.c
> +++ b/fs/cifs/smb2misc.c
> @@ -648,6 +648,13 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
>         if (rsp->sync_hdr.Command != SMB2_OPLOCK_BREAK)
>                 return false;
>
> +       if (rsp->sync_hdr.CreditRequest) {
> +               spin_lock(&server->req_lock);
> +               server->credits += le16_to_cpu(rsp->sync_hdr.CreditRequest);
> +               spin_unlock(&server->req_lock);
> +               wake_up(&server->request_q);
> +       }
> +
>         if (rsp->StructureSize !=
>                                 smb2_rsp_struct_sizes[SMB2_OPLOCK_BREAK_HE]) {
>                 if (le16_to_cpu(rsp->StructureSize) == 44)
> --
> 2.13.6
>

Looks good, thanks!

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky
diff mbox series

Patch

diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 6a9c47541c53..7b8b58fb4d3f 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -648,6 +648,13 @@  smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
 	if (rsp->sync_hdr.Command != SMB2_OPLOCK_BREAK)
 		return false;
 
+	if (rsp->sync_hdr.CreditRequest) {
+		spin_lock(&server->req_lock);
+		server->credits += le16_to_cpu(rsp->sync_hdr.CreditRequest);
+		spin_unlock(&server->req_lock);
+		wake_up(&server->request_q);
+	}
+
 	if (rsp->StructureSize !=
 				smb2_rsp_struct_sizes[SMB2_OPLOCK_BREAK_HE]) {
 		if (le16_to_cpu(rsp->StructureSize) == 44)