linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 05/12] Really, really close those open temp files to remove state on the server
Date: Sat, 26 Nov 2016 22:26:34 -0800	[thread overview]
Message-ID: <1480228001-64821-6-git-send-email-loghyr@primarydata.com> (raw)
In-Reply-To: <1480228001-64821-1-git-send-email-loghyr@primarydata.com>

Signed-off-by: Tom Haynes <loghyr@primarydata.com>
---
 nfs4.1/server41tests/st_current_stateid.py  | 24 ++++++++++++++++++++++++
 nfs4.1/server41tests/st_reclaim_complete.py |  4 ++++
 nfs4.1/server41tests/st_rename.py           |  4 ++++
 nfs4.1/server41tests/st_secinfo.py          | 20 ++++++++++++++++----
 nfs4.1/server41tests/st_sequence.py         |  8 ++++++++
 5 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/nfs4.1/server41tests/st_current_stateid.py b/nfs4.1/server41te=
sts/st_current_stateid.py
index 01d78c0..792eee8 100644
--- a/nfs4.1/server41tests/st_current_stateid.py
+++ b/nfs4.1/server41tests/st_current_stateid.py
@@ -99,10 +99,23 @@ def testOpenLookupClose(t, env):
=20
     fname =3D env.testname(t)
     open_op =3D open_create_file_op(sess1, fname, open_create=3DOPEN4_CREA=
TE)
+
     lookup_op =3D env.home + [op.lookup(fname)]
     res =3D sess1.compound(open_op + lookup_op + [op.close(0, current_stat=
eid)])
     check(res, [NFS4ERR_STALE_STATEID, NFS4ERR_BAD_STATEID])
=20
+    # An unknown number of lookups will be present
+    for r in res.resarray:
+        if r.resop =3D=3D OP_OPEN:
+            stateid =3D r.stateid
+        elif r.resop =3D=3D OP_GETFH:
+            fh =3D r.object
+            break
+
+    # Test passed, now cleanup!
+    res =3D sess1.compound([op.putfh(fh), op.close(0, stateid)])
+    check(res)
+
 def testCloseNoStateid(t, env):
     """test current state id processing by having CLOSE
        without operation which provides stateid
@@ -120,6 +133,10 @@ def testCloseNoStateid(t, env):
     res =3D sess1.compound([op.putfh(fh), op.close(0, current_stateid)])
     check(res, [NFS4ERR_STALE_STATEID, NFS4ERR_BAD_STATEID])
=20
+    # Test passed, now cleanup!
+    res =3D sess1.compound([op.putfh(fh), op.close(0, stateid)])
+    check(res)
+
 def testOpenLayoutGet(t, env):
     """test current state id processing by having OPEN and LAYOUTGET
        in a single compound
@@ -170,6 +187,13 @@ def testOpenFreestateidClose(t, env):
     open_op =3D open_create_file_op(sess1, env.testname(t), open_create=3D=
OPEN4_CREATE)
     res =3D sess1.compound(open_op + [op.free_stateid(current_stateid), op=
.close(0, current_stateid)])
     check(res, NFS4ERR_LOCKS_HELD)
+    fh =3D res.resarray[-2].object
+    stateid =3D res.resarray[-3].stateid
+
+    # Test passed, now cleanup!
+    res =3D sess1.compound([op.putfh(fh), op.close(0, stateid)])
+    check(res)
+
=20
 def testOpenSaveFHLookupRestoreFHClose(t, env):
     """test current state id processing by having OPEN, SAVEFH, LOOKUP, RE=
STOREFH and CLOSE
diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41t=
ests/st_reclaim_complete.py
index e945a9f..642ada2 100644
--- a/nfs4.1/server41tests/st_reclaim_complete.py
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -47,6 +47,10 @@ def testReclaimAfterRECC(t, env):
=20
     check(res, NFS4ERR_NO_GRACE, warnlist =3D [NFS4ERR_EXIST | NFS4ERR_REC=
LAIM_BAD])
=20
+    # Cleanup
+    res =3D sess.compound([op.putfh(fh), op.close(0, stateid)])
+    check(res)
+
 def testOpenBeforeRECC(t, env):
     """After a client establishes a new client ID, if non-reclaim
        locking operations are done before the RECLAIM_COMPLETE,
diff --git a/nfs4.1/server41tests/st_rename.py b/nfs4.1/server41tests/st_re=
name.py
index d87cca0..c7c2c20 100644
--- a/nfs4.1/server41tests/st_rename.py
+++ b/nfs4.1/server41tests/st_rename.py
@@ -496,6 +496,10 @@ def testSelfRenameFile(t, env):
         t.fail("RENAME of file %s into itself should do nothing, "
                "but cinfo was changed" % name)
=20
+    # Cleanup
+    res =3D sess.compound([op.putfh(fh), op.close(0, stateid)])
+    check(res)
+
 def testLinkRename(t, env):
     """RENAME of file into its hard link should do nothing
=20
diff --git a/nfs4.1/server41tests/st_secinfo.py b/nfs4.1/server41tests/st_s=
ecinfo.py
index 234ec80..008dc1e 100644
--- a/nfs4.1/server41tests/st_secinfo.py
+++ b/nfs4.1/server41tests/st_secinfo.py
@@ -20,14 +20,20 @@ def testSupported(t, env):
     path =3D sess.c.homedir + [name]
     res =3D create_file(sess, owner, path, access=3DOPEN4_SHARE_ACCESS_WRI=
TE)
     check(res)
+    fh =3D res.resarray[-1].object
+    stateid =3D res.resarray[-2].stateid
=20
     # Get the filehandle of the tmpfile's parent dir
     res =3D sess.compound(use_obj(sess.c.homedir) + [op.getfh()])
     check(res)
-    fh =3D res.resarray[-1].object
+    fh_p =3D res.resarray[-1].object
=20
     # Just do a simple SECINFO
-    res =3D sess.compound([op.putfh(fh), op.secinfo(name)])
+    res =3D sess.compound([op.putfh(fh_p), op.secinfo(name)])
+    check(res)
+
+    # Cleanup
+    res =3D sess.compound([op.putfh(fh), op.close(0, stateid)])
     check(res)
=20
 def testSupported2(t, env):
@@ -45,12 +51,18 @@ def testSupported2(t, env):
     path =3D sess.c.homedir + [name]
     res =3D create_file(sess, owner, path, access=3DOPEN4_SHARE_ACCESS_WRI=
TE)
     check(res)
+    fh =3D res.resarray[-1].object
+    stateid =3D res.resarray[-2].stateid
=20
     # Get the filehandle of the tmpfile's parent dir
     res =3D sess.compound(use_obj(sess.c.homedir) + [op.getfh()])
     check(res)
-    fh =3D res.resarray[-1].object
+    fh_p =3D res.resarray[-1].object
=20
     # GETFH after do a SECINFO should get error NFS4ERR_NOFILEHANDLE
-    res =3D sess.compound([op.putfh(fh), op.secinfo(name), op.getfh()])
+    res =3D sess.compound([op.putfh(fh_p), op.secinfo(name), op.getfh()])
     check(res, NFS4ERR_NOFILEHANDLE)
+
+    # Cleanup
+    res =3D sess.compound([op.putfh(fh), op.close(0, stateid)])
+    check(res)
diff --git a/nfs4.1/server41tests/st_sequence.py b/nfs4.1/server41tests/st_=
sequence.py
index d12f355..d8d460c 100644
--- a/nfs4.1/server41tests/st_sequence.py
+++ b/nfs4.1/server41tests/st_sequence.py
@@ -129,6 +129,9 @@ def testReplayCache002(t, env):
     """
     sess1 =3D env.c1.new_client_session(env.testname(t))
     res =3D create_file(sess1, "%s_1" % env.testname(t))
+    fh =3D res.resarray[-1].object
+    stateid =3D res.resarray[-2].stateid
+
     check(res)
     ops =3D env.home + [op.savefh(),\
           op.rename("%s_1" % env.testname(t), "%s_2" % env.testname(t))]
@@ -140,6 +143,11 @@ def testReplayCache002(t, env):
     if not nfs4lib.test_equal(res1, res2):
         fail("Replay results not equal")
=20
+    # Cleanup
+    res =3D sess1.compound([op.putfh(fh), op.close(0, stateid)])
+    check(res)
+
+
 def testReplayCache003(t, env):
     """Send two unsuccessful idempotent compounds with same seqid
=20
--=20
2.3.6


  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 ` [PATCH pynfs 02/12] Close the files opened in the OPEN tests Tom Haynes
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 ` Tom Haynes [this message]
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-6-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).