@@ -9,6 +9,10 @@ op = nfs_ops.NFS4ops()
import nfs4lib
import threading
+def _getleasetime(sess):
+ res = sess.compound([op.putrootfh(), op.getattr(1 << FATTR4_LEASE_TIME)])
+ return res.resarray[-1].obj_attributes[FATTR4_LEASE_TIME]
+
def _got_deleg(deleg):
return (deleg.delegation_type != OPEN_DELEGATE_NONE and
deleg.delegation_type != OPEN_DELEGATE_NONE_EXT)
@@ -179,11 +183,16 @@ def testDelegRevocation(t, env):
how = openflag4(OPEN4_NOCREATE)
open_op = op.open(0, OPEN4_SHARE_ACCESS_WRITE, OPEN4_SHARE_DENY_NONE,
owner, how, claim)
+ secs = _getleasetime(sess1) / 2
while 1:
res = sess2.compound(env.home + [open_op])
if res.status == NFS4_OK:
break;
check(res, [NFS4_OK, NFS4ERR_DELAY])
+
+ # allow time for the delegation to be revoked
+ env.sleep(secs)
+
# just to keep sess1 renewed. This is a bit fragile, as we
# depend on the above compound waiting no longer than the
# server's lease period: