Add INP_INFO_WUNLOCK_ASSERT() macro and use it instead of
INP_INFO_UNLOCK_ASSERT() in TCP-related code. For encapsulated traffic it is possible, that the code is running in net_epoch_preempt section, and INP_INFO_UNLOCK_ASSERT() is very strict assertion for such case. PR: 231428 Reviewed by: mmacy, tuexen Approved by: re (kib) Differential Revision: https://reviews.freebsd.org/D17335
This commit is contained in:
parent
ef08929f90
commit
384a5c3c28
@ -642,6 +642,8 @@ int inp_so_options(const struct inpcb *inp);
|
||||
#define INP_INFO_LOCK_ASSERT(ipi) MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(ipi)->ipi_lock))
|
||||
#define INP_INFO_RLOCK_ASSERT(ipi) MPASS(in_epoch(net_epoch_preempt))
|
||||
#define INP_INFO_WLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_lock, MA_OWNED)
|
||||
#define INP_INFO_WUNLOCK_ASSERT(ipi) \
|
||||
mtx_assert(&(ipi)->ipi_lock, MA_NOTOWNED)
|
||||
#define INP_INFO_UNLOCK_ASSERT(ipi) MPASS(!in_epoch(net_epoch_preempt) && !mtx_owned(&(ipi)->ipi_lock))
|
||||
|
||||
#define INP_LIST_LOCK_INIT(ipi, d) \
|
||||
|
@ -710,7 +710,7 @@ siftr_findinpcb(int ipver, struct ip *ip, struct mbuf *m, uint16_t sport,
|
||||
struct inpcb *inp;
|
||||
|
||||
/* We need the tcbinfo lock. */
|
||||
INP_INFO_UNLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo);
|
||||
|
||||
if (dir == PFIL_IN)
|
||||
inp = (ipver == INP_IPV4 ?
|
||||
|
@ -1282,7 +1282,7 @@ tcp_input_data(struct tcp_hpts_entry *hpts, struct timeval *tv)
|
||||
* lock again but we also need some kasserts
|
||||
* here.
|
||||
*/
|
||||
INP_INFO_UNLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_UNLOCK_ASSERT(inp);
|
||||
m = n;
|
||||
if (m)
|
||||
@ -1324,7 +1324,7 @@ tcp_input_data(struct tcp_hpts_entry *hpts, struct timeval *tv)
|
||||
INP_WUNLOCK(inp);
|
||||
if (ti_locked == TI_RLOCKED)
|
||||
INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
|
||||
INP_INFO_UNLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_UNLOCK_ASSERT(inp);
|
||||
ti_locked = TI_UNLOCKED;
|
||||
mtx_lock(&hpts->p_mtx);
|
||||
|
@ -800,7 +800,7 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
|
||||
if (ti_locked == TI_RLOCKED) {
|
||||
INP_INFO_RLOCK_ASSERT(&V_tcbinfo);
|
||||
} else {
|
||||
INP_INFO_UNLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo);
|
||||
}
|
||||
#endif
|
||||
#ifdef INET6
|
||||
@ -1358,7 +1358,7 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
|
||||
INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
|
||||
ti_locked = TI_UNLOCKED;
|
||||
}
|
||||
INP_INFO_UNLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo);
|
||||
return (IPPROTO_DONE);
|
||||
} else if (tp->t_state == TCPS_LISTEN) {
|
||||
/*
|
||||
@ -1405,7 +1405,7 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
|
||||
else {
|
||||
KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropwithreset "
|
||||
"ti_locked: %d", __func__, ti_locked));
|
||||
INP_INFO_UNLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1429,7 +1429,7 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
|
||||
else {
|
||||
KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropunlock "
|
||||
"ti_locked: %d", __func__, ti_locked));
|
||||
INP_INFO_UNLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1437,7 +1437,7 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
|
||||
INP_WUNLOCK(inp);
|
||||
|
||||
drop:
|
||||
INP_INFO_UNLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo);
|
||||
if (s != NULL)
|
||||
free(s, M_TCPLOG);
|
||||
if (m != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user