DragonFly BSD
DragonFly bugs List (threaded) for 2004-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

temporary fix to netgraph breakage


From: YONETANI Tomokazu <qhwt+dragonfly-bugs@xxxxxxxxxx>
Date: Tue, 20 Apr 2004 02:32:27 +0900

Hi.
Here's a temporary fix to the recent netgraph breakage, by
bringing netmsg_put_port() back from ip_demux.c. At least
it seems to work for me, but I'm not sure this is right.
(well, at least I could've made it global and share it with
ip_demux.c, but I'm sleepy now...)
My guess is that some parts of netgraph code dealing with protocols
other than tcp and udp still need this putport handler.

Index: net/netisr.c
===================================================================
RCS file: /home/source/dragonfly/cvs/src/sys/net/netisr.c,v
retrieving revision 1.12
diff -u -r1.12 netisr.c
--- net/netisr.c	17 Apr 2004 00:46:28 -0000	1.12
+++ net/netisr.c	19 Apr 2004 17:03:27 -0000
@@ -56,12 +56,41 @@
 
 SYSINIT(netisr, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, netisr_init, NULL);
 
+/*
+ * We must construct a custom putport function (which runs in the context
+ * of the message originator)
+ * Our custom putport must check for self-referential messages, which can
+ * occur when the so_upcall routine is called (e.g. nfs).  Self referential
+ * messages are simply executed synchronously.
+ */
+static int
+netmsg_put_port(lwkt_port_t port, lwkt_msg_t lmsg)
+{
+    /*
+     * If it's a synchronous message for the same thread,
+     * execute it directly.
+     */
+    if (!(lmsg->ms_flags & MSGF_ASYNC) && port->mp_td == curthread) {
+	struct netmsg *msg = (struct netmsg *)lmsg;
+
+	msg->nm_handler(msg);
+    } else {
+        lwkt_default_putport(port, lmsg);
+    }
+
+    return (EASYNC);
+}
+
 void
 netmsg_service_loop(void *arg)
 {
+    thread_t td;
     struct netmsg *msg;
 
-    while ((msg = lwkt_waitport(&curthread->td_msgport, NULL)))
+    td = curthread;
+    td->td_msgport.mp_putport = netmsg_put_port;
+
+    while ((msg = lwkt_waitport(&td->td_msgport, NULL)))
 	msg->nm_handler(msg);
 }
 



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]