diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-06-15 03:51:44 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-06-15 03:51:44 +0000 |
commit | 029226f3a85acf1d4be6aa09215d8e97ded96cb0 (patch) | |
tree | d973d36efe46a45520c40d7d6276ec68a4318a28 /sys/kern | |
parent | 586342bb6a2e371cab9eccaa57393f6aecbe3c3c (diff) | |
download | FreeBSD-src-029226f3a85acf1d4be6aa09215d8e97ded96cb0.zip FreeBSD-src-029226f3a85acf1d4be6aa09215d8e97ded96cb0.tar.gz |
Grab the socket buffer send or receive mutex when performing a
read-modify-write on the sb_state field. This commit catches only
the "easy" ones where it doesn't interact with as yet unmerged
locking.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_sockbuf.c | 8 | ||||
-rw-r--r-- | sys/kern/uipc_socket2.c | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 2d50f32..9b02fec 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -154,8 +154,12 @@ soisdisconnecting(so) so->so_state &= ~SS_ISCONNECTING; so->so_state |= SS_ISDISCONNECTING; + SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_state |= SBS_CANTRCVMORE; + SOCKBUF_UNLOCK(&so->so_rcv); + SOCKBUF_LOCK(&so->so_snd); so->so_snd.sb_state |= SBS_CANTSENDMORE; + SOCKBUF_UNLOCK(&so->so_snd); wakeup(&so->so_timeo); sowwakeup(so); sorwakeup(so); @@ -168,8 +172,12 @@ soisdisconnected(so) so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING); so->so_state |= SS_ISDISCONNECTED; + SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_state |= SBS_CANTRCVMORE; + SOCKBUF_UNLOCK(&so->so_rcv); + SOCKBUF_LOCK(&so->so_snd); so->so_snd.sb_state |= SBS_CANTSENDMORE; + SOCKBUF_UNLOCK(&so->so_snd); wakeup(&so->so_timeo); sbdrop(&so->so_snd, so->so_snd.sb_cc); sowwakeup(so); diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 2d50f32..9b02fec 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -154,8 +154,12 @@ soisdisconnecting(so) so->so_state &= ~SS_ISCONNECTING; so->so_state |= SS_ISDISCONNECTING; + SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_state |= SBS_CANTRCVMORE; + SOCKBUF_UNLOCK(&so->so_rcv); + SOCKBUF_LOCK(&so->so_snd); so->so_snd.sb_state |= SBS_CANTSENDMORE; + SOCKBUF_UNLOCK(&so->so_snd); wakeup(&so->so_timeo); sowwakeup(so); sorwakeup(so); @@ -168,8 +172,12 @@ soisdisconnected(so) so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING); so->so_state |= SS_ISDISCONNECTED; + SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_state |= SBS_CANTRCVMORE; + SOCKBUF_UNLOCK(&so->so_rcv); + SOCKBUF_LOCK(&so->so_snd); so->so_snd.sb_state |= SBS_CANTSENDMORE; + SOCKBUF_UNLOCK(&so->so_snd); wakeup(&so->so_timeo); sbdrop(&so->so_snd, so->so_snd.sb_cc); sowwakeup(so); |