public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1 3/3] NFSD: Finish converting the NFSv3 GETACL result encoder
Date: Mon, 17 Oct 2022 09:04:08 -0400	[thread overview]
Message-ID: <9ae1b87c86abee8e2f7e234256e50fd42fc0e930.camel@kernel.org> (raw)
In-Reply-To: <166593522862.1710.16255807600348080659.stgit@klimt.1015granger.net>

On Sun, 2022-10-16 at 11:47 -0400, Chuck Lever wrote:
> For some reason, the NFSv2 GETACL result encoder was fully converted
> to use the new nfs_stream_encode_acl(), but the NFSv3 equivalent was
> not similarly converted.
> 
> Fixes: 20798dfe249a ("NFSD: Update the NFSv3 GETACL result encoder to use struct xdr_stream")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/nfs3acl.c |   30 ++++++------------------------
>  1 file changed, 6 insertions(+), 24 deletions(-)
> 
> diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
> index 9446c6743664..7c798b5f4ec6 100644
> --- a/fs/nfsd/nfs3acl.c
> +++ b/fs/nfsd/nfs3acl.c
> @@ -171,11 +171,7 @@ nfs3svc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
>  {
>  	struct nfsd3_getaclres *resp = rqstp->rq_resp;
>  	struct dentry *dentry = resp->fh.fh_dentry;
> -	struct kvec *head = rqstp->rq_res.head;
>  	struct inode *inode;
> -	unsigned int base;
> -	int n;
> -	int w;
>  
>  	if (!svcxdr_encode_nfsstat3(xdr, resp->status))
>  		return false;
> @@ -187,26 +183,12 @@ nfs3svc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
>  		if (xdr_stream_encode_u32(xdr, resp->mask) < 0)
>  			return false;
>  
> -		base = (char *)xdr->p - (char *)head->iov_base;
> -
> -		rqstp->rq_res.page_len = w = nfsacl_size(
> -			(resp->mask & NFS_ACL)   ? resp->acl_access  : NULL,
> -			(resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
> -		while (w > 0) {
> -			if (!*(rqstp->rq_next_page++))
> -				return false;
> -			w -= PAGE_SIZE;
> -		}
> -
> -		n = nfsacl_encode(&rqstp->rq_res, base, inode,
> -				  resp->acl_access,
> -				  resp->mask & NFS_ACL, 0);
> -		if (n > 0)
> -			n = nfsacl_encode(&rqstp->rq_res, base + n, inode,
> -					  resp->acl_default,
> -					  resp->mask & NFS_DFACL,
> -					  NFS_ACL_DEFAULT);
> -		if (n <= 0)
> +		if (!nfs_stream_encode_acl(xdr, inode, resp->acl_access,
> +					   resp->mask & NFS_ACL, 0))
> +			return false;
> +		if (!nfs_stream_encode_acl(xdr, inode, resp->acl_default,
> +					   resp->mask & NFS_DFACL,
> +					   NFS_ACL_DEFAULT))
>  			return false;
>  		break;
>  	default:
> 
> 

Much cleaner.

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2022-10-17 13:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 15:46 [PATCH 1 1/3] SUNRPC: Remove unused svc_rqst::rq_lock field Chuck Lever
2022-10-16 15:47 ` [PATCH 1 2/3] NFSD: Finish converting the NFSv2 GETACL result encoder Chuck Lever
2022-10-17 13:02   ` Jeff Layton
2022-10-16 15:47 ` [PATCH 1 3/3] NFSD: Finish converting the NFSv3 " Chuck Lever
2022-10-17 13:04   ` Jeff Layton [this message]
2022-10-17 12:55 ` [PATCH 1 1/3] SUNRPC: Remove unused svc_rqst::rq_lock field Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ae1b87c86abee8e2f7e234256e50fd42fc0e930.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox