From: Anna Schumaker <anna@kernel.org>
To: linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com
Cc: anna@kernel.org
Subject: [PATCH v3 4/4] NFS: Add support for CB_NOTIFY4_RENAME_ENTRY
Date: Fri, 11 Sep 2026 16:43:39 -0400 [thread overview]
Message-ID: <20260911204339.1183500-5-anna@kernel.org> (raw)
In-Reply-To: <20260911204339.1183500-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 71be5b750490..5cc064968360 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -447,6 +447,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)
{
@@ -482,6 +494,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 5c89efebccd4..268efd527eae 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 9a7c4d23aea7..6d102ebf5e6d 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2014,6 +2014,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 4b507a93aa38..27f083546421 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -494,6 +494,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-09-11 20:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 20:43 [PATCH v3 0/4] NFS: Add client side support for CB_NOTIFY Anna Schumaker
2026-09-11 20:43 ` [PATCH v3 1/4] NFS: Add an outline for the CB_NOTIFY operation Anna Schumaker
2026-09-11 20:43 ` [PATCH v3 2/4] NFS: Add support for CB_NOTIFY4_REMOVE_ENTRY Anna Schumaker
2026-09-11 20:43 ` [PATCH v3 3/4] NFS: Add support for CB_NOTIFY4_ADD_ENTRY Anna Schumaker
2026-09-11 20:43 ` 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=20260911204339.1183500-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 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.