From: Chuck Lever <cel@kernel.org>
To: NeilBrown <neil@brown.name>, Jeff Layton <jlayton@kernel.org>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: <linux-nfs@vger.kernel.org>
Subject: [PATCH v2 5/5] NFSD: Don't apply NFS version-specific behavior to LOCALIO requests
Date: Tue, 28 Jul 2026 12:59:11 -0400 [thread overview]
Message-ID: <20260728165911.462534-6-cel@kernel.org> (raw)
In-Reply-To: <20260728165911.462534-1-cel@kernel.org>
LOCALIO serves NFS clients of every version through one entry point,
so no protocol version is associated with such a request.
nfsd_set_fh_dentry() selects version-specific behavior anyway: its
switch keys off fh_maxsize, and nfsd_open_local_fh() passes
NFS4_FHSIZE because that is the size of the buffer it copies into, so
LOCALIO lands in the NFSv4 arm. fh_getattr() keys off fh_maxsize too
and does run on a LOCALIO open, adding STATX_BTIME and
STATX_CHANGE_COOKIE to the mask it requests: work on filesystems that
compute them for a caller that never reads them.
nfsd_open_local_fh() only verifies a handle it received, so it has no
maximum size to state. Pass NFSD_FHSIZE_UNSPEC as nlm_fopen() already
does, which selects the switch arm that applies no version-specific
behavior, and state the bound on the copy out of struct nfs_fh as
NFS_MAXFHSIZE.
Suggested-by: NeilBrown <neil@brown.name>
Signed-off-by: Chuck Lever <cel@kernel.org>
---
fs/nfsd/localio.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/nfsd/localio.c b/fs/nfsd/localio.c
index 4110be02b750..33b56d1b3f44 100644
--- a/fs/nfsd/localio.c
+++ b/fs/nfsd/localio.c
@@ -11,7 +11,6 @@
#include <linux/exportfs.h>
#include <linux/sunrpc/svcauth.h>
#include <linux/sunrpc/clnt.h>
-#include <linux/nfs4.h>
#include <linux/nfs_common.h>
#include <linux/nfs_fh.h>
#include <linux/nfslocalio.h>
@@ -54,7 +53,7 @@ nfsd_open_local_fh(struct net *net, struct auth_domain *dom,
struct nfsd_file *localio;
__be32 beres;
- if (nfs_fh->size > NFS4_FHSIZE)
+ if (nfs_fh->size > NFS_MAXFHSIZE)
return ERR_PTR(-EINVAL);
if (!nfsd_net_try_get(net))
@@ -67,7 +66,7 @@ nfsd_open_local_fh(struct net *net, struct auth_domain *dom,
return localio;
/* nfs_fh -> svc_fh */
- fh_init(&fh, NFS4_FHSIZE);
+ fh_init(&fh, NFSD_FHSIZE_UNSPEC);
fh.fh_handle.fh_size = nfs_fh->size;
memcpy(fh.fh_handle.fh_raw, nfs_fh->data, nfs_fh->size);
--
2.54.0
next prev parent reply other threads:[~2026-07-28 16:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 16:59 [PATCH v2 0/5] Remove NFS client header dependencies from LOCALIO Chuck Lever
2026-07-28 16:59 ` [PATCH v2 1/5] NFSD: Move the RPC program definition for LOCALIO Chuck Lever
2026-07-28 16:59 ` [PATCH v2 2/5] nfs_common: Remove "#include <linux/nfs.h>" from linux/nfslocalio.h Chuck Lever
2026-07-28 16:59 ` [PATCH v2 3/5] NFSD: Tighten header includes in localio.c Chuck Lever
2026-07-28 16:59 ` [PATCH v2 4/5] NFSD: Name the fh_maxsize value that carries no NFS version Chuck Lever
2026-07-28 16:59 ` Chuck Lever [this message]
2026-07-28 22:20 ` [PATCH v2 5/5] NFSD: Don't apply NFS version-specific behavior to LOCALIO requests NeilBrown
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=20260728165911.462534-6-cel@kernel.org \
--to=cel@kernel.org \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.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.