svn commit: r202968 - stable/8/sys/nfsclient

Marko Zec zec at FreeBSD.org
Mon Jan 25 14:17:14 UTC 2010


Author: zec
Date: Mon Jan 25 14:17:13 2010
New Revision: 202968
URL: http://svn.freebsd.org/changeset/base/202968

Log:
  MFC r201895:
    Reduce recursions on curvnet and thus spamming the console with warning
    messages for kernels built with options VIMAGE and VNET_DEBUG enabled.
  
    Reviewed by:  bz

Modified:
  stable/8/sys/nfsclient/nfs_vfsops.c
  stable/8/sys/nfsclient/nfs_vnops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_vfsops.c	Mon Jan 25 12:23:51 2010	(r202967)
+++ stable/8/sys/nfsclient/nfs_vfsops.c	Mon Jan 25 14:17:13 2010	(r202968)
@@ -423,14 +423,18 @@ nfs_mountroot(struct mount *mp)
 	char buf[128];
 	char *cp;
 
+	CURVNET_SET(TD_TO_VNET(td));
+
 #if defined(BOOTP_NFSROOT) && defined(BOOTP)
 	bootpc_init();		/* use bootp to get nfs_diskless filled in */
 #elif defined(NFS_ROOT)
 	nfs_setup_diskless();
 #endif
 
-	if (nfs_diskless_valid == 0)
+	if (nfs_diskless_valid == 0) {
+		CURVNET_RESTORE();
 		return (-1);
+	}
 	if (nfs_diskless_valid == 1)
 		nfs_convert_diskless();
 
@@ -516,6 +520,7 @@ nfs_mountroot(struct mount *mp)
 	nd->root_args.hostname = buf;
 	if ((error = nfs_mountdiskless(buf,
 	    &nd->root_saddr, &nd->root_args, td, &vp, mp)) != 0) {
+		CURVNET_RESTORE();
 		return (error);
 	}
 
@@ -529,6 +534,7 @@ nfs_mountroot(struct mount *mp)
 	    sizeof (prison0.pr_hostname));
 	mtx_unlock(&prison0.pr_mtx);
 	inittodr(ntohl(nd->root_time));
+	CURVNET_RESTORE();
 	return (0);
 }
 
@@ -827,8 +833,6 @@ nfs_mount(struct mount *mp)
 	has_fh_opt = 0;
 	has_hostname_opt = 0;
 
-	CURVNET_SET(CRED_TO_VNET(curthread->td_ucred));
-
 	if (vfs_filteropt(mp->mnt_optnew, nfs_opts)) {
 		error = EINVAL;
 		goto out;
@@ -1128,7 +1132,6 @@ out:
 		mp->mnt_kern_flag |= (MNTK_MPSAFE|MNTK_LOOKUP_SHARED);
 		MNT_IUNLOCK(mp);
 	}
-	CURVNET_RESTORE();
 	return (error);
 }
 

Modified: stable/8/sys/nfsclient/nfs_vnops.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_vnops.c	Mon Jan 25 12:23:51 2010	(r202967)
+++ stable/8/sys/nfsclient/nfs_vnops.c	Mon Jan 25 14:17:13 2010	(r202968)
@@ -1555,19 +1555,15 @@ nfs_create(struct vop_create_args *ap)
 	struct vattr vattr;
 	int v3 = NFS_ISV3(dvp);
 
-	CURVNET_SET(CRED_TO_VNET(curthread->td_ucred));
-
 	/*
 	 * Oops, not for me..
 	 */
 	if (vap->va_type == VSOCK) {
 		error = nfs_mknodrpc(dvp, ap->a_vpp, cnp, vap);
-		CURVNET_RESTORE();
 		return (error);
 	}
 
 	if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0) {
-		CURVNET_RESTORE();
 		return (error);
 	}
 	if (vap->va_vaflags & VA_EXCLUSIVE)
@@ -1665,7 +1661,6 @@ nfsmout:
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp);
 	}
 	mtx_unlock(&(VTONFS(dvp))->n_mtx);
-	CURVNET_RESTORE();
 	return (error);
 }
 


More information about the svn-src-stable-8 mailing list