2015-10-20 16:01:10

by Jeff Layton

[permalink] [raw]
Subject: [PATCH 1/2] nfs41: add some READ/WRITE tests for special stateids

Signed-off-by: Jeff Layton <[email protected]>
---
nfs4.1/server41tests/st_open.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/nfs4.1/server41tests/st_open.py b/nfs4.1/server41tests/st_open.py
index 24f051e75e8f..235212cccaed 100644
--- a/nfs4.1/server41tests/st_open.py
+++ b/nfs4.1/server41tests/st_open.py
@@ -9,6 +9,7 @@ from xdrdef.nfs4_type import open_to_lock_owner4
import nfs_ops
op = nfs_ops.NFS4ops()
import threading
+import nfs4lib

def expect(res, seqid):
"""Verify that open result has expected stateid.seqid"""
@@ -77,6 +78,31 @@ def testReadWrite(t, env):
if res.resarray[-1].data != desired:
fail("Expected %r, got %r" % (desired, res.resarray[-1].data))

+def testAnonReadWrite(t, env):
+ """Do a simple READ and WRITE using anonymous stateid
+
+ FLAGS: open all
+ CODE: OPEN31
+ """
+ sess1 = env.c1.new_client_session(env.testname(t))
+ owner = open_owner4(0, "My Open Owner")
+ res = create_file(sess1, env.testname(t))
+ check(res)
+ expect(res, seqid=1)
+ fh = res.resarray[-1].object
+ data = "write test data"
+ stateid = res.resarray[-2].stateid
+ res = close_file(sess1, fh, stateid=stateid)
+ res = sess1.compound([op.putfh(fh), op.write(nfs4lib.state00, 5, FILE_SYNC4, data)])
+ check(res)
+ res = sess1.compound([op.putfh(fh), op.read(nfs4lib.state00, 0, 1000)])
+ check(res)
+ if not res.resarray[-1].eof:
+ fail("EOF not set on read")
+ desired = "\0"*5 + data
+ if res.resarray[-1].data != desired:
+ fail("Expected %r, got %r" % (desired, res.resarray[-1].data))
+
def testEXCLUSIVE4AtNameAttribute(t, env):
"""If the file does exist,but the stored verifier does not match,
then an error of NFS4ERR_EXIST is returned from server.
--
2.4.3



2015-10-20 16:01:10

by Jeff Layton

[permalink] [raw]
Subject: [PATCH 2/2] create_session: ensure that we send an auth flavor in CREATE_SESSION call

...it is required.

Signed-off-by: Jeff Layton <[email protected]>
---
nfs4.1/server41tests/st_create_session.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
index 4c56bb45cc8e..d3b7635545ba 100644
--- a/nfs4.1/server41tests/st_create_session.py
+++ b/nfs4.1/server41tests/st_create_session.py
@@ -13,7 +13,7 @@ def create_session(c, clientid, sequenceid, cred=None, flags=0):
chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
res = c.compound([op.create_session(clientid, sequenceid, flags,
chan_attrs, chan_attrs,
- 123, [])], cred)
+ 123, [callback_sec_parms4(0)])], cred)
return res

###############################################
@@ -305,7 +305,7 @@ def testRdmaArray2(t, env):
chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[13, 57])
ops = [op.create_session(c.clientid, c.seqid, 0,
chan_attrs, chan_attrs,
- c.c.prog, [])]
+ c.c.prog, [callback_sec_parms4(0)])]
c = c.c
xid = c.compound_async(ops, checks=False)
try:
--
2.4.3


2015-10-21 15:59:10

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 2/2] create_session: ensure that we send an auth flavor in CREATE_SESSION call

Thanks, both pynfs patches applied.--b.

On Tue, Oct 20, 2015 at 12:01:01PM -0400, Jeff Layton wrote:
> ...it is required.
>
> Signed-off-by: Jeff Layton <[email protected]>
> ---
> nfs4.1/server41tests/st_create_session.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
> index 4c56bb45cc8e..d3b7635545ba 100644
> --- a/nfs4.1/server41tests/st_create_session.py
> +++ b/nfs4.1/server41tests/st_create_session.py
> @@ -13,7 +13,7 @@ def create_session(c, clientid, sequenceid, cred=None, flags=0):
> chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
> res = c.compound([op.create_session(clientid, sequenceid, flags,
> chan_attrs, chan_attrs,
> - 123, [])], cred)
> + 123, [callback_sec_parms4(0)])], cred)
> return res
>
> ###############################################
> @@ -305,7 +305,7 @@ def testRdmaArray2(t, env):
> chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[13, 57])
> ops = [op.create_session(c.clientid, c.seqid, 0,
> chan_attrs, chan_attrs,
> - c.c.prog, [])]
> + c.c.prog, [callback_sec_parms4(0)])]
> c = c.c
> xid = c.compound_async(ops, checks=False)
> try:
> --
> 2.4.3