summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_socket.c
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2011-02-16 21:29:13 +0000
committerbz <bz@FreeBSD.org>2011-02-16 21:29:13 +0000
commitb9b7d3e93a251adacd363eaf9d23963ec7467075 (patch)
treee312f60d853b2306ae67fe2988280d1dbc41c9cf /sys/kern/sys_socket.c
parentea2186a5ebf08dfc9eddc393caec2d574ac8ce0b (diff)
downloadFreeBSD-src-b9b7d3e93a251adacd363eaf9d23963ec7467075.zip
FreeBSD-src-b9b7d3e93a251adacd363eaf9d23963ec7467075.tar.gz
Mfp4 CH=177274,177280,177284-177285,177297,177324-177325
VNET socket push back: try to minimize the number of places where we have to switch vnets and narrow down the time we stay switched. Add assertions to the socket code to catch possibly unset vnets as seen in r204147. While this reduces the number of vnet recursion in some places like NFS, POSIX local sockets and some netgraph, .. recursions are impossible to fix. The current expectations are documented at the beginning of uipc_socket.c along with the other information there. Sponsored by: The FreeBSD Foundation Sponsored by: CK Software GmbH Reviewed by: jhb Tested by: zec Tested by: Mikolaj Golub (to.my.trociny gmail.com) MFC after: 2 weeks
Diffstat (limited to 'sys/kern/sys_socket.c')
-rw-r--r--sys/kern/sys_socket.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 2766ca4..c9b0534 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -80,9 +80,7 @@ soo_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
if (error)
return (error);
#endif
- CURVNET_SET(so->so_vnet);
error = soreceive(so, 0, uio, 0, 0, 0);
- CURVNET_RESTORE();
return (error);
}
@@ -123,7 +121,6 @@ soo_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *active_cred,
struct socket *so = fp->f_data;
int error = 0;
- CURVNET_SET(so->so_vnet);
switch (cmd) {
case FIONBIO:
SOCK_LOCK(so);
@@ -210,14 +207,18 @@ soo_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *active_cred,
*/
if (IOCGROUP(cmd) == 'i')
error = ifioctl(so, cmd, data, td);
- else if (IOCGROUP(cmd) == 'r')
+ else if (IOCGROUP(cmd) == 'r') {
+ CURVNET_SET(so->so_vnet);
error = rtioctl_fib(cmd, data, so->so_fibnum);
- else
+ CURVNET_RESTORE();
+ } else {
+ CURVNET_SET(so->so_vnet);
error = ((*so->so_proto->pr_usrreqs->pru_control)
(so, cmd, data, 0, td));
+ CURVNET_RESTORE();
+ }
break;
}
- CURVNET_RESTORE();
return (error);
}
OpenPOWER on IntegriCloud