Date: Fri, 4 May 2007 18:00:07 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 119250 for review Message-ID: <200705041800.l44I07UI051520@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119250 Change 119250 by zec@zec_zoo on 2007/05/04 17:59:15 A set of kludges which allow for NFS netbooting. Basically the key is to properly set / restore curvnet whenever necessary... Affected files ... .. //depot/projects/vimage/src/sys/nfsclient/nfs_diskless.c#5 edit .. //depot/projects/vimage/src/sys/nfsclient/nfs_socket.c#4 edit .. //depot/projects/vimage/src/sys/nfsclient/nfs_vfsops.c#5 edit .. //depot/projects/vimage/src/sys/nfsclient/nfs_vnops.c#5 edit Differences ... ==== //depot/projects/vimage/src/sys/nfsclient/nfs_diskless.c#5 (text+ko) ==== @@ -151,7 +151,7 @@ void nfs_setup_diskless(void) { - INIT_VNET_NET(&vnet_0); + INIT_VNET_NET(curvnet); struct nfs_diskless *nd = &nfs_diskless; struct ifnet *ifp; struct ifaddr *ifa; ==== //depot/projects/vimage/src/sys/nfsclient/nfs_socket.c#4 (text+ko) ==== @@ -40,6 +40,7 @@ */ #include "opt_inet6.h" +#include "opt_vimage.h" #include <sys/param.h> #include <sys/systm.h> @@ -58,6 +59,7 @@ #include <sys/sysctl.h> #include <sys/syslog.h> #include <sys/vnode.h> +#include <sys/vimage.h> #include <netinet/in.h> #include <netinet/tcp.h> @@ -1454,6 +1456,7 @@ mtx_unlock(&nmp->nm_mtx); continue; } + CURVNET_SET(so->so_vnet); /* * If there is enough space and the window allows.. * Resend it @@ -1521,6 +1524,7 @@ mtx_unlock(&rep->r_mtx); mtx_unlock(&nmp->nm_mtx); } + CURVNET_RESTORE(); } mtx_unlock(&nfs_reqq_mtx); callout_reset(&nfs_callout, nfs_ticks, nfs_timer, NULL); ==== //depot/projects/vimage/src/sys/nfsclient/nfs_vfsops.c#5 (text+ko) ==== @@ -401,7 +401,7 @@ int nfs_mountroot(struct mount *mp, struct thread *td) { - INIT_VPROCG(&vprocg_0); + INIT_VPROCG(td->td_ucred->cr_vimage->v_procg); struct nfsv3_diskless *nd = &nfsv3_diskless; struct socket *so; struct vnode *vp; @@ -413,14 +413,17 @@ NET_ASSERT_GIANT(); + CURVNET_SET(td->td_ucred->cr_vimage->v_vnet); #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(); @@ -502,6 +505,7 @@ printf("NFS ROOT: %s\n", buf); if ((error = nfs_mountdiskless(buf, MNT_RDONLY, &nd->root_saddr, &nd->root_args, td, &vp, mp)) != 0) { + CURVNET_RESTORE(); return (error); } @@ -516,6 +520,8 @@ if (V_hostname[i] == '\0') break; inittodr(ntohl(nd->root_time)); + + CURVNET_RESTORE(); return (0); } ==== //depot/projects/vimage/src/sys/nfsclient/nfs_vnops.c#5 (text+ko) ==== @@ -1351,7 +1351,6 @@ static int nfs_create(struct vop_create_args *ap) { - INIT_VNET_INET(curvnet); struct vnode *dvp = ap->a_dvp; struct vattr *vap = ap->a_vap; struct componentname *cnp = ap->a_cnp; @@ -1390,6 +1389,7 @@ *tl = txdr_unsigned(NFSV3CREATE_EXCLUSIVE); tl = nfsm_build(u_int32_t *, NFSX_V3CREATEVERF); #ifdef INET + INIT_VNET_INET(VFSTONFS(dvp->v_mount)->nm_so->so_vnet); if (!TAILQ_EMPTY(&V_in_ifaddrhead)) *tl++ = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr; else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705041800.l44I07UI051520>