Skip to contentSkip to conversation

nfs4.0 enhance open_confirm to work with courteous server.

RFC PATCH Superseded Dai Ngo 1 participant 1 message Dec 11, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

RFC PATCH 1/1 nfs4.0 enhance open_confirm to work with courteous server.

Linux NFSv4 courteous server resolves share reservation conflicts with courtesy clients asynchronously and returning NFS4ERR_DELAY to the client.

---
 nfs4.0/nfs4lib.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
nfs4.0/nfs4lib.py +11 -2
index 934def3b7333..60c833478ec3 100644
@@ -723,8 +723,17 @@ class NFS4Client(rpc.RPCClient):
     def open_confirm(self, owner, path=None,
                      access=OPEN4_SHARE_ACCESS_READ,
                      deny=OPEN4_SHARE_DENY_WRITE):
-        res = self.open_file(owner, path, access, deny)
-        check_result(res, "Opening file %s" % _getname(owner, path))
+        while 1:
+            res = self.open_file(owner, path, access, deny)
+            cnt = 0
+            try:
+                 check_result(res, "Opening file %s" % _getname(owner, path))
+                 break
+            except BadCompoundRes:
+                if res.status != NFS4ERR_DELAY: raise
+                cnt += 1
+                if cnt < 5:
+                    time.sleep(2)
         return self.confirm(owner, res)
 
 ##     def xxxopen_claim_prev(self, owner, fh, seqid=None,
Signature · 1 line
2.27.0