summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/bluetooth
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/netgraph/bluetooth
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/netgraph/bluetooth')
-rw-r--r--sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c8
-rw-r--r--sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c8
-rw-r--r--sys/netgraph/bluetooth/socket/ng_btsocket_sco.c8
3 files changed, 21 insertions, 3 deletions
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
index 0ac24e5..efca5389 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
@@ -50,6 +50,9 @@
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
+
+#include <net/vnet.h>
+
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/bluetooth/include/ng_bluetooth.h>
@@ -592,8 +595,11 @@ ng_btsocket_l2cap_process_l2ca_con_ind(struct ng_mesg *msg,
* space then create new socket and set proper source address.
*/
- if (pcb->so->so_qlen <= pcb->so->so_qlimit)
+ if (pcb->so->so_qlen <= pcb->so->so_qlimit) {
+ CURVNET_SET(pcb->so->so_vnet);
so1 = sonewconn(pcb->so, 0);
+ CURVNET_RESTORE();
+ }
if (so1 == NULL) {
result = NG_L2CAP_NO_RESOURCES;
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
index 1fd9eb3..f07da3a 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
@@ -52,6 +52,9 @@
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <sys/uio.h>
+
+#include <net/vnet.h>
+
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/bluetooth/include/ng_bluetooth.h>
@@ -1163,8 +1166,11 @@ ng_btsocket_rfcomm_connect_ind(ng_btsocket_rfcomm_session_p s, int channel)
mtx_lock(&pcb->pcb_mtx);
- if (pcb->so->so_qlen <= pcb->so->so_qlimit)
+ if (pcb->so->so_qlen <= pcb->so->so_qlimit) {
+ CURVNET_SET(pcb->so->so_vnet);
so1 = sonewconn(pcb->so, 0);
+ CURVNET_RESTORE();
+ }
mtx_unlock(&pcb->pcb_mtx);
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c b/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
index e1bff57..85b68dc 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
@@ -50,6 +50,9 @@
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
+
+#include <net/vnet.h>
+
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/bluetooth/include/ng_bluetooth.h>
@@ -477,8 +480,11 @@ ng_btsocket_sco_process_lp_con_ind(struct ng_mesg *msg,
* space then create new socket and set proper source address.
*/
- if (pcb->so->so_qlen <= pcb->so->so_qlimit)
+ if (pcb->so->so_qlen <= pcb->so->so_qlimit) {
+ CURVNET_SET(pcb->so->so_vnet);
so1 = sonewconn(pcb->so, 0);
+ CURVNET_RESTORE();
+ }
if (so1 == NULL) {
status = 0x0d; /* Rejected due to limited resources */
OpenPOWER on IntegriCloud