Commit 36ffa3d0 authored by NeilBrown's avatar NeilBrown Committed by Chuck Lever

nfsd: be more systematic about selecting error codes for internal use.

Rather than using ad hoc values for internal errors (30000, 11000, ...)
use 'enum' to sequentially allocate numbers starting from the first
known available number - now visible as NFS4ERR_FIRST_FREE.

The goal is values that are distinct from all be32 error codes.  To get
those we must first select integers that are not already used, then
convert them with cpu_to_be32().
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 1459ad57
...@@ -330,17 +330,31 @@ void nfsd_lockd_shutdown(void); ...@@ -330,17 +330,31 @@ void nfsd_lockd_shutdown(void);
#define nfserr_xattr2big cpu_to_be32(NFS4ERR_XATTR2BIG) #define nfserr_xattr2big cpu_to_be32(NFS4ERR_XATTR2BIG)
#define nfserr_noxattr cpu_to_be32(NFS4ERR_NOXATTR) #define nfserr_noxattr cpu_to_be32(NFS4ERR_NOXATTR)
/* error codes for internal use */ /*
* Error codes for internal use. We use enum to choose numbers that are
* not already assigned, then covert to be32 resulting in a number that
* cannot conflict with any existing be32 nfserr value.
*/
enum {
NFSERR_DROPIT = NFS4ERR_FIRST_FREE,
/* if a request fails due to kmalloc failure, it gets dropped. /* if a request fails due to kmalloc failure, it gets dropped.
* Client should resend eventually * Client should resend eventually
*/ */
#define nfserr_dropit cpu_to_be32(30000) #define nfserr_dropit cpu_to_be32(NFSERR_DROPIT)
/* end-of-file indicator in readdir */ /* end-of-file indicator in readdir */
#define nfserr_eof cpu_to_be32(30001) NFSERR_EOF,
#define nfserr_eof cpu_to_be32(NFSERR_EOF)
/* replay detected */ /* replay detected */
#define nfserr_replay_me cpu_to_be32(11001) NFSERR_REPLAY_ME,
#define nfserr_replay_me cpu_to_be32(NFSERR_REPLAY_ME)
/* nfs41 replay detected */ /* nfs41 replay detected */
#define nfserr_replay_cache cpu_to_be32(11002) NFSERR_REPLAY_CACHE,
#define nfserr_replay_cache cpu_to_be32(NFSERR_REPLAY_CACHE)
};
/* Check for dir entries '.' and '..' */ /* Check for dir entries '.' and '..' */
#define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) #define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.'))
......
...@@ -281,15 +281,18 @@ enum nfsstat4 { ...@@ -281,15 +281,18 @@ enum nfsstat4 {
/* nfs42 */ /* nfs42 */
NFS4ERR_PARTNER_NOTSUPP = 10088, NFS4ERR_PARTNER_NOTSUPP = 10088,
NFS4ERR_PARTNER_NO_AUTH = 10089, NFS4ERR_PARTNER_NO_AUTH = 10089,
NFS4ERR_UNION_NOTSUPP = 10090, NFS4ERR_UNION_NOTSUPP = 10090,
NFS4ERR_OFFLOAD_DENIED = 10091, NFS4ERR_OFFLOAD_DENIED = 10091,
NFS4ERR_WRONG_LFS = 10092, NFS4ERR_WRONG_LFS = 10092,
NFS4ERR_BADLABEL = 10093, NFS4ERR_BADLABEL = 10093,
NFS4ERR_OFFLOAD_NO_REQS = 10094, NFS4ERR_OFFLOAD_NO_REQS = 10094,
/* xattr (RFC8276) */ /* xattr (RFC8276) */
NFS4ERR_NOXATTR = 10095, NFS4ERR_NOXATTR = 10095,
NFS4ERR_XATTR2BIG = 10096, NFS4ERR_XATTR2BIG = 10096,
/* can be used for internal errors */
NFS4ERR_FIRST_FREE
}; };
/* error codes for internal client use */ /* error codes for internal client use */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment