Date: Mon, 17 Feb 2020 21:10:33 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r358053 - projects/nfs-over-tls/sys/fs/nfsclient Message-ID: <202002172110.01HLAXZY003012@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Mon Feb 17 21:10:32 2020 New Revision: 358053 URL: https://svnweb.freebsd.org/changeset/base/358053 Log: Update nfs_clrpcops.c to handle ext_pgs mbufs, including the additional argument to nfscl_reqstart() to tell it if it should build ext_pgs mbufs. This completes most of the conversion to support of ext_pgs mbufs, but there are still a couple of areas to fix. 1 - The code that the MDS uses to do a proxy to a DS for a pNFS server. 2 - The krpc code on the receive side. (The NFS code now handles the ext_pgs mbufs, but they are being created by copying the regular mbuf list when the NFS code gets it from the krpc.) The krpc still needs to be fixed so it can handle a list of ext_pgs mbufs handed to it by soreceive(). Modified: projects/nfs-over-tls/sys/fs/nfsclient/nfs_clrpcops.c Modified: projects/nfs-over-tls/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- projects/nfs-over-tls/sys/fs/nfsclient/nfs_clrpcops.c Mon Feb 17 21:02:30 2020 (r358052) +++ projects/nfs-over-tls/sys/fs/nfsclient/nfs_clrpcops.c Mon Feb 17 21:10:32 2020 (r358053) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #ifndef APPLEKEXT #include "opt_inet6.h" +#include "opt_kern_tls.h" #include <fs/nfs/nfsport.h> #include <fs/nfsclient/nfs.h> @@ -76,6 +77,7 @@ extern int nfscl_debuglevel; extern int nfs_pnfsiothreads; extern u_long sb_max_adj; extern int nfs_maxcopyrange; +extern bool nfs_use_ext_pgs; NFSCLSTATEMUTEX; int nfstest_outofseq = 0; int nfscl_assumeposixlocks = 1; @@ -501,7 +503,8 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int dp = *dpp; *dpp = NULL; - nfscl_reqstart(nd, NFSPROC_OPEN, nmp, nfhp, fhlen, NULL, NULL, 0, 0); + nfscl_reqstart(nd, NFSPROC_OPEN, nmp, nfhp, fhlen, NULL, NULL, 0, 0, + false); NFSM_BUILD(tl, u_int32_t *, 5 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH); @@ -857,7 +860,7 @@ nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsm int error; nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh, - op->nfso_fhlen, NULL, NULL, 0, 0); + op->nfso_fhlen, NULL, NULL, 0, 0, false); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID); *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); if (NFSHASNFSV4N(nmp)) @@ -900,7 +903,7 @@ nfsrpc_openconfirm(vnode_t vp, u_int8_t *nfhp, int fhl if (NFSHASNFSV4N(nmp)) return (0); /* No confirmation for NFSv4.1. */ nfscl_reqstart(nd, NFSPROC_OPENCONFIRM, nmp, nfhp, fhlen, NULL, NULL, - 0, 0); + 0, 0, false); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID); *tl++ = op->nfso_stateid.seqid; *tl++ = op->nfso_stateid.other[0]; @@ -1014,7 +1017,8 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli tsep = NFSMNT_MDSSESSION(nmp); NFSUNLOCKMNT(nmp); - nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL, 0, 0); + nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL, 0, 0, + false); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(nfsboottime.tv_sec); *tl = txdr_unsigned(clp->nfsc_rev); @@ -1084,7 +1088,7 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli * and confirm it. */ nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL, - NULL, 0, 0); + NULL, 0, 0, false); NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED); *tl++ = tsep->nfsess_clientid.lval[0]; *tl++ = tsep->nfsess_clientid.lval[1]; @@ -1099,7 +1103,7 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli nd->nd_mrep = NULL; if (nd->nd_repstat == 0) { nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, nmp->nm_fh, - nmp->nm_fhsize, NULL, NULL, 0, 0); + nmp->nm_fhsize, NULL, NULL, 0, 0, false); NFSZERO_ATTRBIT(&attrbits); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_LEASETIME); (void) nfsrv_putattrbit(nd, &attrbits); @@ -1166,7 +1170,8 @@ nfsrpc_getattrnovp(struct nfsmount *nmp, u_int8_t *fhp int error, vers = NFS_VER2; nfsattrbit_t attrbits; - nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, fhp, fhlen, NULL, NULL, 0, 0); + nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, fhp, fhlen, NULL, NULL, 0, 0, + false); if (nd->nd_flag & ND_NFSV4) { vers = NFS_VER4; NFSGETATTR_ATTRBIT(&attrbits); @@ -1734,8 +1739,13 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom struct nfsrv_descript *nd = &nfsd; nfsattrbit_t attrbits; off_t tmp_off; + bool use_ext; KASSERT(uiop->uio_iovcnt == 1, ("nfs: writerpc iovcnt > 1")); + use_ext = false; + if ((NFSHASTLS(nmp) || nfs_use_ext_pgs) && + PMAP_HAS_DMAP != 0) + use_ext = true; *attrflagp = 0; tsiz = uio_uio_resid(uiop); tmp_off = uiop->uio_offset + tsiz; @@ -1751,7 +1761,8 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom while (tsiz > 0) { *attrflagp = 0; len = (tsiz > wsize) ? wsize : tsiz; - NFSCL_REQSTART(nd, NFSPROC_WRITE, vp); + nfscl_reqstart(nd, NFSPROC_WRITE, nmp, np->n_fhp->nfh_fh, + np->n_fhp->nfh_len, NULL, NULL, 0, 0, use_ext); if (nd->nd_flag & ND_NFSV4) { nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID); NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER+2*NFSX_UNSIGNED); @@ -4089,7 +4100,7 @@ nfsrpc_locku(struct nfsrv_descript *nd, struct nfsmoun int error; nfscl_reqstart(nd, NFSPROC_LOCKU, nmp, lp->nfsl_open->nfso_fh, - lp->nfsl_open->nfso_fhlen, NULL, NULL, 0, 0); + lp->nfsl_open->nfso_fhlen, NULL, NULL, 0, 0, false); NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 6 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(type); *tl = txdr_unsigned(lp->nfsl_seqid); @@ -4141,7 +4152,8 @@ nfsrpc_lock(struct nfsrv_descript *nd, struct nfsmount uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; struct nfsclsession *tsep; - nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL, 0, 0); + nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL, 0, 0, + false); NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED); if (type == F_RDLCK) *tl++ = txdr_unsigned(NFSV4LOCKT_READ); @@ -4415,10 +4427,10 @@ nfsrpc_renew(struct nfsclclient *clp, struct nfsclds * return (0); if (dsp == NULL) nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL, 0, - 0); + 0, false); else nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, - &dsp->nfsclds_sess, 0, 0); + &dsp->nfsclds_sess, 0, 0, false); if (!NFSHASNFSV4N(nmp)) { /* NFSv4.1 just uses a Sequence Op and not a Renew. */ NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); @@ -4465,11 +4477,11 @@ nfsrpc_rellockown(struct nfsmount *nmp, struct nfscllo if (NFSHASNFSV4N(nmp)) { /* For NFSv4.1, do a FreeStateID. */ nfscl_reqstart(nd, NFSPROC_FREESTATEID, nmp, NULL, 0, NULL, - NULL, 0, 0); + NULL, 0, 0, false); nfsm_stateidtom(nd, &lp->nfsl_stateid, NFSSTATEID_PUTSTATEID); } else { nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL, - NULL, 0, 0); + NULL, 0, 0, false); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); tsep = nfsmnt_mdssession(nmp); *tl++ = tsep->nfsess_clientid.lval[0]; @@ -4503,7 +4515,7 @@ nfsrpc_getdirpath(struct nfsmount *nmp, u_char *dirpat u_int32_t *opcntp; nfscl_reqstart(nd, NFSPROC_PUTROOTFH, nmp, NULL, 0, &opcntp, NULL, 0, - 0); + 0, false); cp = dirpath; cnt = 0; do { @@ -4570,7 +4582,7 @@ nfsrpc_delegreturn(struct nfscldeleg *dp, struct ucred int error; nfscl_reqstart(nd, NFSPROC_DELEGRETURN, nmp, dp->nfsdl_fh, - dp->nfsdl_fhlen, NULL, NULL, 0, 0); + dp->nfsdl_fhlen, NULL, NULL, 0, 0, false); NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID); if (NFSHASNFSV4N(nmp)) *tl++ = 0; @@ -4683,7 +4695,7 @@ nfsrpc_exchangeid(struct nfsmount *nmp, struct nfsclcl if (minorvers == 0) minorvers = nmp->nm_minorvers; nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL, - NFS_VER4, minorvers); + NFS_VER4, minorvers, false); NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(nfsboottime.tv_sec); /* Client owner */ *tl = txdr_unsigned(clp->nfsc_rev); @@ -4779,7 +4791,7 @@ nfsrpc_createsession(struct nfsmount *nmp, struct nfsc else minorvers = NFSV41_MINORVERSION; nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL, - NFS_VER4, minorvers); + NFS_VER4, minorvers, false); NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED); *tl++ = sep->nfsess_clientid.lval[0]; *tl++ = sep->nfsess_clientid.lval[1]; @@ -4906,7 +4918,7 @@ nfsrpc_destroysession(struct nfsmount *nmp, struct nfs struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL, 0, - 0); + 0, false); NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID); tsep = nfsmnt_mdssession(nmp); bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID); @@ -4934,7 +4946,7 @@ nfsrpc_destroyclient(struct nfsmount *nmp, struct nfsc struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL, 0, - 0); + 0, false); NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); tsep = nfsmnt_mdssession(nmp); *tl++ = tsep->nfsess_clientid.lval[0]; @@ -4963,7 +4975,7 @@ nfsrpc_layoutget(struct nfsmount *nmp, uint8_t *fhp, i int error; nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL, 0, - 0); + 0, false); nfsrv_setuplayoutget(nd, iomode, offset, len, minlen, stateidp, layouttype, layoutlen, 0); nd->nd_flag |= ND_USEGSSNAME; @@ -5007,7 +5019,7 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de ndi = NULL; gotdspp = NULL; nfscl_reqstart(nd, NFSPROC_GETDEVICEINFO, nmp, NULL, 0, NULL, NULL, 0, - 0); + 0, false); NFSM_BUILD(tl, uint32_t *, NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED); NFSBCOPY(deviceid, tl, NFSX_V4DEVICEID); tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); @@ -5228,7 +5240,7 @@ nfsrpc_layoutcommit(struct nfsmount *nmp, uint8_t *fh, int error; nfscl_reqstart(nd, NFSPROC_LAYOUTCOMMIT, nmp, fh, fhlen, NULL, NULL, - 0, 0); + 0, 0, false); NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED + 3 * NFSX_HYPER + NFSX_STATEID); txdr_hyper(off, tl); @@ -5279,7 +5291,7 @@ nfsrpc_layoutreturn(struct nfsmount *nmp, uint8_t *fh, int error; nfscl_reqstart(nd, NFSPROC_LAYOUTRETURN, nmp, fh, fhlen, NULL, NULL, - 0, 0); + 0, 0, false); NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED); if (reclaim != 0) *tl++ = newnfs_true; @@ -5636,7 +5648,7 @@ nfsrpc_reclaimcomplete(struct nfsmount *nmp, struct uc int error; nfscl_reqstart(nd, NFSPROC_RECLAIMCOMPL, nmp, NULL, 0, NULL, NULL, 0, - 0); + 0, false); NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); *tl = newnfs_false; nd->nd_flag |= ND_USEGSSNAME; @@ -5784,7 +5796,7 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode iovbase = uiop->uio_iov->iov_base; iovlen = uiop->uio_iov->iov_len; - m = nfsm_uiombuflist(uiop, len, + m = nfsm_uiombuflist(0, 0, uiop, len, NULL, NULL); } tdrpc = drpc = malloc(sizeof(*drpc) * @@ -6227,7 +6239,8 @@ nfsrpc_readds(vnode_t vp, struct uio *uiop, nfsv4state nd->nd_mrep = NULL; if (vers == 0 || vers == NFS_VER4) { nfscl_reqstart(nd, NFSPROC_READDS, nmp, fhp->nfh_fh, - fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, + false); vers = NFS_VER4; NFSCL_DEBUG(4, "nfsrpc_readds: vers4 minvers=%d\n", minorvers); if (flex != 0) @@ -6236,7 +6249,8 @@ nfsrpc_readds(vnode_t vp, struct uio *uiop, nfsv4state nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSEQIDZERO); } else { nfscl_reqstart(nd, NFSPROC_READ, nmp, fhp->nfh_fh, - fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, + false); NFSCL_DEBUG(4, "nfsrpc_readds: vers3\n"); } NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED * 3); @@ -6301,7 +6315,8 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomo nd->nd_mrep = NULL; if (vers == 0 || vers == NFS_VER4) { nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh, - fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, + false); NFSCL_DEBUG(4, "nfsrpc_writeds: vers4 minvers=%d\n", minorvers); vers = NFS_VER4; if (flex != 0) @@ -6311,7 +6326,8 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomo NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED); } else { nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh, - fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, + false); NFSCL_DEBUG(4, "nfsrpc_writeds: vers3\n"); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 3 * NFSX_UNSIGNED); } @@ -6429,7 +6445,8 @@ nfsrpc_writedsmir(vnode_t vp, int *iomode, int *must_c nd->nd_mrep = NULL; if (vers == 0 || vers == NFS_VER4) { nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh, - fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, + false); vers = NFS_VER4; NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers4 minvers=%d\n", minorvers); @@ -6437,7 +6454,8 @@ nfsrpc_writedsmir(vnode_t vp, int *iomode, int *must_c NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED); } else { nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh, - fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, + false); NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers3\n"); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 3 * NFSX_UNSIGNED); } @@ -6658,11 +6676,13 @@ nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, nd->nd_mrep = NULL; if (vers == 0 || vers == NFS_VER4) { nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, - fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, + false); vers = NFS_VER4; } else nfscl_reqstart(nd, NFSPROC_COMMIT, nmp, fhp->nfh_fh, - fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, + false); NFSCL_DEBUG(4, "nfsrpc_commitds: vers=%d minvers=%d\n", vers, minorvers); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED); @@ -6815,7 +6835,8 @@ nfsrpc_adviseds(vnode_t vp, uint64_t offset, int cnt, return (0); nd->nd_mrep = NULL; nfscl_reqstart(nd, NFSPROC_IOADVISEDS, nmp, fhp->nfh_fh, - fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, + false); vers = NFS_VER4; NFSCL_DEBUG(4, "nfsrpc_adviseds: vers=%d minvers=%d\n", vers, minorvers); @@ -7470,7 +7491,7 @@ nfsrpc_openlayoutrpc(struct nfsmount *nmp, vnode_t vp, *dpp = NULL; *laystatp = ENXIO; nfscl_reqstart(nd, NFSPROC_OPENLAYGET, nmp, nfhp, fhlen, NULL, NULL, - 0, 0); + 0, 0, false); NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH); @@ -8370,10 +8391,18 @@ nfsrpc_setextattr(vnode_t vp, const char *name, struct int error; struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; + struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); nfsattrbit_t attrbits; + bool use_ext; *attrflagp = 0; - NFSCL_REQSTART(nd, NFSPROC_SETEXTATTR, vp); + use_ext = false; + if (uiop->uio_resid > MCLBYTES && (NFSHASTLS(nmp) || + nfs_use_ext_pgs) && PMAP_HAS_DMAP != 0) + use_ext = true; + nfscl_reqstart(nd, NFSPROC_SETEXTATTR, nmp, + VTONFS(vp)->n_fhp->nfh_fh, VTONFS(vp)->n_fhp->nfh_len, NULL, + NULL, 0, 0, use_ext); if (uiop->uio_resid > nd->nd_maxreq) { /* nd_maxreq is set by NFSCL_REQSTART(). */ mbuf_freem(nd->nd_mreq);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002172110.01HLAXZY003012>