All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 1/1]: fix bug in CREATE_SESSION encoding
@ 2011-06-10  6:32 Sid Moore
  2011-06-10 19:55 ` Benny Halevy
  0 siblings, 1 reply; 4+ messages in thread
From: Sid Moore @ 2011-06-10  6:32 UTC (permalink / raw)
  To: linux-nfs

Hi

I think it might be an error when typing. see the patch below.


--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1772,7 +1772,7 @@ static void encode_create_session(struct xdr_stream *xdr,
        *p++ = cpu_to_be32(0);                          /* rdmachannel_attrs */

        /* Back Channel */
-       *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header
padding size */
+       *p++ = cpu_to_be32(args->bc_attrs.headerpadsz); /* header
padding size */
        *p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz); /* max req size */
        *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz); /* max resp size */
        *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached);  /* Max
resp sz cached */

--
Sid

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

* Re: [patch 1/1]: fix bug in CREATE_SESSION encoding
  2011-06-10  6:32 [patch 1/1]: fix bug in CREATE_SESSION encoding Sid Moore
@ 2011-06-10 19:55 ` Benny Halevy
  2011-06-11  0:52   ` Trond Myklebust
  0 siblings, 1 reply; 4+ messages in thread
From: Benny Halevy @ 2011-06-10 19:55 UTC (permalink / raw)
  To: Sid Moore, Trond Myklebust; +Cc: linux-nfs

On 2011-06-10 02:32, Sid Moore wrote:
> Hi
> 
> I think it might be an error when typing. see the patch below.
> 
> 
> --- a/fs/nfs/nfs4xdr.c
> +++ b/fs/nfs/nfs4xdr.c
> @@ -1772,7 +1772,7 @@ static void encode_create_session(struct xdr_stream *xdr,
>         *p++ = cpu_to_be32(0);                          /* rdmachannel_attrs */
> 
>         /* Back Channel */
> -       *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header
> padding size */
> +       *p++ = cpu_to_be32(args->bc_attrs.headerpadsz); /* header
> padding size */
>         *p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz); /* max req size */
>         *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz); /* max resp size */
>         *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached);  /* Max
> resp sz cached */
> 
> --
> Sid
> --

Thanks for spotting this!
Since we don't support header padding yet the following patch
might be more appropriate.
Trond, what do you think?

Benny

git diff --stat -p -M
 fs/nfs/nfs4proc.c       |    4 ----
 fs/nfs/nfs4xdr.c        |   10 ++++++----
 include/linux/nfs_xdr.h |    1 -
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 987260c..e7ef0b1 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5099,7 +5099,6 @@ static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args)
 	if (mxresp_sz == 0)
 		mxresp_sz = NFS_MAX_FILE_IO_SIZE;
 	/* Fore channel attributes */
-	args->fc_attrs.headerpadsz = 0;
 	args->fc_attrs.max_rqst_sz = mxrqst_sz;
 	args->fc_attrs.max_resp_sz = mxresp_sz;
 	args->fc_attrs.max_ops = NFS4_MAX_OPS;
@@ -5112,7 +5111,6 @@ static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args)
 		args->fc_attrs.max_ops, args->fc_attrs.max_reqs);

 	/* Back channel attributes */
-	args->bc_attrs.headerpadsz = 0;
 	args->bc_attrs.max_rqst_sz = PAGE_SIZE;
 	args->bc_attrs.max_resp_sz = PAGE_SIZE;
 	args->bc_attrs.max_resp_sz_cached = 0;
@@ -5132,8 +5130,6 @@ static int nfs4_verify_fore_channel_attrs(struct nfs41_create_session_args *args
 	struct nfs4_channel_attrs *sent = &args->fc_attrs;
 	struct nfs4_channel_attrs *rcvd = &session->fc_attrs;

-	if (rcvd->headerpadsz > sent->headerpadsz)
-		return -EINVAL;
 	if (rcvd->max_resp_sz > sent->max_resp_sz)
 		return -EINVAL;
 	/*
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 73f18f4..7afc8df 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1780,7 +1780,7 @@ static void encode_create_session(struct xdr_stream *xdr,
 	*p++ = cpu_to_be32(args->flags);			/*flags */

 	/* Fore Channel */
-	*p++ = cpu_to_be32(args->fc_attrs.headerpadsz);	/* header padding size */
+	*p++ = cpu_to_be32(0);				/* header padding size */
 	*p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz);	/* max req size */
 	*p++ = cpu_to_be32(args->fc_attrs.max_resp_sz);	/* max resp size */
 	*p++ = cpu_to_be32(max_resp_sz_cached);		/* Max resp sz cached */
@@ -1789,7 +1789,7 @@ static void encode_create_session(struct xdr_stream *xdr,
 	*p++ = cpu_to_be32(0);				/* rdmachannel_attrs */

 	/* Back Channel */
-	*p++ = cpu_to_be32(args->fc_attrs.headerpadsz);	/* header padding size */
+	*p++ = cpu_to_be32(0);				/* header padding size */
 	*p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz);	/* max req size */
 	*p++ = cpu_to_be32(args->bc_attrs.max_resp_sz);	/* max resp size */
 	*p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached);	/* Max resp sz cached */
@@ -5119,12 +5119,14 @@ static int decode_chan_attrs(struct xdr_stream *xdr,
 			     struct nfs4_channel_attrs *attrs)
 {
 	__be32 *p;
-	u32 nr_attrs;
+	u32 nr_attrs, val;

 	p = xdr_inline_decode(xdr, 28);
 	if (unlikely(!p))
 		goto out_overflow;
-	attrs->headerpadsz = be32_to_cpup(p++);
+	val = be32_to_cpup(p++);	/* headerpadsz */
+	if (val)
+		return -EINVAL;		/* no support for header padding yet */
 	attrs->max_rqst_sz = be32_to_cpup(p++);
 	attrs->max_resp_sz = be32_to_cpup(p++);
 	attrs->max_resp_sz_cached = be32_to_cpup(p++);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index d1f9c27..0a21844 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -161,7 +161,6 @@ struct nfs_seqid;

 /* nfs41 sessions channel attributes */
 struct nfs4_channel_attrs {
-	u32			headerpadsz;
 	u32			max_rqst_sz;
 	u32			max_resp_sz;
 	u32			max_resp_sz_cached;

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

* Re: [patch 1/1]: fix bug in CREATE_SESSION encoding
  2011-06-10 19:55 ` Benny Halevy
@ 2011-06-11  0:52   ` Trond Myklebust
  2011-06-11 21:08     ` [PATCH] NFSv4.1: deprecate headerpadsz in CREATE_SESSION Benny Halevy
  0 siblings, 1 reply; 4+ messages in thread
From: Trond Myklebust @ 2011-06-11  0:52 UTC (permalink / raw)
  To: Benny Halevy; +Cc: Sid Moore, linux-nfs

On Fri, 2011-06-10 at 15:55 -0400, Benny Halevy wrote: 
> On 2011-06-10 02:32, Sid Moore wrote:
> > Hi
> > 
> > I think it might be an error when typing. see the patch below.
> > 
> > 
> > --- a/fs/nfs/nfs4xdr.c
> > +++ b/fs/nfs/nfs4xdr.c
> > @@ -1772,7 +1772,7 @@ static void encode_create_session(struct xdr_stream *xdr,
> >         *p++ = cpu_to_be32(0);                          /* rdmachannel_attrs */
> > 
> >         /* Back Channel */
> > -       *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header
> > padding size */
> > +       *p++ = cpu_to_be32(args->bc_attrs.headerpadsz); /* header
> > padding size */
> >         *p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz); /* max req size */
> >         *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz); /* max resp size */
> >         *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached);  /* Max
> > resp sz cached */
> > 
> > --
> > Sid
> > --
> 
> Thanks for spotting this!
> Since we don't support header padding yet the following patch
> might be more appropriate.
> Trond, what do you think?

Agreed. If it is unused, then let's ditch it...

Cheers
  Trond

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


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

* [PATCH] NFSv4.1: deprecate headerpadsz in CREATE_SESSION
  2011-06-11  0:52   ` Trond Myklebust
@ 2011-06-11 21:08     ` Benny Halevy
  0 siblings, 0 replies; 4+ messages in thread
From: Benny Halevy @ 2011-06-11 21:08 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs, Benny Halevy

We don't support header padding yet so better off ditching it

Reported-by: Sid Moore <learnmost@gmail.com>
Signed-off-by: Benny Halevy <benny@tonian.com>
---
 fs/nfs/nfs4proc.c       |    4 ----
 fs/nfs/nfs4xdr.c        |   10 ++++++----
 include/linux/nfs_xdr.h |    1 -
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d2c4b59..3ca4497 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5098,7 +5098,6 @@ static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args)
 	if (mxresp_sz == 0)
 		mxresp_sz = NFS_MAX_FILE_IO_SIZE;
 	/* Fore channel attributes */
-	args->fc_attrs.headerpadsz = 0;
 	args->fc_attrs.max_rqst_sz = mxrqst_sz;
 	args->fc_attrs.max_resp_sz = mxresp_sz;
 	args->fc_attrs.max_ops = NFS4_MAX_OPS;
@@ -5111,7 +5110,6 @@ static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args)
 		args->fc_attrs.max_ops, args->fc_attrs.max_reqs);
 
 	/* Back channel attributes */
-	args->bc_attrs.headerpadsz = 0;
 	args->bc_attrs.max_rqst_sz = PAGE_SIZE;
 	args->bc_attrs.max_resp_sz = PAGE_SIZE;
 	args->bc_attrs.max_resp_sz_cached = 0;
@@ -5131,8 +5129,6 @@ static int nfs4_verify_fore_channel_attrs(struct nfs41_create_session_args *args
 	struct nfs4_channel_attrs *sent = &args->fc_attrs;
 	struct nfs4_channel_attrs *rcvd = &session->fc_attrs;
 
-	if (rcvd->headerpadsz > sent->headerpadsz)
-		return -EINVAL;
 	if (rcvd->max_resp_sz > sent->max_resp_sz)
 		return -EINVAL;
 	/*
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index d869a5e..c4b7d6c 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1725,7 +1725,7 @@ static void encode_create_session(struct xdr_stream *xdr,
 	*p++ = cpu_to_be32(args->flags);			/*flags */
 
 	/* Fore Channel */
-	*p++ = cpu_to_be32(args->fc_attrs.headerpadsz);	/* header padding size */
+	*p++ = cpu_to_be32(0);				/* header padding size */
 	*p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz);	/* max req size */
 	*p++ = cpu_to_be32(args->fc_attrs.max_resp_sz);	/* max resp size */
 	*p++ = cpu_to_be32(max_resp_sz_cached);		/* Max resp sz cached */
@@ -1734,7 +1734,7 @@ static void encode_create_session(struct xdr_stream *xdr,
 	*p++ = cpu_to_be32(0);				/* rdmachannel_attrs */
 
 	/* Back Channel */
-	*p++ = cpu_to_be32(args->fc_attrs.headerpadsz);	/* header padding size */
+	*p++ = cpu_to_be32(0);				/* header padding size */
 	*p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz);	/* max req size */
 	*p++ = cpu_to_be32(args->bc_attrs.max_resp_sz);	/* max resp size */
 	*p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached);	/* Max resp sz cached */
@@ -4997,12 +4997,14 @@ static int decode_chan_attrs(struct xdr_stream *xdr,
 			     struct nfs4_channel_attrs *attrs)
 {
 	__be32 *p;
-	u32 nr_attrs;
+	u32 nr_attrs, val;
 
 	p = xdr_inline_decode(xdr, 28);
 	if (unlikely(!p))
 		goto out_overflow;
-	attrs->headerpadsz = be32_to_cpup(p++);
+	val = be32_to_cpup(p++);	/* headerpadsz */
+	if (val)
+		return -EINVAL;		/* no support for header padding yet */
 	attrs->max_rqst_sz = be32_to_cpup(p++);
 	attrs->max_resp_sz = be32_to_cpup(p++);
 	attrs->max_resp_sz_cached = be32_to_cpup(p++);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 5e8444a..00848d8 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -158,7 +158,6 @@ struct nfs_seqid;
 
 /* nfs41 sessions channel attributes */
 struct nfs4_channel_attrs {
-	u32			headerpadsz;
 	u32			max_rqst_sz;
 	u32			max_resp_sz;
 	u32			max_resp_sz_cached;
-- 
1.7.4.4


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

end of thread, other threads:[~2011-06-11 21:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10  6:32 [patch 1/1]: fix bug in CREATE_SESSION encoding Sid Moore
2011-06-10 19:55 ` Benny Halevy
2011-06-11  0:52   ` Trond Myklebust
2011-06-11 21:08     ` [PATCH] NFSv4.1: deprecate headerpadsz in CREATE_SESSION Benny Halevy

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.