diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-11-07 19:19:35 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-11-07 19:19:35 +0000 |
commit | 185ec80b05a613b10d5aae2da64db3082aea513d (patch) | |
tree | 03dff8c74509dc42af9bfc00eaf78b2b60b10b2a /sys/netinet | |
parent | 71269597afb1f0a3b1547454c959449b2263d128 (diff) | |
download | FreeBSD-src-185ec80b05a613b10d5aae2da64db3082aea513d.zip FreeBSD-src-185ec80b05a613b10d5aae2da64db3082aea513d.tar.gz |
Do some re-sorting of TCP pcbinfo locking and assertions: make sure to
retain the pcbinfo lock until we're done using a pcb in the in-bound
path, as the pcbinfo lock acts as a pseuo-reference to prevent the pcb
from potentially being recycled. Clean up assertions and make sure to
assert that the pcbinfo is locked at the head of code subsections where
it is needed. Free the mbuf at the end of tcp_input after releasing
any held locks to reduce the time the locks are held.
MFC after: 3 weeks
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_input.c | 11 | ||||
-rw-r--r-- | sys/netinet/tcp_reass.c | 11 |
2 files changed, 10 insertions, 12 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 50e747d..5771c65 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1151,7 +1151,6 @@ after_listen: ((tcp_do_newreno || tp->sack_enable) && !IN_FASTRECOVERY(tp)))) { KASSERT(headlocked, ("headlocked")); - INP_INFO_WUNLOCK(&tcbinfo); /* * this is a pure ack for outstanding data. */ @@ -1239,7 +1238,6 @@ after_listen: LIST_EMPTY(&tp->t_segq) && tlen <= sbspace(&so->so_rcv)) { KASSERT(headlocked, ("headlocked")); - INP_INFO_WUNLOCK(&tcbinfo); /* * this is a pure, in-sequence data packet * with nothing on the reassembly queue and @@ -2371,7 +2369,6 @@ dodata: /* XXX */ break; } } - INP_INFO_WUNLOCK(&tcbinfo); #ifdef TCPDEBUG if (so->so_options & SO_DEBUG) tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen, @@ -2385,6 +2382,7 @@ dodata: /* XXX */ (void) tcp_output(tp); check_delack: + KASSERT(headlocked == 1, ("headlocked should be 1")); INP_LOCK_ASSERT(inp); if (tp->t_flags & TF_DELACK) { tp->t_flags &= ~TF_DELACK; @@ -2392,6 +2390,7 @@ check_delack: tcp_timer_delack, tp); } INP_UNLOCK(inp); + INP_INFO_WUNLOCK(&tcbinfo); return; dropafterack: @@ -2422,11 +2421,11 @@ dropafterack: &tcp_savetcp, 0); #endif KASSERT(headlocked, ("headlocked should be 1")); - INP_INFO_WUNLOCK(&tcbinfo); - m_freem(m); tp->t_flags |= TF_ACKNOW; (void) tcp_output(tp); INP_UNLOCK(inp); + INP_INFO_WUNLOCK(&tcbinfo); + m_freem(m); return; dropwithreset: @@ -2491,9 +2490,9 @@ drop: #endif if (tp) INP_UNLOCK(inp); - m_freem(m); if (headlocked) INP_INFO_WUNLOCK(&tcbinfo); + m_freem(m); return; } diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 50e747d..5771c65 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -1151,7 +1151,6 @@ after_listen: ((tcp_do_newreno || tp->sack_enable) && !IN_FASTRECOVERY(tp)))) { KASSERT(headlocked, ("headlocked")); - INP_INFO_WUNLOCK(&tcbinfo); /* * this is a pure ack for outstanding data. */ @@ -1239,7 +1238,6 @@ after_listen: LIST_EMPTY(&tp->t_segq) && tlen <= sbspace(&so->so_rcv)) { KASSERT(headlocked, ("headlocked")); - INP_INFO_WUNLOCK(&tcbinfo); /* * this is a pure, in-sequence data packet * with nothing on the reassembly queue and @@ -2371,7 +2369,6 @@ dodata: /* XXX */ break; } } - INP_INFO_WUNLOCK(&tcbinfo); #ifdef TCPDEBUG if (so->so_options & SO_DEBUG) tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen, @@ -2385,6 +2382,7 @@ dodata: /* XXX */ (void) tcp_output(tp); check_delack: + KASSERT(headlocked == 1, ("headlocked should be 1")); INP_LOCK_ASSERT(inp); if (tp->t_flags & TF_DELACK) { tp->t_flags &= ~TF_DELACK; @@ -2392,6 +2390,7 @@ check_delack: tcp_timer_delack, tp); } INP_UNLOCK(inp); + INP_INFO_WUNLOCK(&tcbinfo); return; dropafterack: @@ -2422,11 +2421,11 @@ dropafterack: &tcp_savetcp, 0); #endif KASSERT(headlocked, ("headlocked should be 1")); - INP_INFO_WUNLOCK(&tcbinfo); - m_freem(m); tp->t_flags |= TF_ACKNOW; (void) tcp_output(tp); INP_UNLOCK(inp); + INP_INFO_WUNLOCK(&tcbinfo); + m_freem(m); return; dropwithreset: @@ -2491,9 +2490,9 @@ drop: #endif if (tp) INP_UNLOCK(inp); - m_freem(m); if (headlocked) INP_INFO_WUNLOCK(&tcbinfo); + m_freem(m); return; } |