From: Jeff Layton <jlayton@kernel.org>
To: Calum Mackay <calum.mackay@oracle.com>
Cc: Chuck Lever <chuck.lever@oracle.com>, NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
linux-nfs@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: [PATCH pynfs v2 12/25] server41tests: add a test for removal from dir with dir delegation
Date: Thu, 16 Apr 2026 11:14:44 -0700 [thread overview]
Message-ID: <20260416-dir-deleg-v2-12-fad510db5941@kernel.org> (raw)
In-Reply-To: <20260416-dir-deleg-v2-0-fad510db5941@kernel.org>
Request a dir delegation with REMOVE_ENTRY notifications. Create a
file, then remove it from a second client. Verify the server sends
a CB_NOTIFY with the correct REMOVE event.
Also add full child and directory attribute bitmaps to the
GET_DIR_DELEGATION request for all CB_NOTIFY tests.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
nfs4.1/server41tests/st_dir_deleg.py | 65 ++++++++++++++++++++++++++++++++++--
1 file changed, 63 insertions(+), 2 deletions(-)
diff --git a/nfs4.1/server41tests/st_dir_deleg.py b/nfs4.1/server41tests/st_dir_deleg.py
index d62ccb634056..9c348e9e80f6 100644
--- a/nfs4.1/server41tests/st_dir_deleg.py
+++ b/nfs4.1/server41tests/st_dir_deleg.py
@@ -68,8 +68,26 @@ def _getDirDeleg(t, env, notify_mask, cb):
mask_bm = nfs4lib.list2bitmap(notify_mask)
ops = [ op.putfh(fh), op.get_dir_delegation(False, nfs4lib.list2bitmap(notify_mask),
zerotime, zerotime,
- nfs4lib.list2bitmap([]),
- nfs4lib.list2bitmap([]))]
+ nfs4lib.list2bitmap([FATTR4_TYPE,
+ FATTR4_CHANGE,
+ FATTR4_SIZE,
+ FATTR4_FILEID,
+ FATTR4_FILEHANDLE,
+ FATTR4_MODE,
+ FATTR4_NUMLINKS,
+ FATTR4_RAWDEV,
+ FATTR4_SPACE_USED,
+ FATTR4_TIME_ACCESS,
+ FATTR4_TIME_METADATA,
+ FATTR4_TIME_MODIFY,
+ FATTR4_TIME_CREATE]),
+ nfs4lib.list2bitmap([FATTR4_CHANGE,
+ FATTR4_SIZE,
+ FATTR4_NUMLINKS,
+ FATTR4_SPACE_USED,
+ FATTR4_TIME_ACCESS,
+ FATTR4_TIME_METADATA,
+ FATTR4_TIME_MODIFY]))]
res = sess1.compound(ops)
check(res, [NFS4_OK, NFS4ERR_NOTSUPP])
if (res.status == NFS4ERR_NOTSUPP):
@@ -329,3 +347,46 @@ def testDirDelegFiltering(t, env):
if not cb.got_recall:
fail("Expected CB_RECALL for unrequested notification type")
+
+def testDirDelegRemove(t, env):
+ """Create a dir_deleg that accepts notification of REMOVE events
+
+ FLAGS: dirdeleg all
+ CODE: DIRDELEG9
+ """
+ c = env.c1
+ cb = threading.Event()
+ sess1, fh, deleg = _getDirDeleg(t, env,
+ [NOTIFY4_CHANGE_DIR_ATTRS,
+ NOTIFY4_REMOVE_ENTRY,
+ NOTIFY4_GFLAG_EXTEND], cb)
+
+ 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 = sess1.compound(open_op)
+ check(res)
+ open_stateid = res.resarray[-2].stateid
+ file_fh = res.resarray[-1].object
+ close_file(sess1, file_fh, stateid=open_stateid)
+
+ sess2 = c.new_client_session(b"%s_2" % env.testname(t))
+ remove_op = [ op.putfh(fh), op.remove(env.testname(t)) ]
+ res = sess2.compound(remove_op)
+ check(res)
+
+ completed = cb.wait(5)
+ ops = [ op.putfh(fh), op.delegreturn(deleg) ]
+ res = sess1.compound(ops)
+
+ if (not completed or not cb.got_notify):
+ fail("Didn't receive a CB_NOTIFY from the server!")
+
+ evt_type, evt = decode_notify_event(cb.changes[0])
+ if evt_type != NOTIFY4_REMOVE_ENTRY:
+ fail("Expected REMOVE notification, got %d" % evt_type)
+ if evt.nrm_old_entry.ne_file != env.testname(t):
+ fail("Wrong entry name in REMOVE notification")
--
2.53.0
next prev parent reply other threads:[~2026-04-16 18:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 18:14 [PATCH pynfs v2 00/25] nfs4.1: add some directory delegation testcases Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 01/25] nfs4.1: add proposed NOTIFY4_GFLAG_EXTEND flag Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 02/25] nfs4.1: add a getfh() to the end of create_obj() compound Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 03/25] server41tests: add a basic GET_DIR_DELEGATION test Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 04/25] server41tests: add a test for duplicate GET_DIR_DELEGATION requests Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 05/25] server41tests: pass_warn() when server doesn't support dir delegations Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 06/25] server41tests: test remove triggers dir delegation recall Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 07/25] server41tests: test rename " Jeff Layton
2026-04-17 0:40 ` Scott Mayhew
2026-04-17 15:42 ` Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 08/25] server41tests: test mkdir " Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 09/25] server41tests: test link " Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 10/25] server41tests: test no notifications without GFLAG_EXTEND Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 11/25] server41tests: test unrequested notification type triggers recall Jeff Layton
2026-04-16 18:14 ` Jeff Layton [this message]
2026-04-16 18:14 ` [PATCH pynfs v2 13/25] server41tests: add a test for directory add notifications Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 14/25] server41tests: add test for RENAME event notifications Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 15/25] server41tests: verify child attributes in ADD notification Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 16/25] server41tests: test CHANGE_DIR_ATTRS notification Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 17/25] server41tests: test mkdir triggers ADD notification Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 18/25] server41tests: test DELEGRETURN stops notifications Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 19/25] server41tests: verify filehandle in ADD notification Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 20/25] server41tests: test cross-directory rename REMOVE notification Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 21/25] server41tests: test cross-directory rename ADD notification on target Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 22/25] server41tests: test link triggers ADD notification Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 23/25] server41tests: test same-client changes don't trigger notifications Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 24/25] server41tests: test cross-directory rename-over nad_old_entry Jeff Layton
2026-04-16 18:14 ` [PATCH pynfs v2 25/25] server41tests: test within-directory " 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=20260416-dir-deleg-v2-12-fad510db5941@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=calum.mackay@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
--cc=trondmy@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