From: Anna Schumaker <anna@kernel.org>
To: linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com
Cc: anna@kernel.org
Subject: [PATCH 4/4] NFS: Add support for CB_NOTIFY4_RENAME_ENTRY
Date: Tue, 4 Aug 2026 16:59:55 -0400 [thread overview]
Message-ID: <20260804205955.625772-5-anna@kernel.org> (raw)
In-Reply-To: <20260804205955.625772-1-anna@kernel.org>
From: Anna Schumaker <anna.schumaker@oracle.com>
Renaming an entry essentially combines a remove with an add, allowing us
to reuse most of the code from the previous patches to do the work for
us.
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
---
fs/nfs/callback.h | 6 ++++++
fs/nfs/callback_proc.c | 16 ++++++++++++++++
fs/nfs/callback_xdr.c | 14 ++++++++++++++
fs/nfs/nfs4xdr.c | 1 +
include/linux/nfs4.h | 1 +
5 files changed, 38 insertions(+)
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
index d3cc3e5df776..019ee9eed9fe 100644
--- a/fs/nfs/callback.h
+++ b/fs/nfs/callback.h
@@ -170,11 +170,17 @@ struct cb_notify_add {
bool na_last_entry;
};
+struct cb_notify_rename {
+ struct cb_notify_remove nrn_old_entry;
+ struct cb_notify_add nrn_new_entry;
+};
+
struct cb_notify_changes {
u32 notify_mask;
union {
struct cb_notify_remove notify_remove;
struct cb_notify_add notify_add;
+ struct cb_notify_rename notify_rename;
};
};
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 9fd0f93e6e5a..5dff65ac0377 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -440,6 +440,18 @@ static __be32 nfs4_cb_notify_add(struct cb_process_state *cps,
return 0;
}
+static __be32 nfs4_cb_notify_rename(struct cb_process_state *cps,
+ struct dentry *parent,
+ struct cb_notify_rename *cb_rename)
+{
+ __be32 status;
+
+ status = nfs4_cb_notify_remove(cps, parent, &cb_rename->nrn_old_entry);
+ if (status != 0)
+ return status;
+ return nfs4_cb_notify_add(cps, parent, &cb_rename->nrn_new_entry);
+}
+
__be32 nfs4_callback_notify(void *argp, void *resp,
struct cb_process_state *cps)
{
@@ -477,6 +489,10 @@ __be32 nfs4_callback_notify(void *argp, void *resp,
res = nfs4_cb_notify_add(cps, parent,
&change->notify_add);
break;
+ case CB_NOTIFY4_RENAME_ENTRY:
+ res = nfs4_cb_notify_rename(cps, parent,
+ &change->notify_rename);
+ break;
default:
res = htonl(NFS4ERR_NOTSUPP);
goto out_dput;
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 2885c25d0742..271476e9472d 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -338,6 +338,17 @@ static __be32 decode_notify_add(struct xdr_stream *xdr,
return 0;
}
+static __be32 decode_notify_rename(struct xdr_stream *xdr,
+ struct cb_notify_rename *args)
+{
+ __be32 status;
+
+ status = decode_notify_remove(xdr, &args->nrn_old_entry);
+ if (unlikely(status != 0))
+ return status;
+ return decode_notify_add(xdr, &args->nrn_new_entry);
+}
+
static
__be32 decode_notify_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr,
@@ -390,6 +401,9 @@ __be32 decode_notify_args(struct svc_rqst *rqstp,
case CB_NOTIFY4_ADD_ENTRY:
status = decode_notify_add(xdr, &change->notify_add);
break;
+ case CB_NOTIFY4_RENAME_ENTRY:
+ status = decode_notify_rename(xdr, &change->notify_rename);
+ break;
default:
goto err;
}
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 2d28c3ae37ad..ef9c6a24729b 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2013,6 +2013,7 @@ encode_get_dir_delegation(struct xdr_stream *xdr, struct compound_hdr *hdr)
struct timespec64 ts = { 0, 0 };
u32 notifications[1] = { CB_NOTIFY4_REMOVE_ENTRY |
CB_NOTIFY4_ADD_ENTRY |
+ CB_NOTIFY4_RENAME_ENTRY |
CB_NOTIFY4_GFLAG_EXTEND };
u32 child_attrs[1] = { FATTR4_WORD0_FSID | FATTR4_WORD0_FILEID |
FATTR4_WORD0_TYPE | FATTR4_WORD0_FILEHANDLE };
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 9435ec5674d0..d3ecdaf01084 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -485,6 +485,7 @@ enum {
/* Directory Delegation / CB_NOTIFY bits */
#define CB_NOTIFY4_REMOVE_ENTRY (1UL << 2)
#define CB_NOTIFY4_ADD_ENTRY (1UL << 3)
+#define CB_NOTIFY4_RENAME_ENTRY (1UL << 4)
#define CB_NOTIFY4_GFLAG_EXTEND (1UL << 6)
#define NFSPROC4_NULL 0
--
2.55.0
prev parent reply other threads:[~2026-08-04 20:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 20:59 [PATCH 0/4] NFS: Add directory delegation support for CB_NOTIFY Anna Schumaker
2026-08-04 20:59 ` [PATCH 1/4] NFS: Add an outline for the CB_NOTIFY operation Anna Schumaker
2026-08-04 20:59 ` [PATCH 2/4] NFS: Add support for CB_NOTIFY4_REMOVE_ENTRY Anna Schumaker
2026-08-04 20:59 ` [PATCH 3/4] NFS: Add support for CB_NOTIFY4_ADD_ENTRY Anna Schumaker
2026-08-04 20:59 ` Anna Schumaker [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=20260804205955.625772-5-anna@kernel.org \
--to=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@hammerspace.com \
/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