[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Fri Mar 2 15:40:08 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/7f327dee520d
changeset: 402:7f327dee520d
user:      ray at terran.dlink.ua
date:      Fri Mar 02 17:17:35 2012 +0200
description:
Update to FreeBSD-HEAD @232391

diffstat:

 head/sys/nfsclient/nfs_bio.c    |  33 ++++++++++++++++++++++++---------
 head/sys/nfsclient/nfs_krpc.c   |  14 ++++++++------
 head/sys/nfsclient/nfs_vfsops.c |   6 +++---
 head/sys/nfsclient/nfs_vnops.c  |   6 +++---
 4 files changed, 38 insertions(+), 21 deletions(-)

diffs (180 lines):

diff -r 85c6a1e7c0b3 -r 7f327dee520d head/sys/nfsclient/nfs_bio.c
--- a/head/sys/nfsclient/nfs_bio.c	Fri Mar 02 17:17:27 2012 +0200
+++ b/head/sys/nfsclient/nfs_bio.c	Fri Mar 02 17:17:35 2012 +0200
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_bio.c 230605 2012-01-27 02:46:12Z rmacklem $");
+__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_bio.c 232327 2012-03-01 03:53:07Z rmacklem $");
 
 #include "opt_kdtrace.h"
 
@@ -564,7 +564,7 @@
 
 		n = 0;
 		if (on < bcount)
-			n = min((unsigned)(bcount - on), uio->uio_resid);
+			n = MIN((unsigned)(bcount - on), uio->uio_resid);
 		break;
 	    case VLNK:
 		nfsstats.biocache_readlinks++;
@@ -583,7 +583,7 @@
 			return (error);
 		    }
 		}
-		n = min(uio->uio_resid, NFS_MAXPATHLEN - bp->b_resid);
+		n = MIN(uio->uio_resid, NFS_MAXPATHLEN - bp->b_resid);
 		on = 0;
 		break;
 	    case VDIR:
@@ -751,8 +751,8 @@
 		struct iovec iov;
 do_sync:
 		while (uiop->uio_resid > 0) {
-			size = min(uiop->uio_resid, wsize);
-			size = min(uiop->uio_iov->iov_len, size);
+			size = MIN(uiop->uio_resid, wsize);
+			size = MIN(uiop->uio_iov->iov_len, size);
 			iov.iov_base = uiop->uio_iov->iov_base;
 			iov.iov_len = size;
 			uio.uio_iov = &iov;
@@ -800,8 +800,8 @@
 		 * in NFS directio access.
 		 */
 		while (uiop->uio_resid > 0) {
-			size = min(uiop->uio_resid, wsize);
-			size = min(uiop->uio_iov->iov_len, size);
+			size = MIN(uiop->uio_resid, wsize);
+			size = MIN(uiop->uio_iov->iov_len, size);
 			bp = getpbuf(&nfs_pbuf_freecnt);
 			t_uio = malloc(sizeof(struct uio), M_NFSDIRECTIO, M_WAITOK);
 			t_iov = malloc(sizeof(struct iovec), M_NFSDIRECTIO, M_WAITOK);
@@ -814,7 +814,21 @@
 			t_uio->uio_segflg = UIO_SYSSPACE;
 			t_uio->uio_rw = UIO_WRITE;
 			t_uio->uio_td = td;
-			bcopy(uiop->uio_iov->iov_base, t_iov->iov_base, size);
+			KASSERT(uiop->uio_segflg == UIO_USERSPACE ||
+			    uiop->uio_segflg == UIO_SYSSPACE,
+			    ("nfs_directio_write: Bad uio_segflg"));
+			if (uiop->uio_segflg == UIO_USERSPACE) {
+				error = copyin(uiop->uio_iov->iov_base,
+				    t_iov->iov_base, size);
+				if (error != 0)
+					goto err_free;
+			} else
+				/*
+				 * UIO_SYSSPACE may never happen, but handle
+				 * it just in case it does.
+				 */
+				bcopy(uiop->uio_iov->iov_base, t_iov->iov_base,
+				    size);
 			bp->b_flags |= B_DIRECT;
 			bp->b_iocmd = BIO_WRITE;
 			if (cred != NOCRED) {
@@ -825,6 +839,7 @@
 			bp->b_caller1 = (void *)t_uio;
 			bp->b_vp = vp;
 			error = nfs_asyncio(nmp, bp, NOCRED, td);
+err_free:
 			if (error) {
 				free(t_iov->iov_base, M_NFSDIRECTIO);
 				free(t_iov, M_NFSDIRECTIO);
@@ -1014,7 +1029,7 @@
 		nfsstats.biocache_writes++;
 		lbn = uio->uio_offset / biosize;
 		on = uio->uio_offset & (biosize-1);
-		n = min((unsigned)(biosize - on), uio->uio_resid);
+		n = MIN((unsigned)(biosize - on), uio->uio_resid);
 again:
 		/*
 		 * Handle direct append and file extension cases, calculate
diff -r 85c6a1e7c0b3 -r 7f327dee520d head/sys/nfsclient/nfs_krpc.c
--- a/head/sys/nfsclient/nfs_krpc.c	Fri Mar 02 17:17:27 2012 +0200
+++ b/head/sys/nfsclient/nfs_krpc.c	Fri Mar 02 17:17:35 2012 +0200
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_krpc.c 228757 2011-12-21 02:45:51Z rmacklem $");
+__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_krpc.c 232116 2012-02-24 17:26:06Z jhb $");
 
 /*
  * Socket operations for use by nfs
@@ -603,13 +603,15 @@
 		if (error == ESTALE)
 			nfs_purgecache(vp);
 		/*
-		 * Skip wcc data on NFS errors for now.  NetApp filers
-		 * return corrupt postop attrs in the wcc data for NFS
-		 * err EROFS.  Not sure if they could return corrupt
-		 * postop attrs for others errors.
+		 * Skip wcc data on non-ENOENT NFS errors for now.
+		 * NetApp filers return corrupt postop attrs in the
+		 * wcc data for NFS err EROFS.  Not sure if they could
+		 * return corrupt postop attrs for others errors.
+		 * Blocking ENOENT post-op attributes breaks negative
+		 * name caching, so always allow it through.
 		 */
 		if ((nmp->nm_flag & NFSMNT_NFSV3) &&
-		    !nfs_skip_wcc_data_onerr) {
+		    (!nfs_skip_wcc_data_onerr || error == ENOENT)) {
 			*mrp = mrep;
 			*mdp = md;
 			*dposp = dpos;
diff -r 85c6a1e7c0b3 -r 7f327dee520d head/sys/nfsclient/nfs_vfsops.c
--- a/head/sys/nfsclient/nfs_vfsops.c	Fri Mar 02 17:17:27 2012 +0200
+++ b/head/sys/nfsclient/nfs_vfsops.c	Fri Mar 02 17:17:35 2012 +0200
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_vfsops.c 230803 2012-01-31 03:58:26Z rmacklem $");
+__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_vfsops.c 231852 2012-02-17 02:39:58Z bz $");
 
 
 #include "opt_bootp.h"
@@ -510,10 +510,10 @@
 		sin.sin_len = sizeof(sin);
                 /* XXX MRT use table 0 for this sort of thing */
 		CURVNET_SET(TD_TO_VNET(td));
-		error = rtrequest(RTM_ADD, (struct sockaddr *)&sin,
+		error = rtrequest_fib(RTM_ADD, (struct sockaddr *)&sin,
 		    (struct sockaddr *)&nd->mygateway,
 		    (struct sockaddr *)&mask,
-		    RTF_UP | RTF_GATEWAY, NULL);
+		    RTF_UP | RTF_GATEWAY, NULL, RT_DEFAULT_FIB);
 		CURVNET_RESTORE();
 		if (error)
 			panic("nfs_mountroot: RTM_ADD: %d", error);
diff -r 85c6a1e7c0b3 -r 7f327dee520d head/sys/nfsclient/nfs_vnops.c
--- a/head/sys/nfsclient/nfs_vnops.c	Fri Mar 02 17:17:27 2012 +0200
+++ b/head/sys/nfsclient/nfs_vnops.c	Fri Mar 02 17:17:35 2012 +0200
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_vnops.c 230552 2012-01-25 20:48:20Z kib $");
+__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_vnops.c 231088 2012-02-06 17:00:28Z jhb $");
 
 /*
  * vnode op calls for Sun NFS version 2 and 3
@@ -938,7 +938,7 @@
 		*vpp = NULLVP;
 		return (error);
 	}
-	error = cache_lookup_times(dvp, vpp, cnp, &nctime, &ncticks);
+	error = cache_lookup(dvp, vpp, cnp, &nctime, &ncticks);
 	if (error > 0 && error != ENOENT)
 		return (error);
 	if (error == -1) {
@@ -1448,7 +1448,7 @@
 		tsiz -= len;
 	}
 nfsmout:
-	if (vp->v_mount->mnt_kern_flag & MNTK_ASYNC)
+	if (DOINGASYNC(vp))
 		committed = NFSV3WRITE_FILESYNC;
 	*iomode = committed;
 	if (error)


More information about the Zrouter-src-freebsd mailing list