From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>, NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/2] NFSD: Rework be32 nfserr definitions
Date: Fri, 28 Aug 2026 10:42:26 -0400 [thread overview]
Message-ID: <9768f723beed33c611e36075504b07b1e8e493a7.camel@kernel.org> (raw)
In-Reply-To: <20260826194444.148243-2-cel@kernel.org>
On Wed, 2026-08-26 at 15:44 -0400, Chuck Lever wrote:
> fs/nfsd/nfserr.h builds NFSD's internal __be32 nfserr_* values
> by wrapping the version-agnostic NFSERR_* status codes from
> uapi/linux/nfs.h in cpu_to_be32(), which it reaches through its
> include of linux/nfs.h.
>
> A subsequent patch replaces that include with the xdrgen-generated
> linux/sunrpc/xdrgen/nfs2.h. The generated header re-supplies
> only the eighteen NFSv2 status codes; the NFSv3 and NFSv4 codes
> that nfserr.h also uses (NFSERR_INVAL, NFSERR_JUKEBOX,
> NFSERR_RESOURCE, and the rest) would be left undeclared.
>
> Respell those definitions in terms of the version-specific
> NFS3ERR_* and NFS4ERR_* codes from linux/nfs3.h and linux/nfs4.h,
> and switch the one bare NFSERR_MOVED in nfs4xdr.c to NFS4ERR_MOVED.
> The wire values are unchanged; NFSD no longer depends on the
> version-agnostic NFSv3 and NFSv4 names.
>
> Signed-off-by: Chuck Lever <cel@kernel.org>
> ---
> fs/nfsd/nfs4xdr.c | 2 +-
> fs/nfsd/nfserr.h | 129 +++++++++++++++++++++++-----------------------
> 2 files changed, 66 insertions(+), 65 deletions(-)
>
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 5bfbeb87394e..00ddaac499c6 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -3213,7 +3213,7 @@ static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *bmval2, u32
> *bmval1 & ~WORD1_ABSENT_FS_ATTRS) {
> if (*bmval0 & FATTR4_WORD0_RDATTR_ERROR ||
> *bmval0 & FATTR4_WORD0_FS_LOCATIONS)
> - *rdattr_err = NFSERR_MOVED;
> + *rdattr_err = NFS4ERR_MOVED;
> else
> return nfserr_moved;
> }
> diff --git a/fs/nfsd/nfserr.h b/fs/nfsd/nfserr.h
> index 9b9df7aab220..d1c434b834b2 100644
> --- a/fs/nfsd/nfserr.h
> +++ b/fs/nfsd/nfserr.h
> @@ -11,76 +11,77 @@
> #define LINUX_NFSD_NFSERR_H
>
> #include <linux/nfs.h>
> +#include <linux/nfs3.h>
> #include <linux/nfs4.h>
>
> /*
> * These macros provide pre-xdr'ed values for faster operation.
> */
> -#define nfs_ok cpu_to_be32(NFS_OK)
> -#define nfserr_perm cpu_to_be32(NFSERR_PERM)
> -#define nfserr_noent cpu_to_be32(NFSERR_NOENT)
> -#define nfserr_io cpu_to_be32(NFSERR_IO)
> -#define nfserr_nxio cpu_to_be32(NFSERR_NXIO)
> -#define nfserr_acces cpu_to_be32(NFSERR_ACCES)
> -#define nfserr_exist cpu_to_be32(NFSERR_EXIST)
> -#define nfserr_xdev cpu_to_be32(NFSERR_XDEV)
> -#define nfserr_nodev cpu_to_be32(NFSERR_NODEV)
> -#define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR)
> -#define nfserr_isdir cpu_to_be32(NFSERR_ISDIR)
> -#define nfserr_inval cpu_to_be32(NFSERR_INVAL)
> -#define nfserr_fbig cpu_to_be32(NFSERR_FBIG)
> -#define nfserr_nospc cpu_to_be32(NFSERR_NOSPC)
> -#define nfserr_rofs cpu_to_be32(NFSERR_ROFS)
> -#define nfserr_mlink cpu_to_be32(NFSERR_MLINK)
> -#define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG)
> -#define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY)
> -#define nfserr_dquot cpu_to_be32(NFSERR_DQUOT)
> -#define nfserr_stale cpu_to_be32(NFSERR_STALE)
> -#define nfserr_remote cpu_to_be32(NFSERR_REMOTE)
> -#define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH)
> -#define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE)
> -#define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC)
> -#define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE)
> -#define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP)
> -#define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL)
> -#define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT)
> -#define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE)
> -#define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX)
> -#define nfserr_denied cpu_to_be32(NFSERR_DENIED)
> -#define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK)
> -#define nfserr_expired cpu_to_be32(NFSERR_EXPIRED)
> -#define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE)
> -#define nfserr_same cpu_to_be32(NFSERR_SAME)
> -#define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE)
> -#define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID)
> -#define nfserr_resource cpu_to_be32(NFSERR_RESOURCE)
> -#define nfserr_moved cpu_to_be32(NFSERR_MOVED)
> -#define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE)
> -#define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH)
> -#define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED)
> -#define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID)
> -#define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID)
> -#define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID)
> -#define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID)
> -#define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK)
> -#define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME)
> -#define nfserr_lock_range cpu_to_be32(NFSERR_LOCK_RANGE)
> -#define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH)
> -#define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP)
> -#define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR)
> -#define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE)
> -#define nfserr_badowner cpu_to_be32(NFSERR_BADOWNER)
> -#define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD)
> -#define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL)
> -#define nfserr_grace cpu_to_be32(NFSERR_GRACE)
> -#define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE)
> -#define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD)
> -#define nfserr_badname cpu_to_be32(NFSERR_BADNAME)
> -#define nfserr_admin_revoked cpu_to_be32(NFS4ERR_ADMIN_REVOKED)
> -#define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN)
> -#define nfserr_locked cpu_to_be32(NFSERR_LOCKED)
> -#define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC)
> +#define nfs_ok cpu_to_be32(NFS_OK)
> +#define nfserr_perm cpu_to_be32(NFSERR_PERM)
> +#define nfserr_noent cpu_to_be32(NFSERR_NOENT)
> +#define nfserr_io cpu_to_be32(NFSERR_IO)
> +#define nfserr_nxio cpu_to_be32(NFSERR_NXIO)
> +#define nfserr_acces cpu_to_be32(NFSERR_ACCES)
> +#define nfserr_exist cpu_to_be32(NFSERR_EXIST)
> +#define nfserr_xdev cpu_to_be32(NFS3ERR_XDEV)
> +#define nfserr_nodev cpu_to_be32(NFSERR_NODEV)
> +#define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR)
> +#define nfserr_isdir cpu_to_be32(NFSERR_ISDIR)
> +#define nfserr_inval cpu_to_be32(NFS3ERR_INVAL)
> +#define nfserr_fbig cpu_to_be32(NFSERR_FBIG)
> +#define nfserr_nospc cpu_to_be32(NFSERR_NOSPC)
> +#define nfserr_rofs cpu_to_be32(NFSERR_ROFS)
> +#define nfserr_mlink cpu_to_be32(NFS3ERR_MLINK)
> +#define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG)
> +#define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY)
> +#define nfserr_dquot cpu_to_be32(NFSERR_DQUOT)
> +#define nfserr_stale cpu_to_be32(NFSERR_STALE)
> +#define nfserr_remote cpu_to_be32(NFS3ERR_REMOTE)
> +#define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH)
> +#define nfserr_badhandle cpu_to_be32(NFS3ERR_BADHANDLE)
> +#define nfserr_notsync cpu_to_be32(NFS3ERR_NOT_SYNC)
> +#define nfserr_badcookie cpu_to_be32(NFS3ERR_BAD_COOKIE)
> +#define nfserr_notsupp cpu_to_be32(NFS3ERR_NOTSUPP)
> +#define nfserr_toosmall cpu_to_be32(NFS3ERR_TOOSMALL)
> +#define nfserr_serverfault cpu_to_be32(NFS3ERR_SERVERFAULT)
> +#define nfserr_badtype cpu_to_be32(NFS3ERR_BADTYPE)
> +#define nfserr_jukebox cpu_to_be32(NFS3ERR_JUKEBOX)
> #define nfserr_delay cpu_to_be32(NFS4ERR_DELAY)
> +#define nfserr_same cpu_to_be32(NFS4ERR_SAME)
> +#define nfserr_denied cpu_to_be32(NFS4ERR_DENIED)
> +#define nfserr_deadlock cpu_to_be32(NFS4ERR_DEADLOCK)
> +#define nfserr_expired cpu_to_be32(NFS4ERR_EXPIRED)
> +#define nfserr_bad_cookie cpu_to_be32(NFS4ERR_BAD_COOKIE)
> +#define nfserr_clid_inuse cpu_to_be32(NFS4ERR_CLID_INUSE)
> +#define nfserr_stale_clientid cpu_to_be32(NFS4ERR_STALE_CLIENTID)
> +#define nfserr_resource cpu_to_be32(NFS4ERR_RESOURCE)
> +#define nfserr_moved cpu_to_be32(NFS4ERR_MOVED)
> +#define nfserr_nofilehandle cpu_to_be32(NFS4ERR_NOFILEHANDLE)
> +#define nfserr_minor_vers_mismatch cpu_to_be32(NFS4ERR_MINOR_VERS_MISMATCH)
> +#define nfserr_share_denied cpu_to_be32(NFS4ERR_SHARE_DENIED)
> +#define nfserr_stale_stateid cpu_to_be32(NFS4ERR_STALE_STATEID)
> +#define nfserr_old_stateid cpu_to_be32(NFS4ERR_OLD_STATEID)
> +#define nfserr_bad_stateid cpu_to_be32(NFS4ERR_BAD_STATEID)
> +#define nfserr_bad_seqid cpu_to_be32(NFS4ERR_BAD_SEQID)
> +#define nfserr_symlink cpu_to_be32(NFS4ERR_SYMLINK)
> +#define nfserr_not_same cpu_to_be32(NFS4ERR_NOT_SAME)
> +#define nfserr_lock_range cpu_to_be32(NFS4ERR_LOCK_RANGE)
> +#define nfserr_restorefh cpu_to_be32(NFS4ERR_RESTOREFH)
> +#define nfserr_attrnotsupp cpu_to_be32(NFS4ERR_ATTRNOTSUPP)
> +#define nfserr_bad_xdr cpu_to_be32(NFS4ERR_BADXDR)
> +#define nfserr_openmode cpu_to_be32(NFS4ERR_OPENMODE)
> +#define nfserr_badowner cpu_to_be32(NFS4ERR_BADOWNER)
> +#define nfserr_locks_held cpu_to_be32(NFS4ERR_LOCKS_HELD)
> +#define nfserr_op_illegal cpu_to_be32(NFS4ERR_OP_ILLEGAL)
> +#define nfserr_grace cpu_to_be32(NFS4ERR_GRACE)
> +#define nfserr_no_grace cpu_to_be32(NFS4ERR_NO_GRACE)
> +#define nfserr_reclaim_bad cpu_to_be32(NFS4ERR_RECLAIM_BAD)
> +#define nfserr_badname cpu_to_be32(NFS4ERR_BADNAME)
> +#define nfserr_admin_revoked cpu_to_be32(NFS4ERR_ADMIN_REVOKED)
> +#define nfserr_cb_path_down cpu_to_be32(NFS4ERR_CB_PATH_DOWN)
> +#define nfserr_locked cpu_to_be32(NFS4ERR_LOCKED)
> +#define nfserr_wrongsec cpu_to_be32(NFS4ERR_WRONGSEC)
> #define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE)
> #define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT)
> #define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST)
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2026-08-28 14:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 19:44 [PATCH 1/2] NFS: Import NFS3ERR definitions Chuck Lever
2026-08-26 19:44 ` [PATCH 2/2] NFSD: Rework be32 nfserr definitions Chuck Lever
2026-08-28 14:42 ` Jeff Layton [this message]
2026-08-28 14:42 ` [PATCH 1/2] NFS: Import NFS3ERR definitions 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=9768f723beed33c611e36075504b07b1e8e493a7.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=cel@kernel.org \
--cc=dai.ngo@oracle.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox