From owner-freebsd-current Sun Jul 14 08:05:40 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id IAA29197 for current-outgoing; Sun, 14 Jul 1996 08:05:40 -0700 (PDT) Received: from relay-4.mail.demon.net (relay-4.mail.demon.net [158.152.1.108]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id IAA29115 for ; Sun, 14 Jul 1996 08:05:28 -0700 (PDT) Received: from post.demon.co.uk ([158.152.1.72]) by relay-4.mail.demon.net id aa13053; 14 Jul 96 15:05 GMT Received: from nlsys.demon.co.uk ([158.152.125.33]) by relay-3.mail.demon.net id aa16650; 14 Jul 96 15:01 +0100 Message-ID: <31E8FDC8.167EB0E7@nlsys.demon.co.uk> Date: Sun, 14 Jul 1996 15:01:44 +0100 From: Doug Rabson Organization: None X-Mailer: Mozilla 3.0b4 (X11; I; FreeBSD 2.2-CURRENT i386) MIME-Version: 1.0 To: current@freebsd.org CC: dfr@render.com Subject: NFSv3 fixes Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Here is a second attempt at these NFSv3 fixes, based on some feedback from Bruce Evans. I will commit these tomorrow unless anyone else has some comments. Index: nfs_bio.c =================================================================== RCS file: /home/ncvs/src/sys/nfs/nfs_bio.c,v retrieving revision 1.23 diff -c -r1.23 nfs_bio.c *** nfs_bio.c 1996/06/08 05:59:04 1.23 --- nfs_bio.c 1996/07/14 13:46:05 *************** *** 584,589 **** --- 584,596 ---- bp->b_validoff = min(bp->b_validoff, bp->b_dirtyoff); bp->b_validend = max(bp->b_validend, bp->b_dirtyend); } + + /* + * Since this block is being modified, it must be written + * again and not just committed. + */ + bp->b_flags &= ~B_NEEDCOMMIT; + /* * If the lease is non-cachable or IO_SYNC do bwrite(). */ Index: nfs_subs.c =================================================================== RCS file: /home/ncvs/src/sys/nfs/nfs_subs.c,v retrieving revision 1.30 diff -c -r1.30 nfs_subs.c *** nfs_subs.c 1996/06/23 17:19:25 1.30 --- nfs_subs.c 1996/07/14 13:46:18 *************** *** 635,640 **** --- 635,642 ---- register int i; struct mbuf *mreq, *mb2; int siz, grpsiz, authsiz; + struct timeval tv; + static u_long base; authsiz = nfsm_rndup(auth_len); MGETHDR(mb, M_WAIT, MT_DATA); *************** *** 653,660 **** --- 655,676 ---- * First the RPC header. */ nfsm_build(tl, u_long *, 8 * NFSX_UNSIGNED); + + /* + * derive initial xid from system time + * XXX time is invalid if root not yet mounted + */ + if (!base && (rootvp)) { + microtime(&tv); + base = tv.tv_sec << 12; + nfs_xid = base; + } + /* + * Skip zero xid if it should ever happen. + */ if (++nfs_xid == 0) nfs_xid++; + *tl++ = *xidp = txdr_unsigned(nfs_xid); *tl++ = rpc_call; *tl++ = rpc_vers; *************** *** 834,840 **** } /* ! * copies a uio scatter/gather list to an mbuf chain... */ int nfsm_uiotombuf(uiop, mq, siz, bpos) --- 850,857 ---- } /* ! * copies a uio scatter/gather list to an mbuf chain. ! * NOTE: can ony handle iovcnt == 1 */ int nfsm_uiotombuf(uiop, mq, siz, bpos) *************** *** 849,854 **** --- 866,874 ---- int uiosiz, clflg, rem; char *cp; + if (uiop->uio_iovcnt != 1) + panic("nfsm_uiotombuf: iovcnt != 1"); + if (siz > MLEN) /* or should it >= MCLBYTES ?? */ clflg = 1; else *************** *** 856,863 **** rem = nfsm_rndup(siz)-siz; mp = mp2 = *mq; while (siz > 0) { - if (uiop->uio_iovcnt <= 0 || uiop->uio_iov == NULL) - return (EINVAL); left = uiop->uio_iov->iov_len; uiocp = uiop->uio_iov->iov_base; if (left > siz) --- 876,881 ---- *************** *** 892,904 **** uiop->uio_offset += xfer; uiop->uio_resid -= xfer; } ! if (uiop->uio_iov->iov_len <= siz) { ! uiop->uio_iovcnt--; ! uiop->uio_iov++; ! } else { ! uiop->uio_iov->iov_base += uiosiz; ! uiop->uio_iov->iov_len -= uiosiz; ! } siz -= uiosiz; } if (rem > 0) { --- 910,917 ---- uiop->uio_offset += xfer; uiop->uio_resid -= xfer; } ! uiop->uio_iov->iov_base += uiosiz; ! uiop->uio_iov->iov_len -= uiosiz; siz -= uiosiz; } if (rem > 0) { Index: nfs_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/nfs/nfs_vnops.c,v retrieving revision 1.33 diff -c -r1.33 nfs_vnops.c *** nfs_vnops.c 1996/01/25 00:45:37 1.33 --- nfs_vnops.c 1996/07/14 13:46:52 *************** *** 757,763 **** if (vap->va_mtime.ts_sec != time.tv_sec) { nfsm_build(tl, u_long *, 3 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); ! txdr_nfsv3time(&vap->va_atime, tl); } else { nfsm_build(tl, u_long *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); --- 757,763 ---- if (vap->va_mtime.ts_sec != time.tv_sec) { nfsm_build(tl, u_long *, 3 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); ! txdr_nfsv3time(&vap->va_mtime, tl); } else { nfsm_build(tl, u_long *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); -- Doug Rabson Mail: dfr@nlsys.demon.co.uk Phone: +44 181 951 1891