diff options
author | J. Bruce Fields <bfields@redhat.com> | 2014-03-07 11:01:37 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-05-27 11:09:09 -0400 |
commit | 5f4ab9458755eddc66912a15319363bf311f7fc8 (patch) | |
tree | d1001c05876ffb779498333db0f12f3e5b3fd2ea /fs/nfsd/nfs4xdr.c | |
parent | 07d1f8020738ba3180ea9992c4fa7dbc0685396a (diff) |
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: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 24ba652008db..2ed803662b09 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -3636,6 +3636,7 @@ void | |||
3636 | nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) | 3636 | nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) |
3637 | { | 3637 | { |
3638 | struct nfs4_stateowner *so = resp->cstate.replay_owner; | 3638 | struct nfs4_stateowner *so = resp->cstate.replay_owner; |
3639 | struct svc_rqst *rqstp = resp->rqstp; | ||
3639 | __be32 *statp; | 3640 | __be32 *statp; |
3640 | nfsd4_enc encoder; | 3641 | nfsd4_enc encoder; |
3641 | __be32 *p; | 3642 | __be32 *p; |
@@ -3652,8 +3653,12 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) | |||
3652 | encoder = nfsd4_enc_ops[op->opnum]; | 3653 | encoder = nfsd4_enc_ops[op->opnum]; |
3653 | op->status = encoder(resp, op->status, &op->u); | 3654 | op->status = encoder(resp, op->status, &op->u); |
3654 | /* nfsd4_check_resp_size guarantees enough room for error status */ | 3655 | /* nfsd4_check_resp_size guarantees enough room for error status */ |
3655 | if (!op->status) | 3656 | if (!op->status) { |
3656 | op->status = nfsd4_check_resp_size(resp, 0); | 3657 | int space_needed = 0; |
3658 | if (!nfsd4_last_compound_op(rqstp)) | ||
3659 | space_needed = COMPOUND_ERR_SLACK_SPACE; | ||
3660 | op->status = nfsd4_check_resp_size(resp, space_needed); | ||
3661 | } | ||
3657 | if (op->status == nfserr_resource || | 3662 | if (op->status == nfserr_resource || |
3658 | op->status == nfserr_rep_too_big || | 3663 | op->status == nfserr_rep_too_big || |
3659 | op->status == nfserr_rep_too_big_to_cache) { | 3664 | op->status == nfserr_rep_too_big_to_cache) { |