* [PATCH 1/4] cifs: New optype for session operations.
@ 2021-02-04 8:05 Shyam Prasad N
2021-02-04 10:04 ` Aurélien Aptel
0 siblings, 1 reply; 9+ messages in thread
From: Shyam Prasad N @ 2021-02-04 8:05 UTC (permalink / raw)
To: Steve French, Pavel Shilovsky, Aurélien Aptel, CIFS
[-- Attachment #1: Type: text/plain, Size: 131 bytes --]
Tested with SMB 3.1.1 and 3.0 with and without multichannel.
Also included some review comments from Aurelien.
--
Regards,
Shyam
[-- Attachment #2: 0001-cifs-New-optype-for-session-operations.patch --]
[-- Type: application/octet-stream, Size: 2831 bytes --]
From 74418a48af50940cad30fcb8d7a6d90efeea92ea Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Wed, 3 Feb 2021 22:49:52 -0800
Subject: [PATCH 1/4] cifs: New optype for session operations.
We used to share the CIFS_NEG_OP flag between negotiate and
session authentication. There was an assumption in the code that
CIFS_NEG_OP is used by negotiate only. So introcuded CIFS_SESS_OP
and used it for session setup optypes.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
fs/cifs/cifsglob.h | 3 ++-
fs/cifs/smb2pdu.c | 2 +-
fs/cifs/transport.c | 4 ++--
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 50fcb65920e8..1a1f9f4ae80a 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1704,7 +1704,8 @@ static inline bool is_retryable_error(int error)
#define CIFS_ECHO_OP 0x080 /* echo request */
#define CIFS_OBREAK_OP 0x0100 /* oplock break request */
#define CIFS_NEG_OP 0x0200 /* negotiate request */
-#define CIFS_OP_MASK 0x0380 /* mask request type */
+#define CIFS_SESS_OP 0x2000 /* session setup request */
+#define CIFS_OP_MASK 0x2380 /* mask request type */
#define CIFS_HAS_CREDITS 0x0400 /* already has credits */
#define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index e1391bd92768..4bbb6126b14d 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1261,7 +1261,7 @@ SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data)
cifs_ses_server(sess_data->ses),
&rqst,
&sess_data->buf0_type,
- CIFS_LOG_ERROR | CIFS_NEG_OP, &rsp_iov);
+ CIFS_LOG_ERROR | CIFS_SESS_OP, &rsp_iov);
cifs_small_buf_release(sess_data->iov[0].iov_base);
memcpy(&sess_data->iov[0], &rsp_iov, sizeof(struct kvec));
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 4a2b836eb017..41223a9ee086 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -1171,7 +1171,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
/*
* Compounding is never used during session establish.
*/
- if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP))
+ if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP))
smb311_update_preauth_hash(ses, rqst[0].rq_iov,
rqst[0].rq_nvec);
@@ -1236,7 +1236,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
/*
* Compounding is never used during session establish.
*/
- if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP)) {
+ if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
struct kvec iov = {
.iov_base = resp_iov[0].iov_base,
.iov_len = resp_iov[0].iov_len
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] cifs: New optype for session operations.
2021-02-04 8:05 [PATCH 1/4] cifs: New optype for session operations Shyam Prasad N
@ 2021-02-04 10:04 ` Aurélien Aptel
2021-02-09 1:59 ` Shyam Prasad N
0 siblings, 1 reply; 9+ messages in thread
From: Aurélien Aptel @ 2021-02-04 10:04 UTC (permalink / raw)
To: Shyam Prasad N, Steve French, Pavel Shilovsky, CIFS
LGTM
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Cheers,
--
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] cifs: New optype for session operations.
2021-02-04 10:04 ` Aurélien Aptel
@ 2021-02-09 1:59 ` Shyam Prasad N
2021-02-09 11:22 ` Aurélien Aptel
0 siblings, 1 reply; 9+ messages in thread
From: Shyam Prasad N @ 2021-02-09 1:59 UTC (permalink / raw)
To: Aurélien Aptel; +Cc: Steve French, Pavel Shilovsky, CIFS
[-- Attachment #1: Type: text/plain, Size: 1301 bytes --]
I had missed one check where CIFS_SESS_OP also had to be checked. Not
doing so would disable echoes and oplocks.
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index f19274857292..43331555fcc5 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -84,7 +84,7 @@ smb2_add_credits(struct TCP_Server_Info *server,
pr_warn_once("server overflowed SMB3 credits\n");
}
server->in_flight--;
- if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP)
+ if (server->in_flight == 0 && (optype & CIFS_OP_MASK) !=
CIFS_NEG_OP && (optype & CIFS_OP_MASK) != CIFS_SESS_OP)
rc = change_conf(server);
/*
* Sometimes server returns 0 credits on oplock break ack - we need to
Attaching a revised patch (one line correction in the old one).
Regards,
Shyam
On Thu, Feb 4, 2021 at 2:04 AM Aurélien Aptel <aaptel@suse.com> wrote:
>
>
> LGTM
>
> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
>
> Cheers,
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
>
--
Regards,
Shyam
[-- Attachment #2: 0001-cifs-New-optype-for-session-operations.patch --]
[-- Type: application/octet-stream, Size: 3439 bytes --]
From 0e62010f1ada4c48e55710d384dba4538f166d8f Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Wed, 3 Feb 2021 22:49:52 -0800
Subject: [PATCH 1/4] cifs: New optype for session operations.
We used to share the CIFS_NEG_OP flag between negotiate and
session authentication. There was an assumption in the code that
CIFS_NEG_OP is used by negotiate only. So introcuded CIFS_SESS_OP
and used it for session setup optypes.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
fs/cifs/cifsglob.h | 3 ++-
fs/cifs/smb2ops.c | 2 +-
fs/cifs/smb2pdu.c | 2 +-
fs/cifs/transport.c | 4 ++--
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 50fcb65920e8..1a1f9f4ae80a 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1704,7 +1704,8 @@ static inline bool is_retryable_error(int error)
#define CIFS_ECHO_OP 0x080 /* echo request */
#define CIFS_OBREAK_OP 0x0100 /* oplock break request */
#define CIFS_NEG_OP 0x0200 /* negotiate request */
-#define CIFS_OP_MASK 0x0380 /* mask request type */
+#define CIFS_SESS_OP 0x2000 /* session setup request */
+#define CIFS_OP_MASK 0x2380 /* mask request type */
#define CIFS_HAS_CREDITS 0x0400 /* already has credits */
#define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index f19274857292..43331555fcc5 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -84,7 +84,7 @@ smb2_add_credits(struct TCP_Server_Info *server,
pr_warn_once("server overflowed SMB3 credits\n");
}
server->in_flight--;
- if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP)
+ if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP && (optype & CIFS_OP_MASK) != CIFS_SESS_OP)
rc = change_conf(server);
/*
* Sometimes server returns 0 credits on oplock break ack - we need to
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index e1391bd92768..4bbb6126b14d 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1261,7 +1261,7 @@ SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data)
cifs_ses_server(sess_data->ses),
&rqst,
&sess_data->buf0_type,
- CIFS_LOG_ERROR | CIFS_NEG_OP, &rsp_iov);
+ CIFS_LOG_ERROR | CIFS_SESS_OP, &rsp_iov);
cifs_small_buf_release(sess_data->iov[0].iov_base);
memcpy(&sess_data->iov[0], &rsp_iov, sizeof(struct kvec));
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 4a2b836eb017..41223a9ee086 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -1171,7 +1171,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
/*
* Compounding is never used during session establish.
*/
- if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP))
+ if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP))
smb311_update_preauth_hash(ses, rqst[0].rq_iov,
rqst[0].rq_nvec);
@@ -1236,7 +1236,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
/*
* Compounding is never used during session establish.
*/
- if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP)) {
+ if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
struct kvec iov = {
.iov_base = resp_iov[0].iov_base,
.iov_len = resp_iov[0].iov_len
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] cifs: New optype for session operations.
2021-02-09 1:59 ` Shyam Prasad N
@ 2021-02-09 11:22 ` Aurélien Aptel
2021-02-09 19:58 ` Pavel Shilovsky
0 siblings, 1 reply; 9+ messages in thread
From: Aurélien Aptel @ 2021-02-09 11:22 UTC (permalink / raw)
To: Shyam Prasad N; +Cc: Steve French, Pavel Shilovsky, CIFS
Shyam Prasad N <nspmangalore@gmail.com> writes:
> I had missed one check where CIFS_SESS_OP also had to be checked. Not
> doing so would disable echoes and oplocks.
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
--
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] cifs: New optype for session operations.
2021-02-09 11:22 ` Aurélien Aptel
@ 2021-02-09 19:58 ` Pavel Shilovsky
2021-02-09 20:05 ` Steve French
0 siblings, 1 reply; 9+ messages in thread
From: Pavel Shilovsky @ 2021-02-09 19:58 UTC (permalink / raw)
To: Aurélien Aptel; +Cc: Shyam Prasad N, Steve French, CIFS
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 50fcb65920e8..1a1f9f4ae80a 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1704,7 +1704,8 @@ static inline bool is_retryable_error(int error)
#define CIFS_ECHO_OP 0x080 /* echo request */
#define CIFS_OBREAK_OP 0x0100 /* oplock break request */
#define CIFS_NEG_OP 0x0200 /* negotiate request */
-#define CIFS_OP_MASK 0x0380 /* mask request type */
+#define CIFS_SESS_OP 0x2000 /* session setup request */
+#define CIFS_OP_MASK 0x2380 /* mask request type */
Why skipping 0x400, 0x800 and 0x1000 flags?
--
Best regards,
Pavel Shilovsky
вт, 9 февр. 2021 г. в 03:22, Aurélien Aptel <aaptel@suse.com>:
>
> Shyam Prasad N <nspmangalore@gmail.com> writes:
>
> > I had missed one check where CIFS_SESS_OP also had to be checked. Not
> > doing so would disable echoes and oplocks.
>
> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
>
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
>
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] cifs: New optype for session operations.
2021-02-09 19:58 ` Pavel Shilovsky
@ 2021-02-09 20:05 ` Steve French
2021-02-09 20:07 ` Pavel Shilovsky
0 siblings, 1 reply; 9+ messages in thread
From: Steve French @ 2021-02-09 20:05 UTC (permalink / raw)
To: Pavel Shilovsky; +Cc: Aurélien Aptel, Shyam Prasad N, CIFS
On Tue, Feb 9, 2021 at 1:58 PM Pavel Shilovsky <piastryyy@gmail.com> wrote:
>
> diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> index 50fcb65920e8..1a1f9f4ae80a 100644
> --- a/fs/cifs/cifsglob.h
> +++ b/fs/cifs/cifsglob.h
> @@ -1704,7 +1704,8 @@ static inline bool is_retryable_error(int error)
> #define CIFS_ECHO_OP 0x080 /* echo request */
> #define CIFS_OBREAK_OP 0x0100 /* oplock break request */
> #define CIFS_NEG_OP 0x0200 /* negotiate request */
> -#define CIFS_OP_MASK 0x0380 /* mask request type */
> +#define CIFS_SESS_OP 0x2000 /* session setup request */
> +#define CIFS_OP_MASK 0x2380 /* mask request type */
>
> Why skipping 0x400, 0x800 and 0x1000 flags?
They were already reserved. See cifsglob.h
#define CIFS_HAS_CREDITS 0x0400 /* already has credits */
#define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
#define CIFS_NO_SRV_RSP 0x1000 /* there is no server response */
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] cifs: New optype for session operations.
2021-02-09 20:05 ` Steve French
@ 2021-02-09 20:07 ` Pavel Shilovsky
2021-02-10 5:47 ` Shyam Prasad N
0 siblings, 1 reply; 9+ messages in thread
From: Pavel Shilovsky @ 2021-02-09 20:07 UTC (permalink / raw)
To: Steve French; +Cc: Aurélien Aptel, Shyam Prasad N, CIFS
Yes, missed them in the first place. Then I would suggest to list them
in order to avoid confusion.
--
Best regards,
Pavel Shilovsky
вт, 9 февр. 2021 г. в 12:06, Steve French <smfrench@gmail.com>:
>
> On Tue, Feb 9, 2021 at 1:58 PM Pavel Shilovsky <piastryyy@gmail.com> wrote:
> >
> > diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> > index 50fcb65920e8..1a1f9f4ae80a 100644
> > --- a/fs/cifs/cifsglob.h
> > +++ b/fs/cifs/cifsglob.h
> > @@ -1704,7 +1704,8 @@ static inline bool is_retryable_error(int error)
> > #define CIFS_ECHO_OP 0x080 /* echo request */
> > #define CIFS_OBREAK_OP 0x0100 /* oplock break request */
> > #define CIFS_NEG_OP 0x0200 /* negotiate request */
> > -#define CIFS_OP_MASK 0x0380 /* mask request type */
> > +#define CIFS_SESS_OP 0x2000 /* session setup request */
> > +#define CIFS_OP_MASK 0x2380 /* mask request type */
> >
> > Why skipping 0x400, 0x800 and 0x1000 flags?
>
> They were already reserved. See cifsglob.h
>
> #define CIFS_HAS_CREDITS 0x0400 /* already has credits */
> #define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
> #define CIFS_NO_SRV_RSP 0x1000 /* there is no server response */
>
>
>
> --
> Thanks,
>
> Steve
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] cifs: New optype for session operations.
2021-02-09 20:07 ` Pavel Shilovsky
@ 2021-02-10 5:47 ` Shyam Prasad N
2021-02-10 6:09 ` Shyam Prasad N
0 siblings, 1 reply; 9+ messages in thread
From: Shyam Prasad N @ 2021-02-10 5:47 UTC (permalink / raw)
To: Pavel Shilovsky; +Cc: Steve French, Aurélien Aptel, CIFS
Yes. I'll put a comment to avoid confusion.
Regards,
Shyam
On Tue, Feb 9, 2021 at 12:08 PM Pavel Shilovsky <piastryyy@gmail.com> wrote:
>
> Yes, missed them in the first place. Then I would suggest to list them
> in order to avoid confusion.
> --
> Best regards,
> Pavel Shilovsky
>
> вт, 9 февр. 2021 г. в 12:06, Steve French <smfrench@gmail.com>:
> >
> > On Tue, Feb 9, 2021 at 1:58 PM Pavel Shilovsky <piastryyy@gmail.com> wrote:
> > >
> > > diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> > > index 50fcb65920e8..1a1f9f4ae80a 100644
> > > --- a/fs/cifs/cifsglob.h
> > > +++ b/fs/cifs/cifsglob.h
> > > @@ -1704,7 +1704,8 @@ static inline bool is_retryable_error(int error)
> > > #define CIFS_ECHO_OP 0x080 /* echo request */
> > > #define CIFS_OBREAK_OP 0x0100 /* oplock break request */
> > > #define CIFS_NEG_OP 0x0200 /* negotiate request */
> > > -#define CIFS_OP_MASK 0x0380 /* mask request type */
> > > +#define CIFS_SESS_OP 0x2000 /* session setup request */
> > > +#define CIFS_OP_MASK 0x2380 /* mask request type */
> > >
> > > Why skipping 0x400, 0x800 and 0x1000 flags?
> >
> > They were already reserved. See cifsglob.h
> >
> > #define CIFS_HAS_CREDITS 0x0400 /* already has credits */
> > #define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
> > #define CIFS_NO_SRV_RSP 0x1000 /* there is no server response */
> >
> >
> >
> > --
> > Thanks,
> >
> > Steve
--
Regards,
Shyam
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] cifs: New optype for session operations.
2021-02-10 5:47 ` Shyam Prasad N
@ 2021-02-10 6:09 ` Shyam Prasad N
0 siblings, 0 replies; 9+ messages in thread
From: Shyam Prasad N @ 2021-02-10 6:09 UTC (permalink / raw)
To: Pavel Shilovsky; +Cc: Steve French, Aurélien Aptel, CIFS
[-- Attachment #1: Type: text/plain, Size: 1787 bytes --]
Attaching updated patch.
On Tue, Feb 9, 2021 at 9:47 PM Shyam Prasad N <nspmangalore@gmail.com> wrote:
>
> Yes. I'll put a comment to avoid confusion.
>
> Regards,
> Shyam
>
> On Tue, Feb 9, 2021 at 12:08 PM Pavel Shilovsky <piastryyy@gmail.com> wrote:
> >
> > Yes, missed them in the first place. Then I would suggest to list them
> > in order to avoid confusion.
> > --
> > Best regards,
> > Pavel Shilovsky
> >
> > вт, 9 февр. 2021 г. в 12:06, Steve French <smfrench@gmail.com>:
> > >
> > > On Tue, Feb 9, 2021 at 1:58 PM Pavel Shilovsky <piastryyy@gmail.com> wrote:
> > > >
> > > > diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> > > > index 50fcb65920e8..1a1f9f4ae80a 100644
> > > > --- a/fs/cifs/cifsglob.h
> > > > +++ b/fs/cifs/cifsglob.h
> > > > @@ -1704,7 +1704,8 @@ static inline bool is_retryable_error(int error)
> > > > #define CIFS_ECHO_OP 0x080 /* echo request */
> > > > #define CIFS_OBREAK_OP 0x0100 /* oplock break request */
> > > > #define CIFS_NEG_OP 0x0200 /* negotiate request */
> > > > -#define CIFS_OP_MASK 0x0380 /* mask request type */
> > > > +#define CIFS_SESS_OP 0x2000 /* session setup request */
> > > > +#define CIFS_OP_MASK 0x2380 /* mask request type */
> > > >
> > > > Why skipping 0x400, 0x800 and 0x1000 flags?
> > >
> > > They were already reserved. See cifsglob.h
> > >
> > > #define CIFS_HAS_CREDITS 0x0400 /* already has credits */
> > > #define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
> > > #define CIFS_NO_SRV_RSP 0x1000 /* there is no server response */
> > >
> > >
> > >
> > > --
> > > Thanks,
> > >
> > > Steve
>
>
>
> --
> Regards,
> Shyam
--
Regards,
Shyam
[-- Attachment #2: 0001-cifs-New-optype-for-session-operations.patch --]
[-- Type: application/octet-stream, Size: 3498 bytes --]
From 7517f55ea1c69ba5d4d0dbd8ed8952c30cd112cf Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Wed, 3 Feb 2021 22:49:52 -0800
Subject: [PATCH 1/4] cifs: New optype for session operations.
We used to share the CIFS_NEG_OP flag between negotiate and
session authentication. There was an assumption in the code that
CIFS_NEG_OP is used by negotiate only. So introcuded CIFS_SESS_OP
and used it for session setup optypes.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
fs/cifs/cifsglob.h | 4 +++-
fs/cifs/smb2ops.c | 2 +-
fs/cifs/smb2pdu.c | 2 +-
fs/cifs/transport.c | 4 ++--
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 50fcb65920e8..3152601a608b 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1704,7 +1704,9 @@ static inline bool is_retryable_error(int error)
#define CIFS_ECHO_OP 0x080 /* echo request */
#define CIFS_OBREAK_OP 0x0100 /* oplock break request */
#define CIFS_NEG_OP 0x0200 /* negotiate request */
-#define CIFS_OP_MASK 0x0380 /* mask request type */
+/* Lower bitmask values are reserved by others below. */
+#define CIFS_SESS_OP 0x2000 /* session setup request */
+#define CIFS_OP_MASK 0x2380 /* mask request type */
#define CIFS_HAS_CREDITS 0x0400 /* already has credits */
#define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index f19274857292..43331555fcc5 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -84,7 +84,7 @@ smb2_add_credits(struct TCP_Server_Info *server,
pr_warn_once("server overflowed SMB3 credits\n");
}
server->in_flight--;
- if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP)
+ if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP && (optype & CIFS_OP_MASK) != CIFS_SESS_OP)
rc = change_conf(server);
/*
* Sometimes server returns 0 credits on oplock break ack - we need to
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index e1391bd92768..4bbb6126b14d 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1261,7 +1261,7 @@ SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data)
cifs_ses_server(sess_data->ses),
&rqst,
&sess_data->buf0_type,
- CIFS_LOG_ERROR | CIFS_NEG_OP, &rsp_iov);
+ CIFS_LOG_ERROR | CIFS_SESS_OP, &rsp_iov);
cifs_small_buf_release(sess_data->iov[0].iov_base);
memcpy(&sess_data->iov[0], &rsp_iov, sizeof(struct kvec));
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 4a2b836eb017..41223a9ee086 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -1171,7 +1171,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
/*
* Compounding is never used during session establish.
*/
- if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP))
+ if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP))
smb311_update_preauth_hash(ses, rqst[0].rq_iov,
rqst[0].rq_nvec);
@@ -1236,7 +1236,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
/*
* Compounding is never used during session establish.
*/
- if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP)) {
+ if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
struct kvec iov = {
.iov_base = resp_iov[0].iov_base,
.iov_len = resp_iov[0].iov_len
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-02-10 6:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-04 8:05 [PATCH 1/4] cifs: New optype for session operations Shyam Prasad N
2021-02-04 10:04 ` Aurélien Aptel
2021-02-09 1:59 ` Shyam Prasad N
2021-02-09 11:22 ` Aurélien Aptel
2021-02-09 19:58 ` Pavel Shilovsky
2021-02-09 20:05 ` Steve French
2021-02-09 20:07 ` Pavel Shilovsky
2021-02-10 5:47 ` Shyam Prasad N
2021-02-10 6:09 ` Shyam Prasad N
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.