summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_usrreq.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_usrreq.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_usrreq.c')
-rw-r--r--sys/kern/uipc_usrreq.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index d049688..4bad386 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1311,7 +1311,9 @@ unp_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
}
if (so->so_proto->pr_flags & PR_CONNREQUIRED) {
if (so2->so_options & SO_ACCEPTCONN) {
+ CURVNET_SET(so2->so_vnet);
so3 = sonewconn(so2, 0);
+ CURVNET_RESTORE();
} else
so3 = NULL;
if (so3 == NULL) {
@@ -2215,8 +2217,14 @@ unp_gc(__unused void *arg, int pending)
* struct files associated with these sockets but leave each socket
* with one remaining ref.
*/
- for (i = 0; i < total; i++)
- sorflush(unref[i]->f_data);
+ for (i = 0; i < total; i++) {
+ struct socket *so;
+
+ so = unref[i]->f_data;
+ CURVNET_SET(so->so_vnet);
+ sorflush(so);
+ CURVNET_RESTORE();
+ }
/*
* And finally release the sockets so they can be reclaimed.
OpenPOWER on IntegriCloud