Defer inpcbport free until after a grace period has elapsed
This is a dependency for inpcbinfo rlock conversion to epoch
This commit is contained in:
parent
b872626dbe
commit
f09ee4fc01
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335017
@ -1569,6 +1569,15 @@ in_pcblist_rele_rlocked(epoch_context_t ctx)
|
|||||||
free(il, M_TEMP);
|
free(il, M_TEMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
inpcbport_free(epoch_context_t ctx)
|
||||||
|
{
|
||||||
|
struct inpcbport *phd;
|
||||||
|
|
||||||
|
phd = __containerof(ctx, struct inpcbport, phd_epoch_ctx);
|
||||||
|
free(phd, M_PCB);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
in_pcbfree_deferred(epoch_context_t ctx)
|
in_pcbfree_deferred(epoch_context_t ctx)
|
||||||
{
|
{
|
||||||
@ -1598,7 +1607,6 @@ in_pcbfree_deferred(epoch_context_t ctx)
|
|||||||
#endif
|
#endif
|
||||||
if (inp->inp_options)
|
if (inp->inp_options)
|
||||||
(void)m_free(inp->inp_options);
|
(void)m_free(inp->inp_options);
|
||||||
|
|
||||||
inp->inp_vflag = 0;
|
inp->inp_vflag = 0;
|
||||||
crfree(inp->inp_cred);
|
crfree(inp->inp_cred);
|
||||||
#ifdef MAC
|
#ifdef MAC
|
||||||
@ -1682,7 +1690,7 @@ in_pcbdrop(struct inpcb *inp)
|
|||||||
CK_LIST_REMOVE(inp, inp_portlist);
|
CK_LIST_REMOVE(inp, inp_portlist);
|
||||||
if (CK_LIST_FIRST(&phd->phd_pcblist) == NULL) {
|
if (CK_LIST_FIRST(&phd->phd_pcblist) == NULL) {
|
||||||
CK_LIST_REMOVE(phd, phd_hash);
|
CK_LIST_REMOVE(phd, phd_hash);
|
||||||
free(phd, M_PCB);
|
epoch_call(net_epoch_preempt, &phd->phd_epoch_ctx, inpcbport_free);
|
||||||
}
|
}
|
||||||
INP_HASH_WUNLOCK(inp->inp_pcbinfo);
|
INP_HASH_WUNLOCK(inp->inp_pcbinfo);
|
||||||
inp->inp_flags &= ~INP_INHASHLIST;
|
inp->inp_flags &= ~INP_INHASHLIST;
|
||||||
@ -2552,6 +2560,7 @@ in_pcbinshash_internal(struct inpcb *inp, int do_pcbgroup_update)
|
|||||||
if (phd == NULL) {
|
if (phd == NULL) {
|
||||||
return (ENOBUFS); /* XXX */
|
return (ENOBUFS); /* XXX */
|
||||||
}
|
}
|
||||||
|
bzero(&phd->phd_epoch_ctx, sizeof(struct epoch_context));
|
||||||
phd->phd_port = inp->inp_lport;
|
phd->phd_port = inp->inp_lport;
|
||||||
CK_LIST_INIT(&phd->phd_pcblist);
|
CK_LIST_INIT(&phd->phd_pcblist);
|
||||||
CK_LIST_INSERT_HEAD(pcbporthash, phd, phd_hash);
|
CK_LIST_INSERT_HEAD(pcbporthash, phd, phd_hash);
|
||||||
|
@ -402,6 +402,7 @@ void in_pcbtoxinpcb(const struct inpcb *, struct xinpcb *);
|
|||||||
#endif /* _SYS_SOCKETVAR_H_ */
|
#endif /* _SYS_SOCKETVAR_H_ */
|
||||||
|
|
||||||
struct inpcbport {
|
struct inpcbport {
|
||||||
|
struct epoch_context phd_epoch_ctx;
|
||||||
CK_LIST_ENTRY(inpcbport) phd_hash;
|
CK_LIST_ENTRY(inpcbport) phd_hash;
|
||||||
struct inpcbhead phd_pcblist;
|
struct inpcbhead phd_pcblist;
|
||||||
u_short phd_port;
|
u_short phd_port;
|
||||||
|
Loading…
Reference in New Issue
Block a user