Add INP_INFO_UNLOCK_ASSERT() and use it in tcp_input(). Also add some

further INP_INFO_WLOCK_ASSERT() while there.
This commit is contained in:
andre 2007-04-04 18:30:16 +00:00
parent 32bf13d188
commit 82cdcabbd1
3 changed files with 9 additions and 0 deletions

View File

@ -260,6 +260,9 @@ struct inpcbinfo { /* XXX documentation, prefixes */
mtx_assert(&(ipi)->ipi_mtx, MA_OWNED); \
NET_ASSERT_GIANT(); \
} while (0)
#define INP_INFO_UNLOCK_ASSERT(ipi) do { \
mtx_assert(&(ipi)->ipi_mtx, MA_NOTOWNED); \
} while (0)
#define INP_PCBHASH(faddr, lport, fport, mask) \
(((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask))

View File

@ -997,13 +997,16 @@ tcp_input(struct mbuf *m, int off0)
return;
dropwithreset:
INP_INFO_WLOCK_ASSERT(&tcbinfo);
tcp_dropwithreset(m, th, tp, tlen, rstreason);
m = NULL; /* mbuf chain got consumed. */
dropunlock:
INP_INFO_WLOCK_ASSERT(&tcbinfo);
if (tp != NULL)
INP_UNLOCK(inp);
INP_INFO_WUNLOCK(&tcbinfo);
drop:
INP_INFO_UNLOCK_ASSERT(&tcbinfo);
if (m != NULL)
m_freem(m);
return;

View File

@ -997,13 +997,16 @@ tcp_input(struct mbuf *m, int off0)
return;
dropwithreset:
INP_INFO_WLOCK_ASSERT(&tcbinfo);
tcp_dropwithreset(m, th, tp, tlen, rstreason);
m = NULL; /* mbuf chain got consumed. */
dropunlock:
INP_INFO_WLOCK_ASSERT(&tcbinfo);
if (tp != NULL)
INP_UNLOCK(inp);
INP_INFO_WUNLOCK(&tcbinfo);
drop:
INP_INFO_UNLOCK_ASSERT(&tcbinfo);
if (m != NULL)
m_freem(m);
return;