Commit 383c440d authored by Chuck Lever's avatar Chuck Lever Committed by J. Bruce Fields

NFSD: Clean up stale comments in nfsd_dispatch()

Add a documenting comment for the function. Remove comments that
simply describe obvious aspects of the code, but leave comments
that explain the differences in processing of each NFS version.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 84c138e7
...@@ -1000,8 +1000,18 @@ static bool nfs_request_too_big(struct svc_rqst *rqstp, ...@@ -1000,8 +1000,18 @@ static bool nfs_request_too_big(struct svc_rqst *rqstp,
return rqstp->rq_arg.len > PAGE_SIZE; return rqstp->rq_arg.len > PAGE_SIZE;
} }
int /**
nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) * nfsd_dispatch - Process an NFS or NFSACL Request
* @rqstp: incoming request
* @statp: pointer to location of accept_stat field in RPC Reply buffer
*
* This RPC dispatcher integrates the NFS server's duplicate reply cache.
*
* Return values:
* %0: Processing complete; do not send a Reply
* %1: Processing complete; send Reply in rqstp->rq_res
*/
int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
{ {
const struct svc_procedure *proc; const struct svc_procedure *proc;
__be32 nfserr; __be32 nfserr;
...@@ -1021,14 +1031,12 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) ...@@ -1021,14 +1031,12 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
* (necessary in the NFSv4.0 compound case) * (necessary in the NFSv4.0 compound case)
*/ */
rqstp->rq_cachetype = proc->pc_cachetype; rqstp->rq_cachetype = proc->pc_cachetype;
/* Decode arguments */
if (!proc->pc_decode(rqstp, (__be32 *)rqstp->rq_arg.head[0].iov_base)) { if (!proc->pc_decode(rqstp, (__be32 *)rqstp->rq_arg.head[0].iov_base)) {
dprintk("nfsd: failed to decode arguments!\n"); dprintk("nfsd: failed to decode arguments!\n");
*statp = rpc_garbage_args; *statp = rpc_garbage_args;
return 1; return 1;
} }
/* Check whether we have this call in the cache. */
switch (nfsd_cache_lookup(rqstp)) { switch (nfsd_cache_lookup(rqstp)) {
case RC_DOIT: case RC_DOIT:
break; break;
...@@ -1038,14 +1046,14 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) ...@@ -1038,14 +1046,14 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
return 0; return 0;
} }
/* need to grab the location to store the status, as /*
* nfsv4 does some encoding while processing * Need to grab the location to store the status, as
* NFSv4 does some encoding while processing
*/ */
nfserrp = rqstp->rq_res.head[0].iov_base nfserrp = rqstp->rq_res.head[0].iov_base
+ rqstp->rq_res.head[0].iov_len; + rqstp->rq_res.head[0].iov_len;
rqstp->rq_res.head[0].iov_len += sizeof(__be32); rqstp->rq_res.head[0].iov_len += sizeof(__be32);
/* Now call the procedure handler, and encode NFS status. */
nfserr = proc->pc_func(rqstp); nfserr = proc->pc_func(rqstp);
nfserr = map_new_errors(rqstp->rq_vers, nfserr); nfserr = map_new_errors(rqstp->rq_vers, nfserr);
if (nfserr == nfserr_dropit || test_bit(RQ_DROPME, &rqstp->rq_flags)) { if (nfserr == nfserr_dropit || test_bit(RQ_DROPME, &rqstp->rq_flags)) {
...@@ -1057,12 +1065,11 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) ...@@ -1057,12 +1065,11 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
if (rqstp->rq_proc != 0) if (rqstp->rq_proc != 0)
*nfserrp++ = nfserr; *nfserrp++ = nfserr;
/* Encode result. /*
* For NFSv2, additional info is never returned in case of an error. * For NFSv2, additional info is never returned in case of an error.
*/ */
if (!(nfserr && rqstp->rq_vers == 2)) { if (!(nfserr && rqstp->rq_vers == 2)) {
if (!proc->pc_encode(rqstp, nfserrp)) { if (!proc->pc_encode(rqstp, nfserrp)) {
/* Failed to encode result. Release cache entry */
dprintk("nfsd: failed to encode result!\n"); dprintk("nfsd: failed to encode result!\n");
nfsd_cache_update(rqstp, RC_NOCACHE, NULL); nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
*statp = rpc_system_err; *statp = rpc_system_err;
...@@ -1070,7 +1077,6 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) ...@@ -1070,7 +1077,6 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
} }
} }
/* Store reply in cache. */
nfsd_cache_update(rqstp, rqstp->rq_cachetype, statp + 1); nfsd_cache_update(rqstp, rqstp->rq_cachetype, statp + 1);
return 1; return 1;
} }
......
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