nfsd4: really fix nfs4err_resource in 4.1 case
[firefly-linux-kernel-4.4.55.git] / fs / nfsd / nfs4xdr.c
index 480f12c4e59014470f59bf4b1a6f9edcaacdee33..7f346d8ef26767d668782b15f015046a91f30181 100644 (file)
@@ -3901,6 +3901,14 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
                        space_needed = COMPOUND_ERR_SLACK_SPACE;
                op->status = nfsd4_check_resp_size(resp, space_needed);
        }
+       if (op->status == nfserr_resource && nfsd4_has_session(&resp->cstate)) {
+               struct nfsd4_slot *slot = resp->cstate.slot;
+
+               if (slot->sl_flags & NFSD4_SLOT_CACHETHIS)
+                       op->status = nfserr_rep_too_big_to_cache;
+               else
+                       op->status = nfserr_rep_too_big;
+       }
        if (op->status == nfserr_resource ||
            op->status == nfserr_rep_too_big ||
            op->status == nfserr_rep_too_big_to_cache) {