NFSD: Hoist status code encoding into XDR encoder functions
authorChuck Lever <chuck.lever@oracle.com>
Fri, 2 Oct 2020 19:52:44 +0000 (15:52 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 12 Oct 2020 14:29:44 +0000 (10:29 -0400)
commitcc028a10a48c3c555d7772d02f56eea9f86fdf79
tree78c88ccb5662c6f189f33abbb33c636456e61d3f
parent4b74fd793a77f6149d68dbf95574311af9506e39
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>
fs/nfsd/nfs2acl.c
fs/nfsd/nfs3acl.c
fs/nfsd/nfs3proc.c
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4xdr.c
fs/nfsd/nfsproc.c
fs/nfsd/nfssvc.c
fs/nfsd/nfsxdr.c
fs/nfsd/xdr.h