All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH v1 04/42] NFSD: Update GETATTR3args decoder to use struct xdr_stream
Date: Tue, 05 Jan 2021 10:30:02 -0500	[thread overview]
Message-ID: <160986060270.5532.7651375067308848822.stgit@klimt.1015granger.net> (raw)
In-Reply-To: <160986050640.5532.16498408936966394862.stgit@klimt.1015granger.net>

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3proc.c |    3 +--
 fs/nfsd/nfs3xdr.c  |   31 +++++++++++++++++++++++++------
 fs/nfsd/xdr3.h     |    2 +-
 3 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index c9c64471c568..4b66f055141b 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -683,7 +683,6 @@ nfsd3_proc_commit(struct svc_rqst *rqstp)
  * NFSv3 Server procedures.
  * Only the results of non-idempotent operations are cached.
  */
-#define nfs3svc_decode_fhandleargs	nfs3svc_decode_fhandle
 #define nfs3svc_encode_attrstatres	nfs3svc_encode_attrstat
 #define nfs3svc_encode_wccstatres	nfs3svc_encode_wccstat
 #define nfsd3_mkdirargs			nfsd3_createargs
@@ -715,7 +714,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
 		.pc_decode = nfs3svc_decode_fhandleargs,
 		.pc_encode = nfs3svc_encode_attrstatres,
 		.pc_release = nfs3svc_release_fhandle,
-		.pc_argsize = sizeof(struct nfsd3_fhandleargs),
+		.pc_argsize = sizeof(struct nfsd_fhandle),
 		.pc_ressize = sizeof(struct nfsd3_attrstatres),
 		.pc_cachetype = RC_NOCACHE,
 		.pc_xdrressize = ST+AT,
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 821db21ba072..01335b0e7c60 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -29,8 +29,9 @@ static u32	nfs3_ftypes[] = {
 
 
 /*
- * XDR functions for basic NFS types
+ * Basic NFSv3 data types (RFC 1813 Sections 2.5 and 2.6)
  */
+
 static __be32 *
 encode_time3(__be32 *p, struct timespec64 *time)
 {
@@ -46,6 +47,26 @@ decode_time3(__be32 *p, struct timespec64 *time)
 	return p;
 }
 
+static bool
+svcxdr_decode_nfs_fh3(struct xdr_stream *xdr, struct svc_fh *fhp)
+{
+	__be32 *p;
+	u32 size;
+
+	if (xdr_stream_decode_u32(xdr, &size) < 0)
+		return false;
+	if (size == 0 || size > NFS3_FHSIZE)
+		return false;
+	p = xdr_inline_decode(xdr, size);
+	if (!p)
+		return false;
+	fh_init(fhp, NFS3_FHSIZE);
+	fhp->fh_handle.fh_size = size;
+	memcpy(&fhp->fh_handle.fh_base, p, size);
+
+	return true;
+}
+
 static __be32 *
 decode_fh(__be32 *p, struct svc_fh *fhp)
 {
@@ -312,14 +333,12 @@ void fill_post_wcc(struct svc_fh *fhp)
  */
 
 int
-nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p)
+nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p)
 {
+	struct xdr_stream *xdr = &rqstp->rq_arg_stream;
 	struct nfsd_fhandle *args = rqstp->rq_argp;
 
-	p = decode_fh(p, &args->fh);
-	if (!p)
-		return 0;
-	return xdr_argsize_check(rqstp, p);
+	return svcxdr_decode_nfs_fh3(xdr, &args->fh);
 }
 
 int
diff --git a/fs/nfsd/xdr3.h b/fs/nfsd/xdr3.h
index 456fcd7a1038..62ea669768cf 100644
--- a/fs/nfsd/xdr3.h
+++ b/fs/nfsd/xdr3.h
@@ -273,7 +273,7 @@ union nfsd3_xdrstore {
 
 #define NFS3_SVC_XDRSIZE		sizeof(union nfsd3_xdrstore)
 
-int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *);
+int nfs3svc_decode_fhandleargs(struct svc_rqst *, __be32 *);
 int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *);
 int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *);
 int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *);



  parent reply	other threads:[~2021-01-05 15:31 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 15:29 [PATCH v1 00/42] Update NFSD XDR functions Chuck Lever
2021-01-05 15:29 ` [PATCH v1 01/42] SUNRPC: Make trace_svc_process() display the RPC procedure symbolically Chuck Lever
2021-01-05 15:29 ` [PATCH v1 02/42] SUNRPC: Display RPC procedure names instead of proc numbers Chuck Lever
2021-01-05 15:29 ` [PATCH v1 03/42] SUNRPC: Move definition of XDR_UNIT Chuck Lever
2021-01-05 15:30 ` Chuck Lever [this message]
2021-01-05 15:30 ` [PATCH v1 05/42] NFSD: Update ACCESS3arg decoder to use struct xdr_stream Chuck Lever
2021-01-05 15:30 ` [PATCH v1 06/42] NFSD: Update READ3arg " Chuck Lever
2021-01-05 15:30 ` [PATCH v1 07/42] NFSD: Update WRITE3arg " Chuck Lever
2021-01-22 18:47   ` J. Bruce Fields
2021-01-22 18:55     ` Chuck Lever
2021-01-05 15:30 ` [PATCH v1 08/42] NFSD: Update READLINK3arg " Chuck Lever
2021-01-05 15:30 ` [PATCH v1 09/42] NFSD: Fix returned READDIR offset cookie Chuck Lever
2021-01-05 15:30 ` [PATCH v1 10/42] NFSD: Add helper to set up the pages where the dirlist is encoded Chuck Lever
2021-01-05 15:30 ` [PATCH v1 11/42] NFSD: Update READDIR3args decoders to use struct xdr_stream Chuck Lever
2021-01-05 15:30 ` [PATCH v1 12/42] NFSD: Update COMMIT3arg decoder " Chuck Lever
2021-01-05 15:30 ` [PATCH v1 13/42] NFSD: Update the NFSv3 DIROPargs " Chuck Lever
2021-01-05 15:30 ` [PATCH v1 14/42] NFSD: Update the RENAME3args " Chuck Lever
2021-01-05 15:30 ` [PATCH v1 15/42] NFSD: Update the LINK3args " Chuck Lever
2021-01-05 15:31 ` [PATCH v1 16/42] NFSD: Update the SETATTR3args " Chuck Lever
2021-01-05 15:31 ` [PATCH v1 17/42] NFSD: Update the CREATE3args " Chuck Lever
2021-01-05 15:31 ` [PATCH v1 18/42] NFSD: Update the MKDIR3args " Chuck Lever
2021-01-05 15:31 ` [PATCH v1 19/42] NFSD: Update the SYMLINK3args " Chuck Lever
2021-01-05 15:31 ` [PATCH v1 20/42] NFSD: Update the MKNOD3args " Chuck Lever
2021-01-05 15:31 ` [PATCH v1 21/42] NFSD: Update the NFSv2 GETATTR argument " Chuck Lever
2021-01-05 15:31 ` [PATCH v1 22/42] NFSD: Update the NFSv2 READ " Chuck Lever
2021-01-05 15:31 ` [PATCH v1 23/42] NFSD: Update the NFSv2 WRITE " Chuck Lever
2021-01-05 15:31 ` [PATCH v1 24/42] NFSD: Update the NFSv2 READLINK " Chuck Lever
2021-01-05 15:31 ` [PATCH v1 25/42] NFSD: Add helper to set up the pages where the dirlist is encoded Chuck Lever
2021-01-05 15:31 ` [PATCH v1 26/42] NFSD: Update the NFSv2 READDIR argument decoder to use struct xdr_stream Chuck Lever
2021-01-05 15:32 ` [PATCH v1 27/42] NFSD: Update NFSv2 diropargs decoding " Chuck Lever
2021-01-05 15:32 ` [PATCH v1 28/42] NFSD: Update the NFSv2 RENAME argument decoder " Chuck Lever
2021-01-05 15:32 ` [PATCH v1 29/42] NFSD: Update the NFSv2 LINK " Chuck Lever
2021-01-05 15:32 ` [PATCH v1 30/42] NFSD: Update the NFSv2 SETATTR " Chuck Lever
2021-01-05 15:32 ` [PATCH v1 31/42] NFSD: Update the NFSv2 CREATE " Chuck Lever
2021-01-05 15:32 ` [PATCH v1 32/42] NFSD: Update the NFSv2 SYMLINK " Chuck Lever
2021-01-05 15:32 ` [PATCH v1 33/42] NFSD: Remove argument length checking in nfsd_dispatch() Chuck Lever
2021-01-05 15:32 ` [PATCH v1 34/42] NFSD: Update the NFSv2 GETACL argument decoder to use struct xdr_stream Chuck Lever
2021-01-05 15:32 ` [PATCH v1 35/42] NFSD: Add an xdr_stream-based decoder for NFSv2/3 ACLs Chuck Lever
2021-01-05 15:32 ` [PATCH v1 36/42] NFSD: Update the NFSv2 SETACL argument decoder to use struct xdr_stream Chuck Lever
2021-01-05 15:32 ` [PATCH v1 37/42] NFSD: Update the NFSv2 ACL GETATTR " Chuck Lever
2021-01-05 15:33 ` [PATCH v1 38/42] NFSD: Update the NFSv2 ACL ACCESS " Chuck Lever
2021-01-05 15:33 ` [PATCH v1 39/42] NFSD: Clean up after updating NFSv2 ACL decoders Chuck Lever
2021-01-05 15:33 ` [PATCH v1 40/42] NFSD: Update the NFSv3 GETACL argument decoder to use struct xdr_stream Chuck Lever
2021-01-05 15:33 ` [PATCH v1 41/42] NFSD: Update the NFSv2 SETACL " Chuck Lever
2021-01-05 15:33 ` [PATCH v1 42/42] NFSD: Clean up after updating NFSv3 ACL decoders Chuck Lever
2021-01-08  3:18 ` [PATCH v1 00/42] Update NFSD XDR functions J. Bruce Fields
2021-01-08 15:50   ` Chuck Lever
2021-01-08 15:52     ` Bruce Fields
2021-01-08 15:56       ` Chuck Lever
2021-01-08 16:01         ` Bruce Fields
2021-01-08 16:35           ` Trond Myklebust
2021-01-08 18:08             ` bfields
2021-01-08 22:54               ` Trond Myklebust
2021-01-09 16:43                 ` Chuck Lever
2021-01-22 19:58 ` J. Bruce Fields

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=160986060270.5532.7651375067308848822.stgit@klimt.1015granger.net \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.