提交 c228c24b 编写于 作者: A Andy Adamson 提交者: J. Bruce Fields

nfsd: fix compound state allocation error handling

Move the cstate_alloc call so that if it fails, the response is setup to
encode the NFS error. The out label now means that the
nfsd4_compound_state has not been allocated.
Signed-off-by: NAndy Adamson <andros@netapp.com>
Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
上级 24b8b447
...@@ -867,11 +867,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -867,11 +867,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
int slack_bytes; int slack_bytes;
__be32 status; __be32 status;
status = nfserr_resource;
cstate = cstate_alloc();
if (cstate == NULL)
goto out;
resp->xbuf = &rqstp->rq_res; resp->xbuf = &rqstp->rq_res;
resp->p = rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len; resp->p = rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len;
resp->tagp = resp->p; resp->tagp = resp->p;
...@@ -890,6 +885,11 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -890,6 +885,11 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
if (args->minorversion > NFSD_SUPPORTED_MINOR_VERSION) if (args->minorversion > NFSD_SUPPORTED_MINOR_VERSION)
goto out; goto out;
status = nfserr_resource;
cstate = cstate_alloc();
if (cstate == NULL)
goto out;
status = nfs_ok; status = nfs_ok;
while (!status && resp->opcnt < args->opcnt) { while (!status && resp->opcnt < args->opcnt) {
op = &args->ops[resp->opcnt++]; op = &args->ops[resp->opcnt++];
...@@ -957,9 +957,9 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -957,9 +957,9 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
nfsd4_increment_op_stats(op->opnum); nfsd4_increment_op_stats(op->opnum);
} }
cstate_free(cstate);
out: out:
nfsd4_release_compoundargs(args); nfsd4_release_compoundargs(args);
cstate_free(cstate);
dprintk("nfsv4 compound returned %d\n", ntohl(status)); dprintk("nfsv4 compound returned %d\n", ntohl(status));
return status; return status;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册