diff mbox

[08/50] nfsd4: fix nfs4err_resource in 4.1 case

Message ID 1395537141-10389-9-git-send-email-bfields@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bruce Fields March 23, 2014, 1:11 a.m. UTC
From: "J. Bruce Fields" <bfields@redhat.com>

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.
---
 fs/nfsd/nfs4xdr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

J. Bruce Fields March 29, 2014, 7:18 p.m. UTC | #1
I've applied the first 8 patches of this series for 3.15, with more
probably to come. My tree for 3.15 so far is at

	git://linux-nfs.org/~bfields/linux.git for-3.15

--b.

On Sat, Mar 22, 2014 at 09:11:39PM -0400, J. Bruce Fields wrote:
> From: "J. Bruce Fields" <bfields@redhat.com>
> 
> 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.
> ---
>  fs/nfsd/nfs4xdr.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 143780d..ea32674 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -3626,6 +3626,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);
> -- 
> 1.8.5.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 143780d..ea32674 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3626,6 +3626,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);