diff mbox

cifs: advertise the right receive buffer size to the server

Message ID 1308658004-14725-1-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton June 21, 2011, 12:06 p.m. UTC
Currently, we mirror the same size back to the server that it sends us.
That makes little sense. Instead we should be sending the server the
maximum buffer size that we can handle.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/cifs/sess.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Steve French June 21, 2011, 2:03 p.m. UTC | #1
makes sense although I think some servers ignore this.

On Tue, Jun 21, 2011 at 7:06 AM, Jeff Layton <jlayton@redhat.com> wrote:
> Currently, we mirror the same size back to the server that it sends us.
> That makes little sense. Instead we should be sending the server the
> maximum buffer size that we can handle.
>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/cifs/sess.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
> index 3892ab8..855c777 100644
> --- a/fs/cifs/sess.c
> +++ b/fs/cifs/sess.c
> @@ -124,7 +124,8 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, SESSION_SETUP_ANDX *pSMB)
>        /*      that we use in next few lines                               */
>        /* Note that header is initialized to zero in header_assemble */
>        pSMB->req.AndXCommand = 0xFF;
> -       pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf);
> +       pSMB->req.MaxBufferSize = cpu_to_le16(min_t(u32, CIFSMaxBufSize,
> +                                               USHRT_MAX));
>        pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq);
>        pSMB->req.VcNumber = get_next_vcnum(ses);
>
> --
> 1.7.5.4
>
>
Jeff Layton June 21, 2011, 3:31 p.m. UTC | #2
On Tue, 21 Jun 2011 09:03:05 -0500
Steve French <smfrench@gmail.com> wrote:

> makes sense although I think some servers ignore this.
> 

I'm sure some do. One question though...

> On Tue, Jun 21, 2011 at 7:06 AM, Jeff Layton <jlayton@redhat.com> wrote:
> > Currently, we mirror the same size back to the server that it sends us.
> > That makes little sense. Instead we should be sending the server the
> > maximum buffer size that we can handle.
> >
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > ---
> >  fs/cifs/sess.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
> > index 3892ab8..855c777 100644
> > --- a/fs/cifs/sess.c
> > +++ b/fs/cifs/sess.c
> > @@ -124,7 +124,8 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, SESSION_SETUP_ANDX *pSMB)
> >        /*      that we use in next few lines                               */
> >        /* Note that header is initialized to zero in header_assemble */
> >        pSMB->req.AndXCommand = 0xFF;
> > -       pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf);
> > +       pSMB->req.MaxBufferSize = cpu_to_le16(min_t(u32, CIFSMaxBufSize,
> > +                                               USHRT_MAX));

Should we be using CIFSMaxBufSize - 4 here (to account for the RFC1001 header) ?

> >        pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq);
> >        pSMB->req.VcNumber = get_next_vcnum(ses);
> >
> > --
> > 1.7.5.4
> >
> >
> 
> 
>
diff mbox

Patch

diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 3892ab8..855c777 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -124,7 +124,8 @@  static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, SESSION_SETUP_ANDX *pSMB)
 	/*	that we use in next few lines                               */
 	/* Note that header is initialized to zero in header_assemble */
 	pSMB->req.AndXCommand = 0xFF;
-	pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf);
+	pSMB->req.MaxBufferSize = cpu_to_le16(min_t(u32, CIFSMaxBufSize,
+						USHRT_MAX));
 	pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq);
 	pSMB->req.VcNumber = get_next_vcnum(ses);