All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: Calum Mackay <calum.mackay@oracle.com>
Cc: <linux-nfs@vger.kernel.org>
Subject: [PATCH v1 8/8] pynfs: add test for OPEN with WANT_CANCEL
Date: Thu,  8 Oct 2026 11:47:29 -0400	[thread overview]
Message-ID: <20261008154729.77787-9-cel@kernel.org> (raw)
In-Reply-To: <20261008154729.77787-1-cel@kernel.org>

RFC 8881 Section 18.16.3 defines WND4_CANCELLED as the reason a
server gives when an OPEN sets OPEN4_SHARE_ACCESS_WANT_CANCEL. No
test sends that want, so a server that answers with another reason
goes unnoticed. NFSD reports WND4_NOT_WANTED.

Add DELEG36. It creates a file with WANT_CANCEL and fails unless the
reply carries OPEN_DELEGATE_NONE_EXT with ond_why set to
WND4_CANCELLED.

Signed-off-by: Chuck Lever <cel@kernel.org>
---
 nfs4.1/server41tests/st_delegation.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/nfs4.1/server41tests/st_delegation.py b/nfs4.1/server41tests/st_delegation.py
index 29d8341762d8..5af83c8744c4 100644
--- a/nfs4.1/server41tests/st_delegation.py
+++ b/nfs4.1/server41tests/st_delegation.py
@@ -1006,3 +1006,27 @@ def testWriteDelegDowngrade(t, env):
                      OPEN4_SHARE_ACCESS_READ |
                      OPEN4_SHARE_ACCESS_WANT_READ_DELEG, OPEN_DELEGATE_READ,
                      WND4_NOT_SUPP_DOWNGRADE)
+
+def testWantCancel(t, env):
+    """OPEN with WANT_CANCEL gets no delegation and WND4_CANCELLED
+
+    FLAGS: open deleg all
+    CODE: DELEG37
+    """
+    sess1 = env.c1.new_client_session(b"%s_1" % env.testname(t))
+    res = create_file(sess1, env.testname(t),
+                      access=OPEN4_SHARE_ACCESS_READ |
+                      OPEN4_SHARE_ACCESS_WANT_CANCEL)
+    check(res)
+    fh = res.resarray[-1].object
+    deleg = res.resarray[-2].delegation
+    _delegreturn(sess1, fh, deleg)
+    res = close_file(sess1, fh, stateid=res.resarray[-2].stateid)
+    check(res)
+    if deleg.delegation_type == OPEN_DELEGATE_NONE:
+        fail("Got OPEN_DELEGATE_NONE, expected OPEN_DELEGATE_NONE_EXT")
+    if deleg.delegation_type != OPEN_DELEGATE_NONE_EXT:
+        fail("Got a delegation (type %d) despite WANT_CANCEL" %
+             deleg.delegation_type)
+    if deleg.ond_why != WND4_CANCELLED:
+        fail("Got ond_why %d, expected WND4_CANCELLED" % deleg.ond_why)
-- 
2.55.0


      parent reply	other threads:[~2026-10-08 15:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 15:47 [PATCH v1 0/8] Test the WANT_*_DELEG OPEN flags Chuck Lever
2026-10-08 15:47 ` [PATCH v1 1/8] pynfs: add test for OPEN(CLAIM_FH) with WANT_READ_DELEG Chuck Lever
2026-10-09  7:58   ` Substituting WANT_DELEGATION with OPEN(CLAIM_FH)? " Lionel Cons
2026-10-08 15:47 ` [PATCH v1 2/8] pynfs: add test for OPEN(CLAIM_FH) delegation request on an open file Chuck Lever
2026-10-08 15:47 ` [PATCH v1 3/8] pynfs: add test for a delegation request after a recall Chuck Lever
2026-10-08 15:47 ` [PATCH v1 4/8] pynfs: add tests for SETATTR by a delegation holder Chuck Lever
2026-10-08 15:47 ` [PATCH v1 5/8] pynfs: add test for WANT_OPEN_XOR_DELEGATION through CLAIM_FH Chuck Lever
2026-10-08 15:47 ` [PATCH v1 6/8] pynfs: add test for a CLAIM_FH delegation that outlives its open Chuck Lever
2026-10-08 15:47 ` [PATCH v1 7/8] pynfs: add tests for delegation upgrade and downgrade wants Chuck Lever
2026-10-08 15:47 ` Chuck Lever [this message]

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=20261008154729.77787-9-cel@kernel.org \
    --to=cel@kernel.org \
    --cc=calum.mackay@oracle.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.