Linux NFS development
 help / color / mirror / Atom feed
From: Dai Ngo <dai.ngo@oracle.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 2/2] environment.py: enhance open_create_file to work with courteous server
Date: Wed, 15 Jun 2022 10:34:55 -0700	[thread overview]
Message-ID: <1655314495-17735-2-git-send-email-dai.ngo@oracle.com> (raw)
In-Reply-To: <1655314495-17735-1-git-send-email-dai.ngo@oracle.com>

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@oracle.com>
---
 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


  reply	other threads:[~2022-06-15 17:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 17:34 [PATCH 1/2] nfs4lib.py: enhance open_file to work with courteous server Dai Ngo
2022-06-15 17:34 ` Dai Ngo [this message]
2022-06-15 19:34 ` J. Bruce Fields
2022-06-15 19:48   ` dai.ngo
2022-07-11 18:05     ` J. Bruce Fields
2022-07-11 18:16       ` dai.ngo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1655314495-17735-2-git-send-email-dai.ngo@oracle.com \
    --to=dai.ngo@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox