Commit 5f4ab945 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd4: allow space for final error return

This post-encoding check should be taking into account the need to
encode at least an out-of-space error to the following op (if any).
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 07d1f802
...@@ -3636,6 +3636,7 @@ void ...@@ -3636,6 +3636,7 @@ void
nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
{ {
struct nfs4_stateowner *so = resp->cstate.replay_owner; struct nfs4_stateowner *so = resp->cstate.replay_owner;
struct svc_rqst *rqstp = resp->rqstp;
__be32 *statp; __be32 *statp;
nfsd4_enc encoder; nfsd4_enc encoder;
__be32 *p; __be32 *p;
...@@ -3652,8 +3653,12 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) ...@@ -3652,8 +3653,12 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
encoder = nfsd4_enc_ops[op->opnum]; encoder = nfsd4_enc_ops[op->opnum];
op->status = encoder(resp, op->status, &op->u); op->status = encoder(resp, op->status, &op->u);
/* nfsd4_check_resp_size guarantees enough room for error status */ /* nfsd4_check_resp_size guarantees enough room for error status */
if (!op->status) if (!op->status) {
op->status = nfsd4_check_resp_size(resp, 0); int space_needed = 0;
if (!nfsd4_last_compound_op(rqstp))
space_needed = COMPOUND_ERR_SLACK_SPACE;
op->status = nfsd4_check_resp_size(resp, space_needed);
}
if (op->status == nfserr_resource || if (op->status == nfserr_resource ||
op->status == nfserr_rep_too_big || op->status == nfserr_rep_too_big ||
op->status == nfserr_rep_too_big_to_cache) { op->status == nfserr_rep_too_big_to_cache) {
......
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