diff mbox

[14/17] CLNT: test reclaim after RECLAIM_COMPLETE

Message ID 4D6DE53F.4050904@cn.fujitsu.com (mailing list archive)
State RFC, archived
Headers show

Commit Message

Mi Jinlong March 2, 2011, 6:35 a.m. UTC
None
diff mbox

Patch

diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py
index 1d2d815..45ac9ad 100644
--- a/nfs4.1/server41tests/st_reclaim_complete.py
+++ b/nfs4.1/server41tests/st_reclaim_complete.py
@@ -1,6 +1,7 @@ 
 from st_create_session import create_session
 from nfs4_const import *
 from environment import check, fail, use_obj, create_file
+from nfs4_type import open_owner4, locker4, open_to_lock_owner4
 import nfs4_ops as op
 import nfs4lib
 
@@ -19,3 +20,33 @@  def testSupported(t, env):
 
     res = sess.compound([op.putrootfh(), op.reclaim_complete(TRUE)])
     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: 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)
+
+    fname = "owner_%s" % name
+    path = sess.c.homedir + [name]
+    res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH)
+    check(res)
+
+    oseqid = res.resarray[2].stateid
+    cfh = res.resarray[3].object
+    owner = open_owner4(0, "My Open Owner")
+    otlowner = open_to_lock_owner4(0, oseqid, 0, owner)
+    lowner = locker4(TRUE, otlowner)
+
+    res = sess.compound([op.putfh(cfh), op.lock(READ_LT, TRUE, 0, 1, lowner)])
+    check(res, NFS4ERR_NO_GRACE)