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 3/5] NFSD: Tighten header includes in localio.c
Date: Tue, 28 Jul 2026 12:59:09 -0400 [thread overview]
Message-ID: <20260728165911.462534-4-cel@kernel.org> (raw)
In-Reply-To: <20260728165911.462534-1-cel@kernel.org>
As a prerequisite to converting NFSD to use xdrgen more broadly,
NFSD source files should not depend on NFS client headers.
fs/nfsd/localio.c is server-side LOCALIO code, yet it pulled in
three of them: <linux/nfs_fs.h>, the client inode header (struct
nfs_inode, NFS_I(), writeback helpers), which server code never
uses; <linux/nfs_xdr.h>, whose only referenced symbol is
decode_opaque_fixed(), a static inline that exists to remap the
error return to -EIO for client call sites; and the catch-all
<linux/nfs.h>.
Convert the UUID decoder to call the canonical SUNRPC primitive
xdr_stream_decode_opaque_fixed() directly. It is shared by client
and server, performs the identical bounds check, and is already
reachable through <linux/sunrpc/clnt.h>. With the wrapper gone,
localio.c references no symbol from <linux/nfs_xdr.h>, and with
that header gone, none of the NFSv3 definitions its structs embed
are needed here.
Drop all three client includes and add what the file actually
uses: struct nfs_fh comes from <linux/nfs_fh.h>, included directly
rather than through nfslocalio.h's conditional re-export, and
NFS4_FHSIZE from <linux/nfs4.h>. enum nfs_stat and
nfs_stat_to_errno continue to come from the already-included
<linux/nfs_common.h>.
Signed-off-by: Chuck Lever <cel@kernel.org>
---
fs/nfsd/localio.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/localio.c b/fs/nfsd/localio.c
index c458c01e9478..4110be02b750 100644
--- a/fs/nfsd/localio.c
+++ b/fs/nfsd/localio.c
@@ -11,11 +11,10 @@
#include <linux/exportfs.h>
#include <linux/sunrpc/svcauth.h>
#include <linux/sunrpc/clnt.h>
-#include <linux/nfs.h>
+#include <linux/nfs4.h>
#include <linux/nfs_common.h>
+#include <linux/nfs_fh.h>
#include <linux/nfslocalio.h>
-#include <linux/nfs_fs.h>
-#include <linux/nfs_xdr.h>
#include <linux/string.h>
#include "nfsd.h"
@@ -179,7 +178,7 @@ static bool localio_decode_uuidarg(struct svc_rqst *rqstp,
struct localio_uuidarg *argp = rqstp->rq_argp;
u8 uuid[UUID_SIZE];
- if (decode_opaque_fixed(xdr, uuid, UUID_SIZE))
+ if (xdr_stream_decode_opaque_fixed(xdr, uuid, UUID_SIZE) < 0)
return false;
import_uuid(&argp->uuid, uuid);
--
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 ` Chuck Lever [this message]
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 ` [PATCH v2 5/5] NFSD: Don't apply NFS version-specific behavior to LOCALIO requests Chuck Lever
2026-07-28 22:20 ` 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-4-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.