2011-08-18 02:14:29

by Mi Jinlong

[permalink] [raw]
Subject: [PATCH 0/4 v3] pynfs41: Add some tests for RECLAIM_COMPLETE

Some tests for RECLAIM_COMPLETE.

--
----
thanks
Mi Jinlong



2011-08-18 02:15:43

by Mi Jinlong

[permalink] [raw]
Subject: [PATCH 1/4 v3] 4.1 CLNT: add a simple test about RECLAIM_COMPLETE

Signed-off-by: Mi Jinlong <[email protected]>
---
nfs4.1/server41tests/__init__.py | 1 +
nfs4.1/server41tests/st_reclaim_complete.py | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
create mode 100644 nfs4.1/server41tests/st_reclaim_complete.py

diff --git a/nfs4.1/server41tests/__init__.py b/nfs4.1/server41tests/__init__.py
index 3b4411a..1cc2048 100644
--- a/nfs4.1/server41tests/__init__.py
+++ b/nfs4.1/server41tests/__init__.py
@@ -2,6 +2,7 @@ __all__ = ["st_exchange_id.py", # draft 21
"st_compound.py",
"st_create_session.py",
"st_destroy_session.py",
+ "st_reclaim_complete.py",
"st_secinfo_no_name.py",
"st_secinfo.py",
"st_sequence.py",
diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
new file mode 100644
index 0000000..a591ef5
--- /dev/null
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -0,0 +1,21 @@
+from st_create_session import create_session
+from nfs4_const import *
+from environment import check, fail
+import nfs4_ops as op
+import nfs4lib
+
+def testSupported(t, env):
+ """Do a simple RECLAIM_COMPLETE
+
+ FLAGS: reclaim_complete all
+ CODE: RECC1
+ """
+ c = env.c1.new_client(env.testname(t))
+ sess = c.create_session()
+
+ # RECLAIM_COMPLETE
+ res = sess.compound([op.putrootfh(), op.reclaim_complete(TRUE)])
+ check(res)
+
+ res = sess.compound([op.reclaim_complete(FALSE)])
+ check(res)
--
1.7.6



2011-08-23 21:43:47

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 1/4 v3] 4.1 CLNT: add a simple test about RECLAIM_COMPLETE

On Thu, Aug 18, 2011 at 10:19:50AM +0800, Mi Jinlong wrote:
> Signed-off-by: Mi Jinlong <[email protected]>

Is it even possible to run this test without an earlier RECLAIM_COMPLETE
failing? I guess so, if you just run this one test without --maketree.

OK.

--b.

> ---
> nfs4.1/server41tests/__init__.py | 1 +
> nfs4.1/server41tests/st_reclaim_complete.py | 21 +++++++++++++++++++++
> 2 files changed, 22 insertions(+), 0 deletions(-)
> create mode 100644 nfs4.1/server41tests/st_reclaim_complete.py
>
> diff --git a/nfs4.1/server41tests/__init__.py b/nfs4.1/server41tests/__init__.py
> index 3b4411a..1cc2048 100644
> --- a/nfs4.1/server41tests/__init__.py
> +++ b/nfs4.1/server41tests/__init__.py
> @@ -2,6 +2,7 @@ __all__ = ["st_exchange_id.py", # draft 21
> "st_compound.py",
> "st_create_session.py",
> "st_destroy_session.py",
> + "st_reclaim_complete.py",
> "st_secinfo_no_name.py",
> "st_secinfo.py",
> "st_sequence.py",
> diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
> new file mode 100644
> index 0000000..a591ef5
> --- /dev/null
> +++ b/nfs4.1/server41tests/st_reclaim_complete.py
> @@ -0,0 +1,21 @@
> +from st_create_session import create_session
> +from nfs4_const import *
> +from environment import check, fail
> +import nfs4_ops as op
> +import nfs4lib
> +
> +def testSupported(t, env):
> + """Do a simple RECLAIM_COMPLETE
> +
> + FLAGS: reclaim_complete all
> + CODE: RECC1
> + """
> + c = env.c1.new_client(env.testname(t))
> + sess = c.create_session()
> +
> + # RECLAIM_COMPLETE
> + res = sess.compound([op.putrootfh(), op.reclaim_complete(TRUE)])
> + check(res)
> +
> + res = sess.compound([op.reclaim_complete(FALSE)])
> + check(res)
> --
> 1.7.6
>
>

2011-08-24 08:22:49

by Mi Jinlong

[permalink] [raw]
Subject: Re: [PATCH 1/4 v3] 4.1 CLNT: add a simple test about RECLAIM_COMPLETE



J. Bruce Fields :
> On Thu, Aug 18, 2011 at 10:19:50AM +0800, Mi Jinlong wrote:
>> Signed-off-by: Mi Jinlong <[email protected]>
>
> Is it even possible to run this test without an earlier RECLAIM_COMPLETE
> failing? I guess so, if you just run this one test without --maketree.

NO, it's OK. As:

]# ./testserver.py --outfile=first.log 127.0.0.1:/ RECC1
INFO :rpc.poll:got connection from ('127.0.0.1', 52268), assigned to fd=5
INFO :rpc.thread:Called connect(('127.0.0.1', 2049))
INFO :rpc.poll:Adding 6 generated by another thread
INFO :test.env:Created client to 127.0.0.1, 2049
INFO :nfs.client.cb:********************
INFO :nfs.client.cb:Handling CB_NULL
INFO :test.env:Called do_readdir()
INFO :test.env:do_readdir() = []
INFO :nfs.client.cb:********************
INFO :nfs.client.cb:Handling CB_NULL
**************************************************
RECC1 st_reclaim_complete.testSupported : PASS
**************************************************
Command line asked for 1 of 165 tests
Of those: 0 Skipped, 0 Failed, 0 Warned, 1 Passed

thanks,
Mi Jinlong

>
>> ---
>> nfs4.1/server41tests/__init__.py | 1 +
>> nfs4.1/server41tests/st_reclaim_complete.py | 21 +++++++++++++++++++++
>> 2 files changed, 22 insertions(+), 0 deletions(-)
>> create mode 100644 nfs4.1/server41tests/st_reclaim_complete.py
>>
>> diff --git a/nfs4.1/server41tests/__init__.py b/nfs4.1/server41tests/__init__.py
>> index 3b4411a..1cc2048 100644
>> --- a/nfs4.1/server41tests/__init__.py
>> +++ b/nfs4.1/server41tests/__init__.py
>> @@ -2,6 +2,7 @@ __all__ = ["st_exchange_id.py", # draft 21
>> "st_compound.py",
>> "st_create_session.py",
>> "st_destroy_session.py",
>> + "st_reclaim_complete.py",
>> "st_secinfo_no_name.py",
>> "st_secinfo.py",
>> "st_sequence.py",
>> diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
>> new file mode 100644
>> index 0000000..a591ef5
>> --- /dev/null
>> +++ b/nfs4.1/server41tests/st_reclaim_complete.py
>> @@ -0,0 +1,21 @@
>> +from st_create_session import create_session
>> +from nfs4_const import *
>> +from environment import check, fail
>> +import nfs4_ops as op
>> +import nfs4lib
>> +
>> +def testSupported(t, env):
>> + """Do a simple RECLAIM_COMPLETE
>> +
>> + FLAGS: reclaim_complete all
>> + CODE: RECC1
>> + """
>> + c = env.c1.new_client(env.testname(t))
>> + sess = c.create_session()
>> +
>> + # RECLAIM_COMPLETE
>> + res = sess.compound([op.putrootfh(), op.reclaim_complete(TRUE)])
>> + check(res)
>> +
>> + res = sess.compound([op.reclaim_complete(FALSE)])
>> + check(res)
>> --
>> 1.7.6
>>
>>
>
>


2011-08-18 02:17:57

by Mi Jinlong

[permalink] [raw]
Subject: [PATCH 4/4 v3] 4.1 CLNT: test RECLAIM_COMPLETE twice

Signed-off-by: Mi Jinlong <[email protected]>
---
nfs4.1/server41tests/st_reclaim_complete.py | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
index 921d537..7c9f2b8 100644
--- a/nfs4.1/server41tests/st_reclaim_complete.py
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -66,3 +66,22 @@ def testOpenBeforeRECC(t, env):
# Try to open file before RECLAIM_COMPLETE
res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH)
check(res,NFS4ERR_GRACE)
+
+def testDoubleRECC(t, env):
+ """If RECLAIM_COMPLETE is done a second time, error
+ NFS4ERR_COMPLETE_ALREADY will be returned. rfc5661 18.51.4
+
+ FLAGS: reclaim_complete all
+ CODE: RECC4
+ """
+ name = env.testname(t)
+ c = env.c1.new_client(name)
+ sess = c.create_session()
+
+ # RECLAIM_COMPLETE
+ res = sess.compound([op.reclaim_complete(FALSE)])
+ check(res)
+
+ # RECLAIM_COMPLETE again
+ res = sess.compound([op.reclaim_complete(FALSE)])
+ check(res, NFS4ERR_COMPLETE_ALREADY)
--
1.7.6



2011-08-24 08:50:18

by Mi Jinlong

[permalink] [raw]
Subject: [PATCH 4/4 v4] 4.1 CLNT: test RECLAIM_COMPLETE twice

Signed-off-by: Mi Jinlong <[email protected]>
---
nfs4.1/server41tests/st_reclaim_complete.py | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
index adb368d..f6baf09 100644
--- a/nfs4.1/server41tests/st_reclaim_complete.py
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -63,3 +63,21 @@ def testOpenBeforeRECC(t, env):

res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH)
check(res, NFS4ERR_GRACE)
+
+def testDoubleRECC(t, env):
+ """If RECLAIM_COMPLETE is done a second time, error
+ NFS4ERR_COMPLETE_ALREADY will be returned. rfc5661 18.51.4
+
+ FLAGS: reclaim_complete all
+ CODE: RECC4
+ """
+ name = env.testname(t)
+ c = env.c1.new_client(name)
+ sess = c.create_session()
+
+ res = sess.compound([op.reclaim_complete(FALSE)])
+ check(res)
+
+ # RECLAIM_COMPLETE again
+ res = sess.compound([op.reclaim_complete(FALSE)])
+ check(res, NFS4ERR_COMPLETE_ALREADY)
--
1.7.6



2011-08-24 08:50:05

by Mi Jinlong

[permalink] [raw]
Subject: [PATCH 3/4 v4] 4.1 CLNT: test open before RECLAIM_COMPLETE

Signed-off-by: Mi Jinlong <[email protected]>
---
nfs4.1/server41tests/st_reclaim_complete.py | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
index 108e7b6..adb368d 100644
--- a/nfs4.1/server41tests/st_reclaim_complete.py
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -1,6 +1,6 @@
from st_create_session import create_session
from nfs4_const import *
-from environment import check, fail, open_file, create_confirm
+from environment import check, fail, open_file, create_file, create_confirm
import nfs4_ops as op
import nfs4lib

@@ -45,3 +45,21 @@ def testReclaimAfterRECC(t, env):
deleg_type=OPEN_DELEGATE_NONE)

check(res, NFS4ERR_NO_GRACE, warnlist = [NFS4ERR_EXIST | NFS4ERR_RECLAIM_BAD])
+
+def testOpenBeforeRECC(t, env):
+ """After a client establishes a new client ID, if non-reclaim
+ locking operations are done before the RECLAIM_COMPLETE,
+ error NFS4ERR_GRACE will be returned. rfc5661 18.51.3
+
+ FLAGS: reclaim_complete all
+ CODE: RECC3
+ """
+ name = env.testname(t)
+ c = env.c1.new_client(name)
+ sess = c.create_session()
+
+ fname = "owner_%s" % name
+ path = sess.c.homedir + [name]
+
+ res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH)
+ check(res, NFS4ERR_GRACE)
--
1.7.6



2011-08-24 08:49:56

by Mi Jinlong

[permalink] [raw]
Subject: [PATCH 2/4 v4] 4.1 CLNT: test reclaims after RECLAIM_COMPLETE

Signed-off-by: Mi Jinlong <[email protected]>
---
nfs4.1/server41tests/st_reclaim_complete.py | 29 ++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
index bc63ed8..108e7b6 100644
--- a/nfs4.1/server41tests/st_reclaim_complete.py
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -1,6 +1,6 @@
from st_create_session import create_session
from nfs4_const import *
-from environment import check, fail
+from environment import check, fail, open_file, create_confirm
import nfs4_ops as op
import nfs4lib

@@ -18,3 +18,30 @@ def testSupported(t, env):

res = sess.compound([op.reclaim_complete(FALSE)])
check(res)
+
+def testReclaimAfterRECC(t, env):
+ """If client does subsequent reclaims of locking state after
+ RECLAIM_COMPLETE is done, server will return NFS4ERR_NO_GRACE.
+ rfc5661 18.51.3
+
+ FLAGS: reclaim_complete all
+ CODE: RECC2
+ """
+ name = env.testname(t)
+ c = env.c1.new_client(name)
+ sess = c.create_session()
+
+ res = sess.compound([op.reclaim_complete(FALSE)])
+ check(res)
+
+ owner = "owner_%s" % name
+ path = sess.c.homedir + [name]
+ fh, stateid = create_confirm(sess, owner)
+
+ # Try to reclaims a file which is noexist after RECLAIM_COMPLETE
+ res = open_file(sess, owner, path=fh, claim_type=CLAIM_PREVIOUS,
+ access=OPEN4_SHARE_ACCESS_BOTH,
+ deny=OPEN4_SHARE_DENY_NONE,
+ deleg_type=OPEN_DELEGATE_NONE)
+
+ check(res, NFS4ERR_NO_GRACE, warnlist = [NFS4ERR_EXIST | NFS4ERR_RECLAIM_BAD])
--
1.7.6



2011-08-23 21:51:41

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 3/4 v3] 4.1 CLNT: test open before RECLAIM_COMPLETE

On Thu, Aug 18, 2011 at 10:21:15AM +0800, Mi Jinlong wrote:
> Signed-off-by: Mi Jinlong <[email protected]>

Same nits as previous ones (comments mostly repeat what the code says,
space needed after comma between function arguments).

Looks reasonable otherwise.

--b.

> ---
> nfs4.1/server41tests/st_reclaim_complete.py | 21 ++++++++++++++++++++-
> 1 files changed, 20 insertions(+), 1 deletions(-)
>
> diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
> index 3940b7b..921d537 100644
> --- a/nfs4.1/server41tests/st_reclaim_complete.py
> +++ b/nfs4.1/server41tests/st_reclaim_complete.py
> @@ -1,6 +1,6 @@
> from st_create_session import create_session
> from nfs4_const import *
> -from environment import check, fail, open_file, create_confirm
> +from environment import check, fail, open_file, create_file, create_confirm
> import nfs4_ops as op
> import nfs4lib
>
> @@ -47,3 +47,22 @@ def testReclaimAfterRECC(t, env):
> deleg_type=OPEN_DELEGATE_NONE)
>
> check(res,NFS4ERR_NO_GRACE)
> +
> +def testOpenBeforeRECC(t, env):
> + """After a client establishes a new client ID, if non-reclaim
> + locking operations are done before the RECLAIM_COMPLETE,
> + error NFS4ERR_GRACE will be returned. rfc5661 18.51.3
> +
> + FLAGS: reclaim_complete all
> + CODE: RECC3
> + """
> + name = env.testname(t)
> + c = env.c1.new_client(name)
> + sess = c.create_session()
> +
> + fname = "owner_%s" % name
> + path = sess.c.homedir + [name]
> +
> + # Try to open file before RECLAIM_COMPLETE
> + res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH)
> + check(res,NFS4ERR_GRACE)
> --
> 1.7.6
>
>

2011-08-23 21:52:05

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 4/4 v3] 4.1 CLNT: test RECLAIM_COMPLETE twice

On Thu, Aug 18, 2011 at 10:22:05AM +0800, Mi Jinlong wrote:
> Signed-off-by: Mi Jinlong <[email protected]>
> ---
> nfs4.1/server41tests/st_reclaim_complete.py | 19 +++++++++++++++++++
> 1 files changed, 19 insertions(+), 0 deletions(-)

Looks OK.

--b.

>
> diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
> index 921d537..7c9f2b8 100644
> --- a/nfs4.1/server41tests/st_reclaim_complete.py
> +++ b/nfs4.1/server41tests/st_reclaim_complete.py
> @@ -66,3 +66,22 @@ def testOpenBeforeRECC(t, env):
> # Try to open file before RECLAIM_COMPLETE
> res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH)
> check(res,NFS4ERR_GRACE)
> +
> +def testDoubleRECC(t, env):
> + """If RECLAIM_COMPLETE is done a second time, error
> + NFS4ERR_COMPLETE_ALREADY will be returned. rfc5661 18.51.4
> +
> + FLAGS: reclaim_complete all
> + CODE: RECC4
> + """
> + name = env.testname(t)
> + c = env.c1.new_client(name)
> + sess = c.create_session()
> +
> + # RECLAIM_COMPLETE
> + res = sess.compound([op.reclaim_complete(FALSE)])
> + check(res)
> +
> + # RECLAIM_COMPLETE again
> + res = sess.compound([op.reclaim_complete(FALSE)])
> + check(res, NFS4ERR_COMPLETE_ALREADY)
> --
> 1.7.6
>
>

2011-08-23 21:50:41

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 2/4 v3] 4.1 CLNT: test reclaims after RECLAIM_COMPLETE

On Thu, Aug 18, 2011 at 10:20:40AM +0800, Mi Jinlong wrote:
> Signed-off-by: Mi Jinlong <[email protected]>
> ---
> nfs4.1/server41tests/st_reclaim_complete.py | 30 ++++++++++++++++++++++++++-
> 1 files changed, 29 insertions(+), 1 deletions(-)

Just nits:

>
> diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
> index a591ef5..3940b7b 100644
> --- a/nfs4.1/server41tests/st_reclaim_complete.py
> +++ b/nfs4.1/server41tests/st_reclaim_complete.py
> @@ -1,6 +1,6 @@
> from st_create_session import create_session
> from nfs4_const import *
> -from environment import check, fail
> +from environment import check, fail, open_file, create_confirm
> import nfs4_ops as op
> import nfs4lib
>
> @@ -19,3 +19,31 @@ def testSupported(t, env):
>
> res = sess.compound([op.reclaim_complete(FALSE)])
> check(res)
> +
> +def testReclaimAfterRECC(t, env):
> + """If client does subsequent reclaims of locking state after
> + RECLAIM_COMPLETE is done, server will return NFS4ERR_NO_GRACE.
> + rfc5661 18.51.3
> +
> + FLAGS: reclaim_complete all
> + CODE: RECC2
> + """
> + name = env.testname(t)
> + c = env.c1.new_client(name)
> + sess = c.create_session()
> +
> + # RECLAIM_COMPLETE

This comment doesn't explain anything not already obvious from the code.

> + res = sess.compound([op.reclaim_complete(FALSE)])
> + check(res)
> +
> + owner = "owner_%s" % name
> + path = sess.c.homedir + [name]
> + fh, stateid = create_confirm(sess, owner)
> +
> + # Try to reclaims after RECLAIM_COMPLETE

Ditto.

> + res = open_file(sess, owner, path=fh, claim_type=CLAIM_PREVIOUS,
> + access=OPEN4_SHARE_ACCESS_BOTH,
> + deny=OPEN4_SHARE_DENY_NONE,
> + deleg_type=OPEN_DELEGATE_NONE)
> +
> + check(res,NFS4ERR_NO_GRACE)

Make the "," a ", ".

Also: in this case:

- the file we're trying to open doesn't exist
- the client we just created probably isn't allowed to reclaim

So NFS4ERR_EXIST and NFS4ERR_RECLAIM_BAD are probably both legal error
returns as well. I don't think the spec mandates that these be checked
in any particular order.

--b.

> --
> 1.7.6
>
>

2011-08-18 02:17:07

by Mi Jinlong

[permalink] [raw]
Subject: [PATCH 3/4 v3] 4.1 CLNT: test open before RECLAIM_COMPLETE

Signed-off-by: Mi Jinlong <[email protected]>
---
nfs4.1/server41tests/st_reclaim_complete.py | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
index 3940b7b..921d537 100644
--- a/nfs4.1/server41tests/st_reclaim_complete.py
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -1,6 +1,6 @@
from st_create_session import create_session
from nfs4_const import *
-from environment import check, fail, open_file, create_confirm
+from environment import check, fail, open_file, create_file, create_confirm
import nfs4_ops as op
import nfs4lib

@@ -47,3 +47,22 @@ def testReclaimAfterRECC(t, env):
deleg_type=OPEN_DELEGATE_NONE)

check(res,NFS4ERR_NO_GRACE)
+
+def testOpenBeforeRECC(t, env):
+ """After a client establishes a new client ID, if non-reclaim
+ locking operations are done before the RECLAIM_COMPLETE,
+ error NFS4ERR_GRACE will be returned. rfc5661 18.51.3
+
+ FLAGS: reclaim_complete all
+ CODE: RECC3
+ """
+ name = env.testname(t)
+ c = env.c1.new_client(name)
+ sess = c.create_session()
+
+ fname = "owner_%s" % name
+ path = sess.c.homedir + [name]
+
+ # Try to open file before RECLAIM_COMPLETE
+ res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH)
+ check(res,NFS4ERR_GRACE)
--
1.7.6



2011-08-24 08:49:38

by Mi Jinlong

[permalink] [raw]
Subject: [PATCH 1/4 v4] 4.1 CLNT: add a simple test about RECLAIM_COMPLETE

Signed-off-by: Mi Jinlong <[email protected]>
---
nfs4.1/server41tests/__init__.py | 1 +
nfs4.1/server41tests/st_reclaim_complete.py | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
create mode 100644 nfs4.1/server41tests/st_reclaim_complete.py

diff --git a/nfs4.1/server41tests/__init__.py b/nfs4.1/server41tests/__init__.py
index 3b4411a..1cc2048 100644
--- a/nfs4.1/server41tests/__init__.py
+++ b/nfs4.1/server41tests/__init__.py
@@ -2,6 +2,7 @@ __all__ = ["st_exchange_id.py", # draft 21
"st_compound.py",
"st_create_session.py",
"st_destroy_session.py",
+ "st_reclaim_complete.py",
"st_secinfo_no_name.py",
"st_secinfo.py",
"st_sequence.py",
diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
new file mode 100644
index 0000000..bc63ed8
--- /dev/null
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -0,0 +1,20 @@
+from st_create_session import create_session
+from nfs4_const import *
+from environment import check, fail
+import nfs4_ops as op
+import nfs4lib
+
+def testSupported(t, env):
+ """Do a simple RECLAIM_COMPLETE
+
+ FLAGS: reclaim_complete all
+ CODE: RECC1
+ """
+ c = env.c1.new_client(env.testname(t))
+ sess = c.create_session()
+
+ res = sess.compound([op.putrootfh(), op.reclaim_complete(TRUE)])
+ check(res)
+
+ res = sess.compound([op.reclaim_complete(FALSE)])
+ check(res)
--
1.7.6




2011-08-18 02:16:33

by Mi Jinlong

[permalink] [raw]
Subject: [PATCH 2/4 v3] 4.1 CLNT: test reclaims after RECLAIM_COMPLETE

Signed-off-by: Mi Jinlong <[email protected]>
---
nfs4.1/server41tests/st_reclaim_complete.py | 30 ++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
index a591ef5..3940b7b 100644
--- a/nfs4.1/server41tests/st_reclaim_complete.py
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -1,6 +1,6 @@
from st_create_session import create_session
from nfs4_const import *
-from environment import check, fail
+from environment import check, fail, open_file, create_confirm
import nfs4_ops as op
import nfs4lib

@@ -19,3 +19,31 @@ def testSupported(t, env):

res = sess.compound([op.reclaim_complete(FALSE)])
check(res)
+
+def testReclaimAfterRECC(t, env):
+ """If client does subsequent reclaims of locking state after
+ RECLAIM_COMPLETE is done, server will return NFS4ERR_NO_GRACE.
+ rfc5661 18.51.3
+
+ FLAGS: reclaim_complete all
+ CODE: RECC2
+ """
+ name = env.testname(t)
+ c = env.c1.new_client(name)
+ sess = c.create_session()
+
+ # RECLAIM_COMPLETE
+ res = sess.compound([op.reclaim_complete(FALSE)])
+ check(res)
+
+ owner = "owner_%s" % name
+ path = sess.c.homedir + [name]
+ fh, stateid = create_confirm(sess, owner)
+
+ # Try to reclaims after RECLAIM_COMPLETE
+ res = open_file(sess, owner, path=fh, claim_type=CLAIM_PREVIOUS,
+ access=OPEN4_SHARE_ACCESS_BOTH,
+ deny=OPEN4_SHARE_DENY_NONE,
+ deleg_type=OPEN_DELEGATE_NONE)
+
+ check(res,NFS4ERR_NO_GRACE)
--
1.7.6



2011-08-26 22:41:51

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 4/4 v4] 4.1 CLNT: test RECLAIM_COMPLETE twice

Thanks, these four look OK; I'll run a quick test and then push them out
to my repository.

--b.

On Wed, Aug 24, 2011 at 04:54:13PM +0800, Mi Jinlong wrote:
> Signed-off-by: Mi Jinlong <[email protected]>
> ---
> nfs4.1/server41tests/st_reclaim_complete.py | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
> index adb368d..f6baf09 100644
> --- a/nfs4.1/server41tests/st_reclaim_complete.py
> +++ b/nfs4.1/server41tests/st_reclaim_complete.py
> @@ -63,3 +63,21 @@ def testOpenBeforeRECC(t, env):
>
> res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH)
> check(res, NFS4ERR_GRACE)
> +
> +def testDoubleRECC(t, env):
> + """If RECLAIM_COMPLETE is done a second time, error
> + NFS4ERR_COMPLETE_ALREADY will be returned. rfc5661 18.51.4
> +
> + FLAGS: reclaim_complete all
> + CODE: RECC4
> + """
> + name = env.testname(t)
> + c = env.c1.new_client(name)
> + sess = c.create_session()
> +
> + res = sess.compound([op.reclaim_complete(FALSE)])
> + check(res)
> +
> + # RECLAIM_COMPLETE again
> + res = sess.compound([op.reclaim_complete(FALSE)])
> + check(res, NFS4ERR_COMPLETE_ALREADY)
> --
> 1.7.6
>
>