From e755d38c4ac92cb80c3d9e858a17de46c9cc2905 Mon Sep 17 00:00:00 2001 From: zec Date: Mon, 25 Jan 2010 14:17:13 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.freebsd.org/base/stable/8@202968 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/nfsclient/nfs_vfsops.c | 11 +++++++---- sys/nfsclient/nfs_vnops.c | 5 ----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 0e100935f..2346d4193 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -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); } diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index b3c28a3cd..7d6bb307e 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -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); } -- 2.45.0