From: Tom Haynes <loghyr@primarydata.com>
To: "J. Bruce Fields" <bfields@redhat.com>
Cc: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH pynfs 02/12] Close the files opened in the OPEN tests
Date: Sat, 26 Nov 2016 22:26:31 -0800 [thread overview]
Message-ID: <1480228001-64821-3-git-send-email-loghyr@primarydata.com> (raw)
In-Reply-To: <1480228001-64821-1-git-send-email-loghyr@primarydata.com>
Otherwise open files are left behind and as each test gets
their own client ID.
Also, as OPEN7 can get a delegation from an agressive server
and pynfs does not handle CBs, do not get the delegation.
Signed-off-by: Tom Haynes <loghyr@primarydata.com>
---
nfs4.1/server41tests/st_open.py | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/nfs4.1/server41tests/st_open.py b/nfs4.1/server41tests/st_open=
.py
index 235212c..473732d 100644
--- a/nfs4.1/server41tests/st_open.py
+++ b/nfs4.1/server41tests/st_open.py
@@ -29,12 +29,17 @@ def testSupported(t, env):
# See 8.1.3.1 of draft-10:
# the server MUST provide an "seqid" value starting at one...
expect(res, seqid=3D1)
+ fh =3D res.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
=20
# STUB - need to check open_res.delegation.delegation_type
# see draft-10 line 19445
# QUESTION - what does "If the server supports the new _WANT_ flags" m=
ean?
# will the server return INVAL? NOTSUPP? or just silently ignore?
=20
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
+
def testServerStateSeqid(t, env):
"""Do multiple OPENs of a file, check that server bumps stateid.seqid
=20
@@ -51,8 +56,14 @@ def testServerStateSeqid(t, env):
res =3D open_file(sess1, owner, path, access=3DOPEN4_SHARE_ACCESS_READ=
)
check(res)
expect(res, seqid=3D2)
+ fh =3D res.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
+
# STUB - need to check no delegation return
=20
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
+
def testReadWrite(t, env):
"""Do a simple READ and WRITE
=20
@@ -78,6 +89,9 @@ def testReadWrite(t, env):
if res.resarray[-1].data !=3D desired:
fail("Expected %r, got %r" % (desired, res.resarray[-1].data))
=20
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
+
def testAnonReadWrite(t, env):
"""Do a simple READ and WRITE using anonymous stateid
=20
@@ -93,6 +107,7 @@ def testAnonReadWrite(t, env):
data =3D "write test data"
stateid =3D res.resarray[-2].stateid
res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
res =3D sess1.compound([op.putfh(fh), op.write(nfs4lib.state00, 5, FIL=
E_SYNC4, data)])
check(res)
res =3D sess1.compound([op.putfh(fh), op.read(nfs4lib.state00, 0, 1000=
)])
@@ -115,11 +130,16 @@ def testEXCLUSIVE4AtNameAttribute(t, env):
=20
res =3D create_file(sess1, env.testname(t), mode=3DEXCLUSIVE4_1)
check(res)
+ fh =3D res.resarray[-1].object
+ stateid =3D res.resarray[-2].stateid
=20
res =3D create_file(sess1, env.testname(t), mode=3DEXCLUSIVE4_1,
verifier =3D "Justtest")
check(res, NFS4ERR_EXIST)
=20
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
+
def testOPENClaimFH(t, env):
"""OPEN file with claim_type is CLAIM_FH
=20
@@ -127,7 +147,7 @@ def testOPENClaimFH(t, env):
CODE: OPEN7
"""
sess1 =3D env.c1.new_client_session(env.testname(t))
- res =3D create_file(sess1, env.testname(t))
+ res =3D create_file(sess1, env.testname(t), want_deleg=3DFalse)
check(res)
=20
fh =3D res.resarray[-1].object
@@ -138,7 +158,9 @@ def testOPENClaimFH(t, env):
claim =3D open_claim4(CLAIM_FH)
how =3D openflag4(OPEN4_NOCREATE)
oowner =3D open_owner4(0, "My Open Owner 2")
- open_op =3D op.open(0, OPEN4_SHARE_ACCESS_BOTH, OPEN4_SHARE_DENY_NONE,
+ access =3D OPEN4_SHARE_ACCESS_BOTH|OPEN4_SHARE_ACCESS_WANT_NO_DELEG
+
+ open_op =3D op.open(0, access, OPEN4_SHARE_DENY_NONE,
oowner, how, claim)
res =3D sess1.compound([op.putfh(fh), open_op])
check(res)
@@ -156,6 +178,9 @@ def testOPENClaimFH(t, env):
if res.resarray[-1].data !=3D desired:
fail("Expected %r, got %r" % (desired, res.resarray[-1].data))
=20
+ res =3D close_file(sess1, fh, stateid=3Dstateid)
+ check(res)
+
def testCloseWithZeroSeqid(t, env):
"""OPEN followed by CLOSE with stateid.seq =3D 0
=20
--=20
2.3.6
next prev parent reply other threads:[~2016-11-27 6:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-27 6:26 [PATCH pynfs 00/12] Flex File support Tom Haynes
2016-11-27 6:26 ` [PATCH pynfs 01/12] According to RFC7863, this is not an array Tom Haynes
2016-11-27 6:26 ` Tom Haynes [this message]
2016-11-27 6:26 ` [PATCH pynfs 03/12] Some more file closes to cleanup state on the server Tom Haynes
2016-11-27 6:26 ` [PATCH pynfs 04/12] Get rid of the client records as well as the session records Tom Haynes
2016-11-27 6:26 ` [PATCH pynfs 05/12] Really, really close those open temp files to remove state on the server Tom Haynes
2016-11-27 6:26 ` [PATCH pynfs 06/12] Add xdr for Flex Files Layout Type Tom Haynes
2016-11-27 6:26 ` [PATCH pynfs 07/12] Simple tests of the flex file layout type Tom Haynes
2016-11-27 6:26 ` [PATCH pynfs 08/12] Add a check to see if NFS4ERR_OLD_STATEID is issued on concurrent layoutgets Tom Haynes
2016-11-27 6:26 ` [PATCH pynfs 09/12] Check that the flex file access uid/gid are correct for the different iomodes Tom Haynes
2016-11-27 6:26 ` [PATCH pynfs 10/12] FFLS1: Simulate LAYOUTSTATS for 20 small file creations Tom Haynes
2016-11-27 6:26 ` [PATCH pynfs 11/12] Factor out checking seqid for flex file layouts Tom Haynes
2016-11-27 6:26 ` [PATCH pynfs 12/12] Add layoutstats tests for flex files Tom Haynes
2016-11-28 17:22 ` J. Bruce Fields
2016-11-28 17:52 ` Tom Haynes
2016-11-28 16:33 ` [PATCH pynfs 00/12] Flex File support J. Bruce Fields
2016-11-28 16:53 ` Tom Haynes
2016-11-28 21:47 ` J. Bruce Fields
2016-11-28 23:38 ` Tom Haynes
2016-11-29 1:55 ` J. Bruce Fields
2016-11-29 23:44 ` Frank Filz
2016-11-30 14:24 ` J. Bruce Fields
2016-11-30 16:56 ` Frank Filz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480228001-64821-3-git-send-email-loghyr@primarydata.com \
--to=loghyr@primarydata.com \
--cc=bfields@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).