[1/6] NFSv4: fix getacl head length estimation
diff mbox

Message ID 1487470070-32358-2-git-send-email-bfields@redhat.com
State New
Headers show

Commit Message

J. Bruce Fields Feb. 19, 2017, 2:07 a.m. UTC
From: "J. Bruce Fields" <bfields@redhat.com>

Bitmap and attrlen follow immediately after the op reply header, so I'm
not sure what this extra "+1" was for.

Consequences of this are just minor efficiency (extra calls to
xdr_shrink_bufhead).

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfs/nfs4xdr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kinglong Mee Feb. 20, 2017, 1:19 p.m. UTC | #1
On 2/19/2017 10:07, J. Bruce Fields wrote:
> From: "J. Bruce Fields" <bfields@redhat.com>
> 
> Bitmap and attrlen follow immediately after the op reply header, so I'm
> not sure what this extra "+1" was for.
> 
> Consequences of this are just minor efficiency (extra calls to
> xdr_shrink_bufhead).
> 
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
>  fs/nfs/nfs4xdr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
> index e9255cb453e6..bb95dd2edeef 100644
> --- a/fs/nfs/nfs4xdr.c
> +++ b/fs/nfs/nfs4xdr.c
> @@ -2524,7 +2524,7 @@ static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr,
>  	encode_compound_hdr(xdr, req, &hdr);
>  	encode_sequence(xdr, &args->seq_args, &hdr);
>  	encode_putfh(xdr, args->fh, &hdr);
> -	replen = hdr.replen + op_decode_hdr_maxsz + 1;

The +1 is set at 28f566942c "NFS: use dynamically computed compound_hdr.replen
for xdr_inline_pages offset", 

@@ -1827,20 +1806,18 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p,
        xdr_init_encode(&xdr, &req->rq_snd_buf, p);
        encode_compound_hdr(&xdr, req, &hdr);
        encode_putfh(&xdr, args->fh, &hdr);
+       replen = hdr.replen + nfs4_fattr_bitmap_maxsz + 1;
        encode_getattr_two(&xdr, FATTR4_WORD0_ACL, 0, &hdr);

-       /* set up reply buffer: */
-       replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_getacl_sz) << 2;
-       xdr_inline_pages(&req->rq_rcv_buf, replen,
+       xdr_inline_pages(&req->rq_rcv_buf, replen << 2,
                args->acl_pages, args->acl_pgbase, args->acl_len);
        encode_nops(&hdr);
        return 0;

#define NFS4_dec_getacl_sz      (compound_decode_hdr_maxsz + \
                                decode_sequence_maxsz + \
                                decode_putfh_maxsz + \
                                *decode_getacl_maxsz*)

#define decode_getacl_maxsz     (op_decode_hdr_maxsz + \
                                 nfs4_fattr_bitmap_maxsz + 1)

But, forget remove it at commit bf118a342f,
"NFSv4: include bitmap in nfsv4 get acl data".

Reviewed-by: Kinglong Mee <kinglongmee@gmail.com>

thanks,
Kinglong Mee
> +	replen = hdr.replen + op_decode_hdr_maxsz;
>  	encode_getattr_two(xdr, FATTR4_WORD0_ACL, 0, &hdr);
>  
>  	xdr_inline_pages(&req->rq_rcv_buf, replen << 2,
> 
--
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
J. Bruce Fields Feb. 20, 2017, 3:50 p.m. UTC | #2
On Mon, Feb 20, 2017 at 09:19:14PM +0800, Kinglong Mee wrote:
> On 2/19/2017 10:07, J. Bruce Fields wrote:
> > From: "J. Bruce Fields" <bfields@redhat.com>
> > 
> > Bitmap and attrlen follow immediately after the op reply header, so I'm
> > not sure what this extra "+1" was for.
...
> The +1 is set at 28f566942c "NFS: use dynamically computed compound_hdr.replen
> for xdr_inline_pages offset", 
...
> But, forget remove it at commit bf118a342f,
> "NFSv4: include bitmap in nfsv4 get acl data".
> 
> Reviewed-by: Kinglong Mee <kinglongmee@gmail.com>

Thanks for the history, and the review.  I've added a "Fixes:
bf118a342f10" line.

--b.
--
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

Patch
diff mbox

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index e9255cb453e6..bb95dd2edeef 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2524,7 +2524,7 @@  static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr,
 	encode_compound_hdr(xdr, req, &hdr);
 	encode_sequence(xdr, &args->seq_args, &hdr);
 	encode_putfh(xdr, args->fh, &hdr);
-	replen = hdr.replen + op_decode_hdr_maxsz + 1;
+	replen = hdr.replen + op_decode_hdr_maxsz;
 	encode_getattr_two(xdr, FATTR4_WORD0_ACL, 0, &hdr);
 
 	xdr_inline_pages(&req->rq_rcv_buf, replen << 2,