2022-06-15 17:48:35

by Dai Ngo

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

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

Signed-off-by: Dai Ngo <[email protected]>
---
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