linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Calum Mackay <calum.mackay@oracle.com>
Cc: linux-nfs@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: [PATCH pynfs 6/7] server41tests: add a test for diretory add notifications
Date: Tue, 30 Sep 2025 07:37:40 -0400	[thread overview]
Message-ID: <20250930-dir-deleg-v1-6-7057260cd0c6@kernel.org> (raw)
In-Reply-To: <20250930-dir-deleg-v1-0-7057260cd0c6@kernel.org>

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 nfs4.1/server41tests/st_dir_deleg.py | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/nfs4.1/server41tests/st_dir_deleg.py b/nfs4.1/server41tests/st_dir_deleg.py
index f44a8f10738b1e6d5868f4496ba4bda1c5be810d..7073c590cb537f83552d7d8afa0ab02da1fe07c9 100644
--- a/nfs4.1/server41tests/st_dir_deleg.py
+++ b/nfs4.1/server41tests/st_dir_deleg.py
@@ -150,3 +150,36 @@ def testDirDelegRemove(t, env):
 
     if (not completed or not cb.got_notify):
         fail("Didn't receive a CB_NOTIFY from the server!")
+
+def testDirDelegAdd(t, env):
+    """Create a dir_deleg that accepts notification of ADD events
+
+    FLAGS: dirdeleg all
+    CODE: DIRDELEG4
+    """
+    c = env.c1
+    cb = threading.Event()
+    sess1, fh, deleg = _getDirDeleg(t, env, [NOTIFY4_ADD_ENTRY], cb)
+
+    sess2 = c.new_client_session(b"%s_2" % env.testname(t))
+    claim = open_claim4(CLAIM_NULL, env.testname(t))
+    owner = open_owner4(0, b"owner")
+    how = openflag4(OPEN4_CREATE, createhow4(GUARDED4, {FATTR4_SIZE:0}))
+    open_op = [ op.putfh(fh), op.open(0,
+                                      OPEN4_SHARE_ACCESS_WRITE | OPEN4_SHARE_ACCESS_WANT_NO_DELEG,
+                                      OPEN4_SHARE_DENY_NONE, owner, how, claim), op.getfh() ]
+    res = sess2.compound(open_op)
+    check(res)
+
+    completed = cb.wait(2)
+
+    delegreturn_op = [ op.putfh(fh), op.delegreturn(deleg) ]
+    res = sess1.compound(delegreturn_op)
+    check(res)
+
+    remove_op = [ op.putfh(fh), op.remove(env.testname(t)) ]
+    res = sess2.compound(remove_op)
+    check(res)
+
+    if (not completed or not cb.got_notify):
+        fail("Didn't receive a CB_NOTIFY from the server!")

-- 
2.51.0


  parent reply	other threads:[~2025-09-30 11:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-30 11:37 [PATCH pynfs 0/7] nfs4.1: add some basic directory delegation tests Jeff Layton
2025-09-30 11:37 ` [PATCH pynfs 1/7] nfs4.1: add proposed NOTIFY4_GFLAG_EXTEND flag Jeff Layton
2025-09-30 11:37 ` [PATCH pynfs 2/7] pynfs: add a getfh() to the end of create_obj() compound Jeff Layton
2025-09-30 11:37 ` [PATCH pynfs 3/7] server41tests: add a basic GET_DIR_DELEGATION test Jeff Layton
2025-09-30 11:37 ` [PATCH pynfs 4/7] server41tests: add a test for duplicate GET_DIR_DELEGATION requests Jeff Layton
2025-09-30 11:37 ` [PATCH pynfs 5/7] server41tests: add a test for removal from dir with dir delegation Jeff Layton
2025-09-30 11:37 ` Jeff Layton [this message]
2025-09-30 11:37 ` [PATCH pynfs 7/7] server41tests: add test for rename event notifications Jeff Layton
2025-09-30 13:48 ` [PATCH pynfs 0/7] nfs4.1: add some basic directory delegation tests Chuck Lever
2025-09-30 13:57   ` Jeff Layton

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=20250930-dir-deleg-v1-6-7057260cd0c6@kernel.org \
    --to=jlayton@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).