Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1bc49d83 authored by J. Bruce Fields's avatar J. Bruce Fields
Browse files

nfsd4: fix nfs4err_resource in 4.1 case



encode_getattr, for example, can return nfserr_resource to indicate it
ran out of buffer space.  That's not a legal error in the 4.1 case.  And
in the 4.1 case, if we ran out of buffer space, we should have exceeded
a session limit too.

Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 480efaee
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3625,6 +3625,14 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
	/* nfsd4_check_resp_size guarantees enough room for error status */
	if (!op->status)
		op->status = nfsd4_check_resp_size(resp, 0);
	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 (so) {
		so->so_replay.rp_status = op->status;
		so->so_replay.rp_buflen = (char *)resp->p - (char *)(statp+1);