linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session
@ 2010-11-11 10:03 Mi Jinlong
  2010-11-11 13:32 ` Benny Halevy
  2010-11-12 20:45 ` J. Bruce Fields
  0 siblings, 2 replies; 9+ messages in thread
From: Mi Jinlong @ 2010-11-11 10:03 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: NFSv3 list

At the latest kernel(2.6.37-rc1), server just initialize the forechannel
at init_forechannel_attrs, but don't reflect it to reply.

After initialize the session success, we should copy the forechannel info
to nfsd4_create_session struct.

Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
---
 fs/nfsd/nfs4state.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index f1e5ec6..3876a9c 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1556,6 +1556,8 @@ nfsd4_create_session(struct svc_rqst *rqstp,
 	status = nfs_ok;
 	memcpy(cr_ses->sessionid.data, new->se_sessionid.data,
 	       NFS4_MAX_SESSIONID_LEN);
+	memcpy(&cr_ses->fore_channel, &new->se_fchannel,
+		sizeof(struct nfsd4_channel_attrs));
 	cs_slot->sl_seqid++;
 	cr_ses->seqid = cs_slot->sl_seqid;
 
-- 
1.7.0.1



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

* Re: [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session
  2010-11-11 10:03 [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session Mi Jinlong
@ 2010-11-11 13:32 ` Benny Halevy
  2010-11-12 20:45 ` J. Bruce Fields
  1 sibling, 0 replies; 9+ messages in thread
From: Benny Halevy @ 2010-11-11 13:32 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: J. Bruce Fields, NFS list

On 2010-11-11 12:03, Mi Jinlong wrote:
> At the latest kernel(2.6.37-rc1), server just initialize the forechannel
> at init_forechannel_attrs, but don't reflect it to reply.
> 
> After initialize the session success, we should copy the forechannel info
> to nfsd4_create_session struct.
> 
> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>

Yeah, looks necessary to me too.

Benny

> ---
>  fs/nfsd/nfs4state.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index f1e5ec6..3876a9c 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1556,6 +1556,8 @@ nfsd4_create_session(struct svc_rqst *rqstp,
>  	status = nfs_ok;
>  	memcpy(cr_ses->sessionid.data, new->se_sessionid.data,
>  	       NFS4_MAX_SESSIONID_LEN);
> +	memcpy(&cr_ses->fore_channel, &new->se_fchannel,
> +		sizeof(struct nfsd4_channel_attrs));
>  	cs_slot->sl_seqid++;
>  	cr_ses->seqid = cs_slot->sl_seqid;
>  

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

* Re: [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session
  2010-11-11 10:03 [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session Mi Jinlong
  2010-11-11 13:32 ` Benny Halevy
@ 2010-11-12 20:45 ` J. Bruce Fields
  2010-11-15  8:12   ` Mi Jinlong
  1 sibling, 1 reply; 9+ messages in thread
From: J. Bruce Fields @ 2010-11-12 20:45 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: NFSv3 list

On Thu, Nov 11, 2010 at 06:03:40PM +0800, Mi Jinlong wrote:
> At the latest kernel(2.6.37-rc1), server just initialize the forechannel
> at init_forechannel_attrs, but don't reflect it to reply.
> 
> After initialize the session success, we should copy the forechannel info
> to nfsd4_create_session struct.

Thanks!

Is there a chance you could write a pynfs test for this?

--b.

> 
> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
> ---
>  fs/nfsd/nfs4state.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index f1e5ec6..3876a9c 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1556,6 +1556,8 @@ nfsd4_create_session(struct svc_rqst *rqstp,
>  	status = nfs_ok;
>  	memcpy(cr_ses->sessionid.data, new->se_sessionid.data,
>  	       NFS4_MAX_SESSIONID_LEN);
> +	memcpy(&cr_ses->fore_channel, &new->se_fchannel,
> +		sizeof(struct nfsd4_channel_attrs));
>  	cs_slot->sl_seqid++;
>  	cr_ses->seqid = cs_slot->sl_seqid;
>  
> -- 
> 1.7.0.1
> 
> 

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

* Re: [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session
  2010-11-12 20:45 ` J. Bruce Fields
@ 2010-11-15  8:12   ` Mi Jinlong
  2010-12-29 19:35     ` J. Bruce Fields
  0 siblings, 1 reply; 9+ messages in thread
From: Mi Jinlong @ 2010-11-15  8:12 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: NFSv3 list



J. Bruce Fields:
> On Thu, Nov 11, 2010 at 06:03:40PM +0800, Mi Jinlong wrote:
>> At the latest kernel(2.6.37-rc1), server just initialize the forechannel
>> at init_forechannel_attrs, but don't reflect it to reply.
>>
>> After initialize the session success, we should copy the forechannel info
>> to nfsd4_create_session struct.
> 
> Thanks!
> 
> Is there a chance you could write a pynfs test for this?

Maybe the following one is OK.
------------

SRVR: Can server return fore_channel maxreqs correctly 

When client set the fore_channel maxreqs larger than server's
NFSD_MAX_SLOTS_PER_SESSION at create_sessino, the fore_channel
maxreqs at the reply must less than NFSD_MAX_SLOTS_PER_SESSION.

At 2.6.37-rc1, the NFSD_MAX_SLOTS_PER_SESSION is 160.

Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
---
 nfs4.1/server41tests/st_create_session.py |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
index 5f425d4..174d31e 100644
--- a/nfs4.1/server41tests/st_create_session.py
+++ b/nfs4.1/server41tests/st_create_session.py
@@ -156,6 +156,25 @@ def testReplay1b(t, env):
     if not nfs4lib.test_equal(res1, res2):
         fail("Replay results not equal")
 
+def testReplay1c(t, env):
+    """Replay a successful CREATE_SESSION with right maxreqs 
+        (less than NFSD_MAX_SLOTS_PER_SESSION)
+
+    FLAGS: create_session all
+    CODE: CSESS5c
+    """
+    NFSD_MAX_SLOTS_PER_SESSION = 160
+
+    c = env.c1.new_client(env.testname(t))
+    # CREATE_SESSION with fore_channel = NFSD_MAX_SLOTS_PER_SESSION + 1
+    chan_attrs = channel_attrs4(0,8192,8192,8192,128,
+                                NFSD_MAX_SLOTS_PER_SESSION + 1,[])
+    sess1 = c.create_session(fore_attrs=chan_attrs)
+
+    if nfs4lib.test_equal(sess1.fore_channel.maxrequests,
+                          chan_attrs.ca_maxrequests, "count4"):
+        fail("Replay wrong fore_channel maxreqs")
+
 def testReplay2(t, env):
     """Replay a unsuccessful CREATE_SESSION
     
-- 
1.7.3.2



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

* Re: [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session
  2010-11-15  8:12   ` Mi Jinlong
@ 2010-12-29 19:35     ` J. Bruce Fields
  2010-12-30  3:16       ` Mi Jinlong
  0 siblings, 1 reply; 9+ messages in thread
From: J. Bruce Fields @ 2010-12-29 19:35 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: NFSv3 list

On Mon, Nov 15, 2010 at 04:12:43PM +0800, Mi Jinlong wrote:
> 
> 
> J. Bruce Fields:
> > On Thu, Nov 11, 2010 at 06:03:40PM +0800, Mi Jinlong wrote:
> >> At the latest kernel(2.6.37-rc1), server just initialize the forechannel
> >> at init_forechannel_attrs, but don't reflect it to reply.
> >>
> >> After initialize the session success, we should copy the forechannel info
> >> to nfsd4_create_session struct.
> > 
> > Thanks!
> > 
> > Is there a chance you could write a pynfs test for this?
> 
> Maybe the following one is OK.

Yes, thanks very much.  But could we use a larger MAX_SLOTS_PER_SESSION
value, to increase the chances this test will make sense for any
server?

Also, this is a "reply", not a "replay", test, so move it a little
later; how about the following?

--b.

commit bf41254ab3583f6e41c96b1861956dd31595928d
Author: Mi Jinlong <mijinlong@cn.fujitsu.com>
Date:   Mon Nov 15 16:12:43 2010 +0800

    SRVR: Can server return fore_channel maxreqs correctly
    
    When client set the fore_channel maxreqs larger than server's
    NFSD_MAX_SLOTS_PER_SESSION at create_session, the fore_channel
    maxreqs at the reply must less than NFSD_MAX_SLOTS_PER_SESSION.
    
    At 2.6.37-rc1, the NFSD_MAX_SLOTS_PER_SESSION is 160.
    
    Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>

diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
index 5f425d4..efb2641 100644
--- a/nfs4.1/server41tests/st_create_session.py
+++ b/nfs4.1/server41tests/st_create_session.py
@@ -363,3 +363,23 @@ def testCallbackVersion(t, env):
                  (cb_occurred.low, cb_occurred.hi, cb_occurred.vers))
     finally:
         env.c1._check_version = orig
+
+def testMaxreqs(t, env):
+    """A CREATE_SESSION with maxreqs too large should return
+       a modified value
+
+    FLAGS: create_session all
+    CODE: CSESS22
+    """
+    # Assuming this is too large for any server; increase if necessary:
+    TOO_MANY_SLOTS = 1000000
+
+    c = env.c1.new_client(env.testname(t))
+    # CREATE_SESSION with fore_channel = TOO_MANY_SLOTS
+    chan_attrs = channel_attrs4(0,8192,8192,8192,128, TOO_MANY_SLOTS, [])
+    sess1 = c.create_session(fore_attrs=chan_attrs)
+
+    if nfs4lib.test_equal(sess1.fore_channel.maxrequests,
+                          chan_attrs.ca_maxrequests, "count4"):
+        fail("Server allows surprisingly large fore_channel maxreqs");

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

* Re: [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session
  2010-12-29 19:35     ` J. Bruce Fields
@ 2010-12-30  3:16       ` Mi Jinlong
  2011-01-05  1:00         ` J. Bruce Fields
  0 siblings, 1 reply; 9+ messages in thread
From: Mi Jinlong @ 2010-12-30  3:16 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: NFSv3 list

Hi Bruce:

J. Bruce Fields:
> On Mon, Nov 15, 2010 at 04:12:43PM +0800, Mi Jinlong wrote:
>>
>> J. Bruce Fields:
>>> On Thu, Nov 11, 2010 at 06:03:40PM +0800, Mi Jinlong wrote:
>>>> At the latest kernel(2.6.37-rc1), server just initialize the forechannel
>>>> at init_forechannel_attrs, but don't reflect it to reply.
>>>>
>>>> After initialize the session success, we should copy the forechannel info
>>>> to nfsd4_create_session struct.
>>> Thanks!
>>>
>>> Is there a chance you could write a pynfs test for this?
>> Maybe the following one is OK.
> 
> Yes, thanks very much.  But could we use a larger MAX_SLOTS_PER_SESSION
> value, to increase the chances this test will make sense for any
> server?

  Yes, but we can't use a huge value as 1000000 for that the test site
  will allocate replay_cache for each fore_channel.maxrequests when get
  the reply of CREATE_SESSION. If setting to 1000000 or more huger, 
  when the test case fail, the test site will eat many memory. 

  So, we should set it less than 1000 and add an explain.

> 
> Also, this is a "reply", not a "replay", test, so move it a little
> later; how about the following?

  Sorry for that, it's a typo. ^_^

  Maybe we should set the TOO_MANY_SLOTS less than 1000, after testing,
  the patch is as following:

  Ps: delete the semicolon at the latest line.

>From 2f544fcef0eef7ac1d59bc428be3436ad7d1bbde Mon Sep 17 00:00:00 2001
From: Mi Jinlong <mijinlong@cn.fujitsu.com>
Date: Wed, 29 Dec 2010 16:06:30 +0800
Subject: [PATCH] SRVR: Can server return fore_channel maxreqs correctly

    SRVR: Can server return fore_channel maxreqs correctly
    
    When client set the fore_channel maxreqs larger than server's
    NFSD_MAX_SLOTS_PER_SESSION at create_session, the fore_channel
    maxreqs at the reply must less than NFSD_MAX_SLOTS_PER_SESSION.
    
    At 2.6.37-rc1, the NFSD_MAX_SLOTS_PER_SESSION is 160.
    
    Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>

---
 nfs4.1/server41tests/st_create_session.py |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
index 5f425d4..5cfac14 100644
--- a/nfs4.1/server41tests/st_create_session.py
+++ b/nfs4.1/server41tests/st_create_session.py
@@ -363,3 +363,22 @@ def testCallbackVersion(t, env):
                  (cb_occurred.low, cb_occurred.hi, cb_occurred.vers))
     finally:
         env.c1._check_version = orig
+
+def testMaxreqs(t, env):
+    """A CREATE_SESSION with maxreqs too large should return
+       a modified value
+
+    FLAGS: create_session all
+    CODE: CSESS22
+    """
+    # Assuming this is too large for any server; increase if necessary:
+    # but too huge will eat many memory for replay_cache, becareful it!
+    TOO_MANY_SLOTS = 500
+
+    c = env.c1.new_client(env.testname(t))
+    # CREATE_SESSION with fore_channel = TOO_MANY_SLOTS
+    chan_attrs = channel_attrs4(0,8192,8192,8192,128, TOO_MANY_SLOTS, [])
+    sess1 = c.create_session(fore_attrs=chan_attrs)
+    if nfs4lib.test_equal(sess1.fore_channel.maxrequests,
+                          chan_attrs.ca_maxrequests, "count4"):
+        fail("Server allows surprisingly large fore_channel maxreqs")
-- 
1.7.3.3


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

* Re: [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session
  2010-12-30  3:16       ` Mi Jinlong
@ 2011-01-05  1:00         ` J. Bruce Fields
  2011-01-05  5:56           ` Mi Jinlong
  0 siblings, 1 reply; 9+ messages in thread
From: J. Bruce Fields @ 2011-01-05  1:00 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: NFSv3 list

On Thu, Dec 30, 2010 at 11:16:44AM +0800, Mi Jinlong wrote:
> Hi Bruce:
> 
> J. Bruce Fields:
> > On Mon, Nov 15, 2010 at 04:12:43PM +0800, Mi Jinlong wrote:
> >>
> >> J. Bruce Fields:
> >>> On Thu, Nov 11, 2010 at 06:03:40PM +0800, Mi Jinlong wrote:
> >>>> At the latest kernel(2.6.37-rc1), server just initialize the forechannel
> >>>> at init_forechannel_attrs, but don't reflect it to reply.
> >>>>
> >>>> After initialize the session success, we should copy the forechannel info
> >>>> to nfsd4_create_session struct.
> >>> Thanks!
> >>>
> >>> Is there a chance you could write a pynfs test for this?
> >> Maybe the following one is OK.
> > 
> > Yes, thanks very much.  But could we use a larger MAX_SLOTS_PER_SESSION
> > value, to increase the chances this test will make sense for any
> > server?
> 
>   Yes, but we can't use a huge value as 1000000 for that the test site
>   will allocate replay_cache for each fore_channel.maxrequests when get
>   the reply of CREATE_SESSION.

pynfs should only allocate enough for the returned maxrequests, right?

> If setting to 1000000 or more huger, 
>   when the test case fail, the test site will eat many memory. 
> 
>   So, we should set it less than 1000 and add an explain.
> 
> > 
> > Also, this is a "reply", not a "replay", test, so move it a little
> > later; how about the following?
> 
>   Sorry for that, it's a typo. ^_^
> 
>   Maybe we should set the TOO_MANY_SLOTS less than 1000, after testing,
>   the patch is as following:
> 
>   Ps: delete the semicolon at the latest line.

Whoops, I obviously don't do much python....

--b.

> 
> >From 2f544fcef0eef7ac1d59bc428be3436ad7d1bbde Mon Sep 17 00:00:00 2001
> From: Mi Jinlong <mijinlong@cn.fujitsu.com>
> Date: Wed, 29 Dec 2010 16:06:30 +0800
> Subject: [PATCH] SRVR: Can server return fore_channel maxreqs correctly
> 
>     SRVR: Can server return fore_channel maxreqs correctly
>     
>     When client set the fore_channel maxreqs larger than server's
>     NFSD_MAX_SLOTS_PER_SESSION at create_session, the fore_channel
>     maxreqs at the reply must less than NFSD_MAX_SLOTS_PER_SESSION.
>     
>     At 2.6.37-rc1, the NFSD_MAX_SLOTS_PER_SESSION is 160.
>     
>     Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
>     Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> 
> ---
>  nfs4.1/server41tests/st_create_session.py |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
> index 5f425d4..5cfac14 100644
> --- a/nfs4.1/server41tests/st_create_session.py
> +++ b/nfs4.1/server41tests/st_create_session.py
> @@ -363,3 +363,22 @@ def testCallbackVersion(t, env):
>                   (cb_occurred.low, cb_occurred.hi, cb_occurred.vers))
>      finally:
>          env.c1._check_version = orig
> +
> +def testMaxreqs(t, env):
> +    """A CREATE_SESSION with maxreqs too large should return
> +       a modified value
> +
> +    FLAGS: create_session all
> +    CODE: CSESS22
> +    """
> +    # Assuming this is too large for any server; increase if necessary:
> +    # but too huge will eat many memory for replay_cache, becareful it!
> +    TOO_MANY_SLOTS = 500
> +
> +    c = env.c1.new_client(env.testname(t))
> +    # CREATE_SESSION with fore_channel = TOO_MANY_SLOTS
> +    chan_attrs = channel_attrs4(0,8192,8192,8192,128, TOO_MANY_SLOTS, [])
> +    sess1 = c.create_session(fore_attrs=chan_attrs)
> +    if nfs4lib.test_equal(sess1.fore_channel.maxrequests,
> +                          chan_attrs.ca_maxrequests, "count4"):
> +        fail("Server allows surprisingly large fore_channel maxreqs")
> -- 
> 1.7.3.3
> 

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

* Re: [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session
  2011-01-05  1:00         ` J. Bruce Fields
@ 2011-01-05  5:56           ` Mi Jinlong
  2011-01-05 17:35             ` J. Bruce Fields
  0 siblings, 1 reply; 9+ messages in thread
From: Mi Jinlong @ 2011-01-05  5:56 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: NFSv3 list



J. Bruce Fields:
> On Thu, Dec 30, 2010 at 11:16:44AM +0800, Mi Jinlong wrote:
>> Hi Bruce:
>>
>> J. Bruce Fields:
>>> On Mon, Nov 15, 2010 at 04:12:43PM +0800, Mi Jinlong wrote:
>>>> J. Bruce Fields:
>>>>> On Thu, Nov 11, 2010 at 06:03:40PM +0800, Mi Jinlong wrote:
>>>>>> At the latest kernel(2.6.37-rc1), server just initialize the forechannel
>>>>>> at init_forechannel_attrs, but don't reflect it to reply.
>>>>>>
>>>>>> After initialize the session success, we should copy the forechannel info
>>>>>> to nfsd4_create_session struct.
>>>>> Thanks!
>>>>>
>>>>> Is there a chance you could write a pynfs test for this?
>>>> Maybe the following one is OK.
>>> Yes, thanks very much.  But could we use a larger MAX_SLOTS_PER_SESSION
>>> value, to increase the chances this test will make sense for any
>>> server?
>>   Yes, but we can't use a huge value as 1000000 for that the test site
>>   will allocate replay_cache for each fore_channel.maxrequests when get
>>   the reply of CREATE_SESSION.
> 
> pynfs should only allocate enough for the returned maxrequests, right?

  Yes, it does like that. If server return a wrong maxrequests as 1000000, 
  it will allocate 1000000 replay_cache. So we should set a small one here.

> 
>> If setting to 1000000 or more huger, 
>>   when the test case fail, the test site will eat many memory. 
>>
>>   So, we should set it less than 1000 and add an explain.
>>
>>> Also, this is a "reply", not a "replay", test, so move it a little
>>> later; how about the following?
>>   Sorry for that, it's a typo. ^_^
>>
>>   Maybe we should set the TOO_MANY_SLOTS less than 1000, after testing,
>>   the patch is as following:
>>
>>   Ps: delete the semicolon at the latest line.
> 
> Whoops, I obviously don't do much python....
> 
> --b.
> 
>> >From 2f544fcef0eef7ac1d59bc428be3436ad7d1bbde Mon Sep 17 00:00:00 2001
>> From: Mi Jinlong <mijinlong@cn.fujitsu.com>
>> Date: Wed, 29 Dec 2010 16:06:30 +0800
>> Subject: [PATCH] SRVR: Can server return fore_channel maxreqs correctly
>>
>>     SRVR: Can server return fore_channel maxreqs correctly
>>     
>>     When client set the fore_channel maxreqs larger than server's
>>     NFSD_MAX_SLOTS_PER_SESSION at create_session, the fore_channel
>>     maxreqs at the reply must less than NFSD_MAX_SLOTS_PER_SESSION.
>>     
>>     At 2.6.37-rc1, the NFSD_MAX_SLOTS_PER_SESSION is 160.
>>     
>>     Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
>>     Signed-off-by: J. Bruce Fields <bfields@redhat.com>
>>
>> ---
>>  nfs4.1/server41tests/st_create_session.py |   19 +++++++++++++++++++
>>  1 files changed, 19 insertions(+), 0 deletions(-)
>>
>> diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
>> index 5f425d4..5cfac14 100644
>> --- a/nfs4.1/server41tests/st_create_session.py
>> +++ b/nfs4.1/server41tests/st_create_session.py
>> @@ -363,3 +363,22 @@ def testCallbackVersion(t, env):
>>                   (cb_occurred.low, cb_occurred.hi, cb_occurred.vers))
>>      finally:
>>          env.c1._check_version = orig
>> +
>> +def testMaxreqs(t, env):
>> +    """A CREATE_SESSION with maxreqs too large should return
>> +       a modified value
>> +
>> +    FLAGS: create_session all
>> +    CODE: CSESS22
>> +    """
>> +    # Assuming this is too large for any server; increase if necessary:
>> +    # but too huge will eat many memory for replay_cache, becareful it!
>> +    TOO_MANY_SLOTS = 500
>> +
>> +    c = env.c1.new_client(env.testname(t))
>> +    # CREATE_SESSION with fore_channel = TOO_MANY_SLOTS
>> +    chan_attrs = channel_attrs4(0,8192,8192,8192,128, TOO_MANY_SLOTS, [])
>> +    sess1 = c.create_session(fore_attrs=chan_attrs)
>> +    if nfs4lib.test_equal(sess1.fore_channel.maxrequests,
>> +                          chan_attrs.ca_maxrequests, "count4"):
>> +        fail("Server allows surprisingly large fore_channel maxreqs")
>> -- 
>> 1.7.3.3
>>
> 

-- 
----
thanks
Mi Jinlong


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

* Re: [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session
  2011-01-05  5:56           ` Mi Jinlong
@ 2011-01-05 17:35             ` J. Bruce Fields
  0 siblings, 0 replies; 9+ messages in thread
From: J. Bruce Fields @ 2011-01-05 17:35 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: NFSv3 list

On Wed, Jan 05, 2011 at 01:56:18PM +0800, Mi Jinlong wrote:
> 
> 
> J. Bruce Fields:
> > On Thu, Dec 30, 2010 at 11:16:44AM +0800, Mi Jinlong wrote:
> >> Hi Bruce:
> >>
> >> J. Bruce Fields:
> >>> On Mon, Nov 15, 2010 at 04:12:43PM +0800, Mi Jinlong wrote:
> >>>> J. Bruce Fields:
> >>>>> On Thu, Nov 11, 2010 at 06:03:40PM +0800, Mi Jinlong wrote:
> >>>>>> At the latest kernel(2.6.37-rc1), server just initialize the forechannel
> >>>>>> at init_forechannel_attrs, but don't reflect it to reply.
> >>>>>>
> >>>>>> After initialize the session success, we should copy the forechannel info
> >>>>>> to nfsd4_create_session struct.
> >>>>> Thanks!
> >>>>>
> >>>>> Is there a chance you could write a pynfs test for this?
> >>>> Maybe the following one is OK.
> >>> Yes, thanks very much.  But could we use a larger MAX_SLOTS_PER_SESSION
> >>> value, to increase the chances this test will make sense for any
> >>> server?
> >>   Yes, but we can't use a huge value as 1000000 for that the test site
> >>   will allocate replay_cache for each fore_channel.maxrequests when get
> >>   the reply of CREATE_SESSION.
> > 
> > pynfs should only allocate enough for the returned maxrequests, right?
> 
>   Yes, it does like that. If server return a wrong maxrequests as 1000000, 
>   it will allocate 1000000 replay_cache. So we should set a small one here.

Thanks, I understand now.  Sure, let's go with your solution--applied.

--b.

> 
> > 
> >> If setting to 1000000 or more huger, 
> >>   when the test case fail, the test site will eat many memory. 
> >>
> >>   So, we should set it less than 1000 and add an explain.
> >>
> >>> Also, this is a "reply", not a "replay", test, so move it a little
> >>> later; how about the following?
> >>   Sorry for that, it's a typo. ^_^
> >>
> >>   Maybe we should set the TOO_MANY_SLOTS less than 1000, after testing,
> >>   the patch is as following:
> >>
> >>   Ps: delete the semicolon at the latest line.
> > 
> > Whoops, I obviously don't do much python....
> > 
> > --b.
> > 
> >> >From 2f544fcef0eef7ac1d59bc428be3436ad7d1bbde Mon Sep 17 00:00:00 2001
> >> From: Mi Jinlong <mijinlong@cn.fujitsu.com>
> >> Date: Wed, 29 Dec 2010 16:06:30 +0800
> >> Subject: [PATCH] SRVR: Can server return fore_channel maxreqs correctly
> >>
> >>     SRVR: Can server return fore_channel maxreqs correctly
> >>     
> >>     When client set the fore_channel maxreqs larger than server's
> >>     NFSD_MAX_SLOTS_PER_SESSION at create_session, the fore_channel
> >>     maxreqs at the reply must less than NFSD_MAX_SLOTS_PER_SESSION.
> >>     
> >>     At 2.6.37-rc1, the NFSD_MAX_SLOTS_PER_SESSION is 160.
> >>     
> >>     Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
> >>     Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> >>
> >> ---
> >>  nfs4.1/server41tests/st_create_session.py |   19 +++++++++++++++++++
> >>  1 files changed, 19 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
> >> index 5f425d4..5cfac14 100644
> >> --- a/nfs4.1/server41tests/st_create_session.py
> >> +++ b/nfs4.1/server41tests/st_create_session.py
> >> @@ -363,3 +363,22 @@ def testCallbackVersion(t, env):
> >>                   (cb_occurred.low, cb_occurred.hi, cb_occurred.vers))
> >>      finally:
> >>          env.c1._check_version = orig
> >> +
> >> +def testMaxreqs(t, env):
> >> +    """A CREATE_SESSION with maxreqs too large should return
> >> +       a modified value
> >> +
> >> +    FLAGS: create_session all
> >> +    CODE: CSESS22
> >> +    """
> >> +    # Assuming this is too large for any server; increase if necessary:
> >> +    # but too huge will eat many memory for replay_cache, becareful it!
> >> +    TOO_MANY_SLOTS = 500
> >> +
> >> +    c = env.c1.new_client(env.testname(t))
> >> +    # CREATE_SESSION with fore_channel = TOO_MANY_SLOTS
> >> +    chan_attrs = channel_attrs4(0,8192,8192,8192,128, TOO_MANY_SLOTS, [])
> >> +    sess1 = c.create_session(fore_attrs=chan_attrs)
> >> +    if nfs4lib.test_equal(sess1.fore_channel.maxrequests,
> >> +                          chan_attrs.ca_maxrequests, "count4"):
> >> +        fail("Server allows surprisingly large fore_channel maxreqs")
> >> -- 
> >> 1.7.3.3
> >>
> > 
> 
> -- 
> ----
> thanks
> Mi Jinlong
> 

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

end of thread, other threads:[~2011-01-05 17:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-11 10:03 [PATCH] NFS4.1: Fix bug server don't reply the right fore_channel to client at create_session Mi Jinlong
2010-11-11 13:32 ` Benny Halevy
2010-11-12 20:45 ` J. Bruce Fields
2010-11-15  8:12   ` Mi Jinlong
2010-12-29 19:35     ` J. Bruce Fields
2010-12-30  3:16       ` Mi Jinlong
2011-01-05  1:00         ` J. Bruce Fields
2011-01-05  5:56           ` Mi Jinlong
2011-01-05 17:35             ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).