Date: Sat, 27 Jun 2009 14:19:55 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 165308 for review Message-ID: <200906271419.n5REJtva038542@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=165308 Change 165308 by zec@zec_amdx4 on 2009/06/27 14:19:06 Reshuffle CURVNET_SET() / CURVNET_RESTORE() placement in order to mitigate recursion on curvnet and the associated console noise. Affected files ... .. //depot/projects/vimage-commit2/src/sys/nfsserver/nfs_srvkrpc.c#12 edit .. //depot/projects/vimage-commit2/src/sys/rpc/svc_dg.c#5 edit .. //depot/projects/vimage-commit2/src/sys/rpc/svc_generic.c#4 edit .. //depot/projects/vimage-commit2/src/sys/rpc/svc_vc.c#9 edit Differences ... ==== //depot/projects/vimage-commit2/src/sys/nfsserver/nfs_srvkrpc.c#12 (text+ko) ==== @@ -45,7 +45,6 @@ #include <sys/sysctl.h> #include <sys/file.h> #include <sys/filedesc.h> -#include <sys/jail.h> #include <sys/vnode.h> #include <sys/malloc.h> #include <sys/mount.h> @@ -62,7 +61,6 @@ #include <sys/fcntl.h> #include <sys/lockf.h> #include <sys/eventhandler.h> -#include <sys/vimage.h> #include <netinet/in.h> #include <netinet/tcp.h> @@ -459,12 +457,10 @@ * Steal the socket from userland so that it doesn't close * unexpectedly. */ - CURVNET_SET(TD_TO_VNET(td)); if (so->so_type == SOCK_DGRAM) xprt = svc_dg_create(nfsrv_pool, so, 0, 0); else xprt = svc_vc_create(nfsrv_pool, so, 0, 0); - CURVNET_RESTORE(); if (xprt) { fp->f_ops = &badfileops; fp->f_data = NULL; ==== //depot/projects/vimage-commit2/src/sys/rpc/svc_dg.c#5 (text+ko) ==== @@ -128,6 +128,7 @@ xprt->xp_ops = &svc_dg_ops; error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa); + CURVNET_RESTORE(); if (error) goto freedata; @@ -146,7 +147,6 @@ if (xprt) { svc_xprt_free(xprt); } - CURVNET_RESTORE(); return (NULL); } ==== //depot/projects/vimage-commit2/src/sys/rpc/svc_generic.c#4 (text+ko) ==== @@ -48,6 +48,7 @@ #include "opt_inet6.h" #include <sys/param.h> +#include <sys/jail.h> #include <sys/lock.h> #include <sys/kernel.h> #include <sys/malloc.h> @@ -59,6 +60,7 @@ #include <sys/systm.h> #include <sys/sx.h> #include <sys/ucred.h> +#include <sys/vimage.h> #include <rpc/rpc.h> #include <rpc/rpcb_clnt.h> @@ -228,11 +230,14 @@ /* * It is an open socket. Get the transport info. */ + CURVNET_SET(so->so_vnet); if (!__rpc_socket2sockinfo(so, &si)) { printf( "svc_tli_create: could not get transport information\n"); + CURVNET_RESTORE(); return (NULL); } + CURVNET_RESTORE(); } /* @@ -259,7 +264,9 @@ "svc_tli_create: could not bind to requested address\n"); goto freedata; } + CURVNET_SET(so->so_vnet); solisten(so, (int)bindaddr->qlen, curthread); + CURVNET_RESTORE(); } } ==== //depot/projects/vimage-commit2/src/sys/rpc/svc_vc.c#9 (text+ko) ==== @@ -153,9 +153,12 @@ xprt->xp_p2 = NULL; xprt->xp_ops = &svc_vc_rendezvous_ops; + CURVNET_SET(so->so_vnet); error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa); - if (error) + if (error) { + CURVNET_RESTORE(); goto cleanup_svc_vc_create; + } memcpy(&xprt->xp_ltaddr, sa, sa->sa_len); free(sa, M_SONAME); @@ -163,6 +166,7 @@ xprt_register(xprt); solisten(so, SOMAXCONN, curthread); + CURVNET_RESTORE(); SOCKBUF_LOCK(&so->so_rcv); xprt->xp_upcallset = 1; @@ -195,9 +199,12 @@ opt.sopt_name = SO_KEEPALIVE; opt.sopt_val = &one; opt.sopt_valsize = sizeof(one); + CURVNET_SET(so->so_vnet); error = sosetopt(so, &opt); - if (error) + if (error) { + CURVNET_RESTORE(); return (NULL); + } if (so->so_proto->pr_protocol == IPPROTO_TCP) { bzero(&opt, sizeof(struct sockopt)); @@ -207,9 +214,12 @@ opt.sopt_val = &one; opt.sopt_valsize = sizeof(one); error = sosetopt(so, &opt); - if (error) + if (error) { + CURVNET_RESTORE(); return (NULL); + } } + CURVNET_RESTORE(); cd = mem_alloc(sizeof(*cd)); cd->strm_stat = XPRT_IDLE;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906271419.n5REJtva038542>