|
@@ -3637,6 +3637,7 @@ 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;
|
|
__be32 *statp;
|
|
__be32 *statp;
|
|
|
|
+ nfsd4_enc encoder;
|
|
__be32 *p;
|
|
__be32 *p;
|
|
|
|
|
|
RESERVE_SPACE(8);
|
|
RESERVE_SPACE(8);
|
|
@@ -3648,10 +3649,24 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
|
|
goto status;
|
|
goto status;
|
|
BUG_ON(op->opnum < 0 || op->opnum >= ARRAY_SIZE(nfsd4_enc_ops) ||
|
|
BUG_ON(op->opnum < 0 || op->opnum >= ARRAY_SIZE(nfsd4_enc_ops) ||
|
|
!nfsd4_enc_ops[op->opnum]);
|
|
!nfsd4_enc_ops[op->opnum]);
|
|
- op->status = nfsd4_enc_ops[op->opnum](resp, op->status, &op->u);
|
|
|
|
|
|
+ encoder = nfsd4_enc_ops[op->opnum];
|
|
|
|
+ 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);
|
|
op->status = nfsd4_check_resp_size(resp, 0);
|
|
|
|
+ if (op->status == nfserr_resource ||
|
|
|
|
+ op->status == nfserr_rep_too_big ||
|
|
|
|
+ op->status == nfserr_rep_too_big_to_cache) {
|
|
|
|
+ /*
|
|
|
|
+ * The operation may have already been encoded or
|
|
|
|
+ * partially encoded. No op returns anything additional
|
|
|
|
+ * in the case of one of these three errors, so we can
|
|
|
|
+ * just truncate back to after the status. But it's a
|
|
|
|
+ * bug if we had to do this on a non-idempotent op:
|
|
|
|
+ */
|
|
|
|
+ warn_on_nonidempotent_op(op);
|
|
|
|
+ resp->xdr.p = statp + 1;
|
|
|
|
+ }
|
|
if (so) {
|
|
if (so) {
|
|
so->so_replay.rp_status = op->status;
|
|
so->so_replay.rp_status = op->status;
|
|
so->so_replay.rp_buflen = (char *)resp->xdr.p
|
|
so->so_replay.rp_buflen = (char *)resp->xdr.p
|