diff options
| author | 2016-12-19 08:36:49 +0000 | |
|---|---|---|
| committer | 2016-12-19 08:36:49 +0000 | |
| commit | 2b4720fc1ab1c786a246ad8a4a02064649d7c635 (patch) | |
| tree | af02cdfe86f481705c092e14a90d4f5c242979a6 /sys/kern/sys_socket.c | |
| parent | fix uninitialised variable warnings from clang (diff) | |
| download | wireguard-openbsd-2b4720fc1ab1c786a246ad8a4a02064649d7c635.tar.xz wireguard-openbsd-2b4720fc1ab1c786a246ad8a4a02064649d7c635.zip | |
Introduce the NET_LOCK() a rwlock used to serialize accesses to the parts
of the network stack that are not yet ready to be executed in parallel or
where new sleeping points are not possible.
This first pass replace all the entry points leading to ip_output(). This
is done to not introduce new sleeping points when trying to acquire ART's
write lock, needed when a new L2 entry is created via the RT_RESOLVE.
Inputs from and ok bluhm@, ok dlg@
Diffstat (limited to 'sys/kern/sys_socket.c')
| -rw-r--r-- | sys/kern/sys_socket.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index a7a4113a4b2..7c8d8f728d1 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_socket.c,v 1.25 2016/11/22 12:11:38 mpi Exp $ */ +/* $OpenBSD: sys_socket.c,v 1.26 2016/12/19 08:36:49 mpi Exp $ */ /* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */ /* @@ -120,17 +120,17 @@ soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) * different entry since a socket's unnecessary */ if (IOCGROUP(cmd) == 'i') { - s = splsoftnet(); + NET_LOCK(s); error = ifioctl(so, cmd, data, p); - splx(s); + NET_UNLOCK(s); return (error); } if (IOCGROUP(cmd) == 'r') return (EOPNOTSUPP); - s = splsoftnet(); + NET_LOCK(s); error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL, (struct mbuf *)cmd, (struct mbuf *)data, (struct mbuf *)NULL, p)); - splx(s); + NET_UNLOCK(s); return (error); } @@ -142,7 +142,7 @@ soo_poll(struct file *fp, int events, struct proc *p) int revents = 0; int s; - s = splsoftnet(); + NET_LOCK(s); if (events & (POLLIN | POLLRDNORM)) { if (soreadable(so)) revents |= events & (POLLIN | POLLRDNORM); @@ -168,7 +168,7 @@ soo_poll(struct file *fp, int events, struct proc *p) so->so_snd.sb_flagsintr |= SB_SEL; } } - splx(s); + NET_UNLOCK(s); return (revents); } @@ -187,10 +187,10 @@ soo_stat(struct file *fp, struct stat *ub, struct proc *p) ub->st_mode |= S_IWUSR | S_IWGRP | S_IWOTH; ub->st_uid = so->so_euid; ub->st_gid = so->so_egid; - s = splsoftnet(); + NET_LOCK(s); (void) ((*so->so_proto->pr_usrreq)(so, PRU_SENSE, (struct mbuf *)ub, NULL, NULL, p)); - splx(s); + NET_UNLOCK(s); return (0); } |
