[PATCH pynfs 03/12] Some more file closes to cleanup state on the server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tom Haynes <loghyr@xxxxxxxxxxxxxxx>
---
 nfs4.1/server41tests/st_current_stateid.py | 12 +++++++++++-
 nfs4.1/server41tests/st_debug.py           | 18 ++++++++++++++++--
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/nfs4.1/server41tests/st_current_stateid.py b/nfs4.1/server41tests/st_current_stateid.py
index a0d6757..01d78c0 100644
--- a/nfs4.1/server41tests/st_current_stateid.py
+++ b/nfs4.1/server41tests/st_current_stateid.py
@@ -46,6 +46,8 @@ def testLockLockU(t, env):
 	op.locku(WRITE_LT, 0, current_stateid, 0, NFS4_UINT64_MAX) ]
     res = sess1.compound([op.putfh(fh)] + lock_ops)
     check(res, NFS4_OK)
+    res = close_file(sess1, fh, stateid=stateid)
+    check(res)
 
 def testOpenWriteClose(t, env):
     """test current state id processing by having OPEN, WRITE and CLOSE
@@ -132,6 +134,10 @@ def testOpenLayoutGet(t, env):
            [op.layoutget(False, LAYOUT4_NFSV4_1_FILES, LAYOUTIOMODE4_RW,
                         0, 8192, 8192, current_stateid, 0xffff)])
     check(res, NFS4_OK)
+    fh = res.resarray[-1].object
+    stateid = res.resarray[-2].stateid
+    res = close_file(sess, fh, stateid=stateid)
+    check(res)
 
 def testOpenSetattr(t, env):
     """test current state id processing by having OPEN and SETATTR
@@ -145,8 +151,12 @@ def testOpenSetattr(t, env):
 
     open_op = open_create_file_op(sess, env.testname(t), open_create=OPEN4_CREATE)
     res = sess.compound( open_op +
-           [ op.setattr(current_stateid, {FATTR4_SIZE: size})])
+           [op.getfh(), op.setattr(current_stateid, {FATTR4_SIZE: size})])
     check(res, NFS4_OK)
+    fh = res.resarray[-3].object
+    stateid = res.resarray[-4].stateid
+    res = close_file(sess, fh, stateid=stateid)
+    check(res)
 
 def testOpenFreestateidClose(t, env):
     """test current state id processing by having OPEN, FREE_STATEID and CLOSE
diff --git a/nfs4.1/server41tests/st_debug.py b/nfs4.1/server41tests/st_debug.py
index 2b9890e..532ee7a 100644
--- a/nfs4.1/server41tests/st_debug.py
+++ b/nfs4.1/server41tests/st_debug.py
@@ -1,6 +1,6 @@
 from st_create_session import create_session
 from xdrdef.nfs4_const import *
-from environment import check, fail, create_file
+from environment import check, fail, create_file, close_file
 from xdrdef.nfs4_type import open_owner4, openflag4, createhow4, open_claim4
 import nfs_ops
 op = nfs_ops.NFS4ops()
@@ -19,6 +19,8 @@ def testSupported2(t, env):
                       access=OPEN4_SHARE_ACCESS_READ |
                       OPEN4_SHARE_ACCESS_WANT_READ_DELEG)
     check(res) # STUB Should check delegation was granted
+    fh1 = res.resarray[-1].object
+    stateid1 = res.resarray[-2].stateid
     # c2 - OPEN - WRITE
     c2 = env.c1.new_client("%s_2" % env.testname(t))
     sess2 = c2.create_session()
@@ -31,6 +33,12 @@ def testSupported2(t, env):
     # STUB - since we are not handling callback, deleg_return never gets done
     print res
     check(res)
+    fh2 = res.resarray[-1].object
+    stateid2 = res.resarray[-2].stateid
+    res = close_file(sess1, fh1, stateid=stateid1)
+    check(res)
+    res = close_file(sess2, fh2, stateid=stateid2)
+    check(res)
     
 def testReadWrite(t, env):
     """Do a simple READ and WRITE
@@ -58,7 +66,8 @@ def testReadWrite(t, env):
     res = sess1.compound([op.putfh(fh), op.read(stateid, 0, 1000)])
     print res
     check(res)
-
+    res = close_file(sess1, fh, stateid=stateid)
+    check(res)
 
 def testDeadlock(t, env):
     """Trigger deadlock bug
@@ -87,6 +96,8 @@ def testDeadlock(t, env):
         res = sess1.listen(xid)
         check(res)
         print res
+    res = close_file(sess1, fh, stateid=stateid)
+    check(res)
 
 def testLayout(t, env):
     """Verify layout handling
@@ -103,11 +114,14 @@ def testLayout(t, env):
     check(openres)
     # Get a layout
     fh = openres.resarray[-1].object
+    stateid = res.resarray[-2].stateid
     ops = [op.putfh(fh),
            op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_READ,
                         0, 0xffffffff, 4*blocksize, 0xffff)]
     res = sess.compound(ops)
     check(res)
+    res = close_file(sess1, fh, stateid=stateid)
+    check(res)
     
 def testGetDevList(t, env):
     """Check devlist
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux