Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jul 2020 03:25:31 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r363631 - projects/nfs-over-tls/sys/fs/nfsserver
Message-ID:  <202007280325.06S3PVGl059733@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Tue Jul 28 03:25:31 2020
New Revision: 363631
URL: https://svnweb.freebsd.org/changeset/base/363631

Log:
  Put nfs_fha_new.c from head into sys/fs/nfsserver.
  
  The changes applied to nfs_fha_new.c were only needed if dissection of XDR
  needed to be done from ext_pgs mbufs, which is not currently needed.

Modified:
  projects/nfs-over-tls/sys/fs/nfsserver/nfs_fha_new.c

Modified: projects/nfs-over-tls/sys/fs/nfsserver/nfs_fha_new.c
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfsserver/nfs_fha_new.c	Tue Jul 28 02:56:26 2020	(r363630)
+++ projects/nfs-over-tls/sys/fs/nfsserver/nfs_fha_new.c	Tue Jul 28 03:25:31 2020	(r363631)
@@ -43,11 +43,11 @@ static MALLOC_DEFINE(M_NFS_FHA, "NFS FHA", "NFS FHA");
 static void		fhanew_init(void *foo);
 static void		fhanew_uninit(void *foo);
 static rpcproc_t	fhanew_get_procnum(rpcproc_t procnum);
-static int		fhanew_get_fh(uint64_t *fh, int v3,
-			    struct nfsrv_descript *nd);
+static int		fhanew_get_fh(uint64_t *fh, int v3, struct mbuf **md,
+			    caddr_t *dpos);
 static int		fhanew_is_read(rpcproc_t procnum);
 static int		fhanew_is_write(rpcproc_t procnum);
-static int		fhanew_get_offset(struct nfsrv_descript *nd,
+static int		fhanew_get_offset(struct mbuf **md, caddr_t *dpos,
 			    int v3, struct fha_info *info);
 static int		fhanew_no_offset(rpcproc_t procnum);
 static void		fhanew_set_locktype(rpcproc_t procnum,
@@ -164,8 +164,9 @@ fhanew_get_procnum(rpcproc_t procnum)
 }
 
 static int
-fhanew_get_fh(uint64_t *fh, int v3, struct nfsrv_descript *nd)
+fhanew_get_fh(uint64_t *fh, int v3, struct mbuf **md, caddr_t *dpos)
 {
+	struct nfsrv_descript lnd, *nd;
 	uint32_t *tl;
 	uint8_t *buf;
 	uint64_t t;
@@ -173,7 +174,11 @@ fhanew_get_fh(uint64_t *fh, int v3, struct nfsrv_descr
 
 	error = 0;
 	len = 0;
+	nd = &lnd;
 
+	nd->nd_md = *md;
+	nd->nd_dpos = *dpos;
+
 	if (v3) {
 		NFSM_DISSECT_NONBLOCK(tl, uint32_t *, NFSX_UNSIGNED);
 		if ((len = fxdr_unsigned(int, *tl)) <= 0 || len > NFSX_FHMAX) {
@@ -193,6 +198,9 @@ fhanew_get_fh(uint64_t *fh, int v3, struct nfsrv_descr
 	*fh = t;
 
 nfsmout:
+	*md = nd->nd_md;
+	*dpos = nd->nd_dpos;
+
 	return (error);
 }
 
@@ -215,14 +223,19 @@ fhanew_is_write(rpcproc_t procnum)
 }
 
 static int
-fhanew_get_offset(struct nfsrv_descript *nd, int v3,
+fhanew_get_offset(struct mbuf **md, caddr_t *dpos, int v3,
     struct fha_info *info)
 {
+	struct nfsrv_descript lnd, *nd;
 	uint32_t *tl;
 	int error;
 
 	error = 0;
 
+	nd = &lnd;
+	nd->nd_md = *md;
+	nd->nd_dpos = *dpos;
+
 	if (v3) {
 		NFSM_DISSECT_NONBLOCK(tl, uint32_t *, 2 * NFSX_UNSIGNED);
 		info->offset = fxdr_hyper(tl);
@@ -232,6 +245,9 @@ fhanew_get_offset(struct nfsrv_descript *nd, int v3,
 	}
 
 nfsmout:
+	*md = nd->nd_md;
+	*dpos = nd->nd_dpos;
+
 	return (error);
 }
 
@@ -290,13 +306,13 @@ fhanew_set_locktype(rpcproc_t procnum, struct fha_info
 static void
 fha_extract_info(struct svc_req *req, struct fha_info *i)
 {
+	struct mbuf *md;
+	caddr_t dpos;
 	static u_int64_t random_fh = 0;
 	int error;
 	int v3 = (req->rq_vers == 3);
 	rpcproc_t procnum;
-	struct nfsrv_descript lnd, *nd;
 
-	nd = &lnd;
 	/*
 	 * We start off with a random fh.  If we get a reasonable
 	 * procnum, we set the fh.  If there's a concept of offset
@@ -337,17 +353,17 @@ fha_extract_info(struct svc_req *req, struct fha_info 
 	error = newnfs_realign(&req->rq_args, M_NOWAIT);
 	if (error)
 		goto out;
-	nd->nd_md = req->rq_args;
-	nd->nd_dpos = mtod(nd->nd_md, char *);
+	md = req->rq_args;
+	dpos = mtod(md, caddr_t);
 
 	/* Grab the filehandle. */
-	error = fhanew_get_fh(&i->fh, v3, nd);
+	error = fhanew_get_fh(&i->fh, v3, &md, &dpos);
 	if (error)
 		goto out;
 
 	/* Content ourselves with zero offset for all but reads. */
 	if (i->read || i->write)
-		fhanew_get_offset(nd, v3, i);
+		fhanew_get_offset(&md, &dpos, v3, i);
 
 out:
 	fhanew_set_locktype(procnum, i);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007280325.06S3PVGl059733>