summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_syscalls.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/uipc_syscalls.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/uipc_syscalls.c')
-rw-r--r--sys/kern/uipc_syscalls.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 958c807..d3326d4 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -260,14 +260,9 @@ listen(td, uap)
so = fp->f_data;
#ifdef MAC
error = mac_socket_check_listen(td->td_ucred, so);
- if (error == 0) {
+ if (error == 0)
#endif
- CURVNET_SET(so->so_vnet);
error = solisten(so, uap->backlog, td);
- CURVNET_RESTORE();
-#ifdef MAC
- }
-#endif
fdrop(fp, td);
}
return(error);
@@ -428,9 +423,7 @@ kern_accept(struct thread *td, int s, struct sockaddr **name,
tmp = fflag & FASYNC;
(void) fo_ioctl(nfp, FIOASYNC, &tmp, td->td_ucred, td);
sa = 0;
- CURVNET_SET(so->so_vnet);
error = soaccept(so, &sa);
- CURVNET_RESTORE();
if (error) {
/*
* return a namelen of zero for older code which might
@@ -981,11 +974,9 @@ kern_recvit(td, s, mp, fromseg, controlp)
ktruio = cloneuio(&auio);
#endif
len = auio.uio_resid;
- CURVNET_SET(so->so_vnet);
error = soreceive(so, &fromsa, &auio, (struct mbuf **)0,
(mp->msg_control || controlp) ? &control : (struct mbuf **)0,
&mp->msg_flags);
- CURVNET_RESTORE();
if (error) {
if (auio.uio_resid != (int)len && (error == ERESTART ||
error == EINTR || error == EWOULDBLOCK))
@@ -1331,9 +1322,7 @@ kern_setsockopt(td, s, level, name, val, valseg, valsize)
error = getsock(td->td_proc->p_fd, s, &fp, NULL);
if (error == 0) {
so = fp->f_data;
- CURVNET_SET(so->so_vnet);
error = sosetopt(so, &sopt);
- CURVNET_RESTORE();
fdrop(fp, td);
}
return(error);
@@ -1412,9 +1401,7 @@ kern_getsockopt(td, s, level, name, val, valseg, valsize)
error = getsock(td->td_proc->p_fd, s, &fp, NULL);
if (error == 0) {
so = fp->f_data;
- CURVNET_SET(so->so_vnet);
error = sogetopt(so, &sopt);
- CURVNET_RESTORE();
*valsize = sopt.sopt_valsize;
fdrop(fp, td);
}
OpenPOWER on IntegriCloud