Split the "inp" mutex class into separate classes for each of divert,

raw, tcp, udp, raw6, and udp6 sockets to avoid spurious witness
complaints.

Reviewed by:	rwatson
Approved by:	re (rwatson)
This commit is contained in:
Sam Leffler 2003-11-26 01:40:44 +00:00
parent 943ae30252
commit 5bd311a566
8 changed files with 13 additions and 11 deletions

View File

@ -157,10 +157,11 @@ SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, reservedlow,
* Allocate a PCB and associate it with the socket.
*/
int
in_pcballoc(so, pcbinfo, td)
in_pcballoc(so, pcbinfo, td, type)
struct socket *so;
struct inpcbinfo *pcbinfo;
struct thread *td;
const char *type;
{
register struct inpcb *inp;
int error;
@ -198,7 +199,7 @@ in_pcballoc(so, pcbinfo, td)
LIST_INSERT_HEAD(pcbinfo->listhead, inp, inp_list);
pcbinfo->ipi_count++;
so->so_pcb = (caddr_t)inp;
INP_LOCK_INIT(inp, "inp");
INP_LOCK_INIT(inp, "inp", type);
#ifdef INET6
if (ip6_auto_flowlabel)
inp->inp_flags |= IN6P_AUTOFLOWLABEL;

View File

@ -242,8 +242,8 @@ struct inpcbinfo { /* XXX documentation, prefixes */
* this code is shared by both IPv4 and IPv6 and IPv6 is
* not properly locked.
*/
#define INP_LOCK_INIT(inp, d) \
mtx_init(&(inp)->inp_mtx, (d), NULL, MTX_DEF | MTX_RECURSE | MTX_DUPOK)
#define INP_LOCK_INIT(inp, d, t) \
mtx_init(&(inp)->inp_mtx, (d), (t), MTX_DEF | MTX_RECURSE | MTX_DUPOK)
#define INP_LOCK_DESTROY(inp) mtx_destroy(&(inp)->inp_mtx)
#define INP_LOCK(inp) mtx_lock(&(inp)->inp_mtx)
#define INP_UNLOCK(inp) mtx_unlock(&(inp)->inp_mtx)
@ -337,7 +337,8 @@ extern int ipport_hifirstauto;
extern int ipport_hilastauto;
void in_pcbpurgeif0(struct inpcbinfo *, struct ifnet *);
int in_pcballoc(struct socket *, struct inpcbinfo *, struct thread *);
int in_pcballoc(struct socket *, struct inpcbinfo *, struct thread *,
const char *);
int in_pcbbind(struct inpcb *, struct sockaddr *, struct thread *);
int in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
u_short *, struct thread *);

View File

@ -393,7 +393,7 @@ div_attach(struct socket *so, int proto, struct thread *td)
INP_INFO_WUNLOCK(&divcbinfo);
return error;
}
error = in_pcballoc(so, &divcbinfo, td);
error = in_pcballoc(so, &divcbinfo, td, "divinp");
if (error) {
INP_INFO_WUNLOCK(&divcbinfo);
return error;

View File

@ -541,7 +541,7 @@ rip_attach(struct socket *so, int proto, struct thread *td)
INP_INFO_WUNLOCK(&ripcbinfo);
return error;
}
error = in_pcballoc(so, &ripcbinfo, td);
error = in_pcballoc(so, &ripcbinfo, td, "rawinp");
if (error) {
INP_INFO_WUNLOCK(&ripcbinfo);
return error;

View File

@ -1175,7 +1175,7 @@ tcp_attach(so, td)
if (error)
return (error);
}
error = in_pcballoc(so, &tcbinfo, td);
error = in_pcballoc(so, &tcbinfo, td, "tcpinp");
if (error)
return (error);
inp = sotoinpcb(so);

View File

@ -943,7 +943,7 @@ udp_attach(struct socket *so, int proto, struct thread *td)
return error;
}
s = splnet();
error = in_pcballoc(so, &udbinfo, td);
error = in_pcballoc(so, &udbinfo, td, "udpinp");
splx(s);
if (error) {
INP_INFO_WUNLOCK(&udbinfo);

View File

@ -580,7 +580,7 @@ rip6_attach(struct socket *so, int proto, struct thread *td)
if (error)
return error;
s = splnet();
error = in_pcballoc(so, &ripcbinfo, td);
error = in_pcballoc(so, &ripcbinfo, td, "raw6inp");
splx(s);
if (error)
return error;

View File

@ -560,7 +560,7 @@ udp6_attach(struct socket *so, int proto, struct thread *td)
return error;
}
s = splnet();
error = in_pcballoc(so, &udbinfo, td);
error = in_pcballoc(so, &udbinfo, td, "udp6inp");
splx(s);
if (error)
return error;