From owner-svn-src-all@freebsd.org Tue May 5 00:58:04 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6630D2C8B07; Tue, 5 May 2020 00:58:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49GLth24NSz43C8; Tue, 5 May 2020 00:58:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2841255BA; Tue, 5 May 2020 00:58:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0450w4es026288; Tue, 5 May 2020 00:58:04 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0450w3J1026287; Tue, 5 May 2020 00:58:03 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202005050058.0450w3J1026287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 5 May 2020 00:58:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360650 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 360650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2020 00:58:04 -0000 Author: rmacklem Date: Tue May 5 00:58:03 2020 New Revision: 360650 URL: https://svnweb.freebsd.org/changeset/base/360650 Log: Revert r360514, to avoid unnecessary churn of the sources. r360514 prepared the NFS code for changes to handle ext_pgs mbufs on the receive side. However, at this time, KERN_TLS does not pass ext_pgs mbufs up through soreceive(). As such, as this time, only the send/build side of the NFS mbuf code needs to handle ext_pgs mbufs. Revert r360514 since the rather extensive changes required for receive side ext_pgs mbufs are not yet needed. This avoids unnecessary churn of the sources. Modified: head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Tue May 5 00:08:41 2020 (r360649) +++ head/sys/fs/nfs/nfs_commonsubs.c Tue May 5 00:58:03 2020 (r360650) @@ -229,8 +229,6 @@ static void nfsrv_removeuser(struct nfsusrgrp *usrp, i static int nfsrv_getrefstr(struct nfsrv_descript *, u_char **, u_char **, int *, int *); static void nfsrv_refstrbigenough(int, u_char **, u_char **, int *); -static int nfsm_copyfrommbuf(struct nfsrv_descript *, char *, enum uio_seg, - int); static struct { int op; @@ -703,49 +701,52 @@ nfsm_dissct(struct nfsrv_descript *nd, int siz, int ho caddr_t retp; retp = NULL; - left = mtod(nd->nd_md, char *) + nd->nd_md->m_len - - nd->nd_dpos; + left = mtod(nd->nd_md, caddr_t) + nd->nd_md->m_len - nd->nd_dpos; while (left == 0) { - if (!nfsm_shiftnext(nd, &left)) - return (NULL); + nd->nd_md = nd->nd_md->m_next; + if (nd->nd_md == NULL) + return (retp); + left = nd->nd_md->m_len; + nd->nd_dpos = mtod(nd->nd_md, caddr_t); } if (left >= siz) { retp = nd->nd_dpos; nd->nd_dpos += siz; + } else if (nd->nd_md->m_next == NULL) { + return (retp); } else if (siz > ncl_mbuf_mhlen) { panic("nfs S too big"); } else { - /* Allocate a new mbuf for the "siz" bytes of data. */ MGET(mp2, MT_DATA, how); if (mp2 == NULL) return (NULL); - - /* - * Link the new mp2 mbuf into the list then copy left - * bytes from the mbuf before it and siz - left bytes - * from the mbuf(s) after it. - */ mp2->m_next = nd->nd_md->m_next; nd->nd_md->m_next = mp2; nd->nd_md->m_len -= left; - retp = p = mtod(mp2, char *); - memcpy(p, nd->nd_dpos, left); /* Copy what was left */ + nd->nd_md = mp2; + retp = p = mtod(mp2, caddr_t); + NFSBCOPY(nd->nd_dpos, p, left); /* Copy what was left */ siz2 = siz - left; p += left; - mp2->m_len = siz; - nd->nd_md = mp2->m_next; + mp2 = mp2->m_next; /* Loop around copying up the siz2 bytes */ while (siz2 > 0) { - if (nd->nd_md == NULL) + if (mp2 == NULL) return (NULL); - nfsm_set(nd, 0, false); - xfer = nfsm_copyfrommbuf(nd, p, - UIO_SYSSPACE, siz2); - p += xfer; - siz2 -= xfer; + xfer = (siz2 > mp2->m_len) ? mp2->m_len : siz2; + if (xfer > 0) { + NFSBCOPY(mtod(mp2, caddr_t), p, xfer); + mp2->m_data += xfer; + mp2->m_len -= xfer; + p += xfer; + siz2 -= xfer; + } if (siz2 > 0) - nd->nd_md = nd->nd_md->m_next; + mp2 = mp2->m_next; } + nd->nd_md->m_len = siz; + nd->nd_md = mp2; + nd->nd_dpos = mtod(mp2, caddr_t); } return (retp); } @@ -4824,76 +4825,5 @@ nfsv4_findmirror(struct nfsmount *nmp) } } return (ds); -} - -/* - * Fill in the fields of "struct nfsrv_descript" for a new ext_pgs mbuf. - * The build argument is true for build and false for dissect. - */ -int -nfsm_set(struct nfsrv_descript *nd, u_int offs, bool build) -{ - struct mbuf *m; - int rlen; - - if (build) - m = nd->nd_mb; - else - m = nd->nd_md; - if (build) { - nd->nd_bpos = mtod(m, char *) + offs; - rlen = m->m_len - offs; - } else { - nd->nd_dpos = mtod(m, char *); - rlen = m->m_len; - } - return (rlen); -} - -/* - * Copy up to "len" bytes from the mbuf into "cp" and adjust the - * mbuf accordingly. - * If cp == NULL, do not do the actual copy, but adjust the mbuf. - * Return the number of bytes actually copied. - * Adjust m_data and m_len so that a future calculation of what - * is left using mtod() will work correctly. - */ -static int -nfsm_copyfrommbuf(struct nfsrv_descript *nd, char *cp, enum uio_seg segflg, - int len) -{ - struct mbuf *m; - int xfer; - - m = nd->nd_md; - xfer = mtod(m, char *) + m->m_len - nd->nd_dpos; - xfer = min(xfer, len); - if (xfer > 0) { - if (cp != NULL) { - if (segflg == UIO_SYSSPACE) - memcpy(cp, nd->nd_dpos, xfer); - else - copyout(nd->nd_dpos, cp, xfer); - } - nd->nd_dpos += xfer; - m->m_data += xfer; - m->m_len -= xfer; - } - return (xfer); -} - -/* - * Shift to the next mbuf in the list list and update the nd fields. - * Return true if successful, false otherwise. - */ -bool -nfsm_shiftnext(struct nfsrv_descript *nd, int *leftp) -{ - - nd->nd_md = nd->nd_md->m_next; - if (nd->nd_md == NULL) - return (false); - *leftp = nfsm_set(nd, 0, false); - return (true); } Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Tue May 5 00:08:41 2020 (r360649) +++ head/sys/fs/nfs/nfs_var.h Tue May 5 00:58:03 2020 (r360650) @@ -361,8 +361,6 @@ int nfsv4_sequencelookup(struct nfsmount *, struct nfs void nfsv4_freeslot(struct nfsclsession *, int); struct ucred *nfsrv_getgrpscred(struct ucred *); struct nfsdevice *nfsv4_findmirror(struct nfsmount *); -int nfsm_set(struct nfsrv_descript *, u_int, bool); -bool nfsm_shiftnext(struct nfsrv_descript *, int *); /* nfs_clcomsubs.c */ void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int);