diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2020-10-02 21:52:44 +0200 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2020-10-12 16:29:44 +0200 |
commit | cc028a10a48c3c555d7772d02f56eea9f86fdf79 (patch) | |
tree | 78c88ccb5662c6f189f33abbb33c636456e61d3f /fs/nfsd/xdr.h | |
parent | NFSD: Map nfserr_wrongsec outside of nfsd_dispatch (diff) | |
download | linux-cc028a10a48c3c555d7772d02f56eea9f86fdf79.tar.xz linux-cc028a10a48c3c555d7772d02f56eea9f86fdf79.zip |
NFSD: Hoist status code encoding into XDR encoder functions
The original intent was presumably to reduce code duplication. The
trade-off was:
- No support for an NFSD proc function returning a non-success
RPC accept_stat value.
- No support for void NFS replies to non-NULL procedures.
- Everyone pays for the deduplication with a few extra conditional
branches in a hot path.
In addition, nfsd_dispatch() leaves *statp uninitialized in the
success path, unlike svc_generic_dispatch().
Address all of these problems by moving the logic for encoding
the NFS status code into the NFS XDR encoders themselves. Then
update the NFS .pc_func methods to return an RPC accept_stat
value.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/xdr.h')
-rw-r--r-- | fs/nfsd/xdr.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/nfsd/xdr.h b/fs/nfsd/xdr.h index 17221931815f..0ff336b0b25f 100644 --- a/fs/nfsd/xdr.h +++ b/fs/nfsd/xdr.h @@ -82,6 +82,10 @@ struct nfsd_readdirargs { __be32 * buffer; }; +struct nfsd_stat { + __be32 status; +}; + struct nfsd_attrstat { __be32 status; struct svc_fh fh; @@ -153,6 +157,7 @@ int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *); int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *); int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *); int nfssvc_encode_void(struct svc_rqst *, __be32 *); +int nfssvc_encode_stat(struct svc_rqst *, __be32 *); int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *); int nfssvc_encode_diropres(struct svc_rqst *, __be32 *); int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *); |