tech-net archive

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

Patch: move reassembly lock/unlock in tcp_input



Using accept filters (still pending for commit to NetBSD) it's possible
to get into a situation in which tcp_input can generate a call to
tcp_output, on the same socket.

Surprisingly, this almost works.  The patch below avoids an attempt to
recursively take the TCP reassembly lock in this case, by moving its
acquisition/release in tcp_input to where it (appears to be) actually
needed (so that it is not held across a call to sorwakeup().

Comments?

diff -Naur
/home/coyote/perforce/equalizer/features/folsom/sys/netinet/tcp_input.c
netinet/tcp_input.c
--- /home/coyote/perforce/equalizer/features/folsom/sys/netinet/tcp_input.c
2008-07-11 18:14:31.000000000 +0530
+++ netinet/tcp_input.c 2008-07-25 13:02:51.000000000 +0530
@@ -2636,13 +2636,14 @@
                                m_adj(m, hdroptlen);
                                sbappendstream(&(so)->so_rcv, m);
                        }
+                       TCP_REASS_UNLOCK(tp);
                        sorwakeup(so);
                } else {
                        m_adj(m, hdroptlen);
                        tiflags = tcp_reass(tp, th, m, &tlen);
                        tp->t_flags |= TF_ACKNOW;
+                       TCP_REASS_UNLOCK(tp);
                }
-               TCP_REASS_UNLOCK(tp);

                /*
                 * Note the amount of data that peer has sent into


Home | Main Index | Thread Index | Old Index