[PATCH 2/2] environment.py: enhance open_create_file to work with courteous server

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

 



Enhance open_create_file to handle NFS4ERR_DELAY returned by the server
in case of share/access/delegation conflict.

Signed-off-by: Dai Ngo <dai.ngo@xxxxxxxxxx>
---
 nfs4.1/server41tests/environment.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index 0b7c976d8582..fb834b28841b 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -483,11 +483,16 @@ def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0o644},
                      deleg_type=None,
                      open_create=OPEN4_NOCREATE,
                      seqid=0, clientid=0):
-    open_op = open_create_file_op(sess, owner, path, attrs, access, deny, mode,
-                            verifier, claim_type, want_deleg, deleg_type,
-                            open_create, seqid, clientid)
-
-    return sess.compound(open_op)
+    while 1:
+        open_op = open_create_file_op(sess, owner, path, attrs, access, deny, mode,
+                       verifier, claim_type, want_deleg, deleg_type,
+                       open_create, seqid, clientid)
+        res = sess.compound(open_op)
+        if res.status == NFS4ERR_DELAY:
+            time.sleep(2)
+        else:
+            break
+    return res
 
 def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0o644},
                      access=OPEN4_SHARE_ACCESS_BOTH,
-- 
2.27.0




[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