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
This commit is contained in:
Marko Zec 2010-01-09 14:56:38 +00:00
parent 1a933e8f10
commit 5d005b51e5
2 changed files with 7 additions and 9 deletions

View File

@ -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 @@ nfs_mount(struct mount *mp)
mp->mnt_kern_flag |= (MNTK_MPSAFE|MNTK_LOOKUP_SHARED);
MNT_IUNLOCK(mp);
}
CURVNET_RESTORE();
return (error);
}

View File

@ -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 @@ nfs_create(struct vop_create_args *ap)
KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp);
}
mtx_unlock(&(VTONFS(dvp))->n_mtx);
CURVNET_RESTORE();
return (error);
}