From: bluhm Date: Wed, 3 Jan 2024 11:07:04 +0000 (+0000) Subject: Run connect(2) in parallel within inet doamin. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=38afab8ccedc312276b4df1265f7e30bd884e708;p=openbsd Run connect(2) in parallel within inet doamin. This unlocks soconnect() for UDP, rip, rip6 and divert. It takes shared net lock in combination with per socket lock. TCP and GRE still use exclusive net lock when connecting. OK mvs@ --- diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 0a58664adca..c258936d774 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.215 2023/12/18 13:11:20 bluhm Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.216 2024/01/03 11:07:04 bluhm Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -409,7 +409,7 @@ sys_connect(struct proc *p, void *v, register_t *retval) if (KTRPOINT(p, KTR_STRUCT)) ktrsockaddr(p, mtod(nam, caddr_t), SCARG(uap, namelen)); #endif - solock(so); + solock_shared(so); if (isdnssocket(so)) { error = dns_portcheck(p, so, mtod(nam, void *), nam->m_len); if (error) @@ -443,7 +443,7 @@ bad: if (!interrupted) so->so_state &= ~SS_ISCONNECTING; unlock: - sounlock(so); + sounlock_shared(so); m_freem(nam); out: FRELE(fp, p); diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index ed800f016f1..7f976d76eef 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.h,v 1.146 2024/01/01 22:16:51 bluhm Exp $ */ +/* $OpenBSD: in_pcb.h,v 1.147 2024/01/03 11:07:04 bluhm Exp $ */ /* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */ /* @@ -83,6 +83,7 @@ * y inpt_notify pcb table rwlock for notify * p inpcb_mtx pcb mutex * L pf_inp_mtx link pf to inp mutex + * s so_lock socket rwlock */ /* @@ -194,7 +195,7 @@ struct inpcb { void *inp_upcall_arg; u_int inp_rtableid; /* [t] */ int inp_pipex; /* pipex indication */ - uint16_t inp_flowid; + uint16_t inp_flowid; /* [s] */ }; LIST_HEAD(inpcbhead, inpcb);