Author: zec
Date: Sat Jan  9 14:56:38 2010
New Revision: 201895
URL: http://svn.freebsd.org/changeset/base/201895

Log:
  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
  MFC after:    3 days

Modified:
  head/sys/nfsclient/nfs_vfsops.c
  head/sys/nfsclient/nfs_vnops.c

Modified: head/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- head/sys/nfsclient/nfs_vfsops.c     Sat Jan  9 12:34:15 2010        
(r201894)
+++ head/sys/nfsclient/nfs_vfsops.c     Sat Jan  9 14:56:38 2010        
(r201895)
@@ -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: head/sys/nfsclient/nfs_vnops.c
==============================================================================
--- head/sys/nfsclient/nfs_vnops.c      Sat Jan  9 12:34:15 2010        
(r201894)
+++ head/sys/nfsclient/nfs_vnops.c      Sat Jan  9 14:56:38 2010        
(r201895)
@@ -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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to