From 9237eab76900b1a75717b754144177e816980984 Mon Sep 17 00:00:00 2001 From: rwatson Date: Sat, 12 Mar 2005 13:39:39 +0000 Subject: Extend the coverage of the accept and socket mutexes in soisconnected() so that the socket lock is held over the test-and-set removal of the accept filter option during connect, and the two socket mutex regions (transition to connected, perform accept filter) are combined. --- sys/kern/uipc_socket2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/kern/uipc_socket2.c') diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 17a09ca..0db83df 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -117,14 +117,14 @@ soisconnected(so) { struct socket *head; + ACCEPT_LOCK(); SOCK_LOCK(so); so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING); so->so_state |= SS_ISCONNECTED; - SOCK_UNLOCK(so); - ACCEPT_LOCK(); head = so->so_head; if (head != NULL && (so->so_qstate & SQ_INCOMP)) { if ((so->so_options & SO_ACCEPTFILTER) == 0) { + SOCK_UNLOCK(so); TAILQ_REMOVE(&head->so_incomp, so, so_list); head->so_incqlen--; so->so_qstate &= ~SQ_INCOMP; @@ -136,7 +136,6 @@ soisconnected(so) wakeup_one(&head->so_timeo); } else { ACCEPT_UNLOCK(); - SOCK_LOCK(so); so->so_upcall = head->so_accf->so_accept_filter->accf_callback; so->so_upcallarg = head->so_accf->so_accept_filter_arg; @@ -147,6 +146,7 @@ soisconnected(so) } return; } + SOCK_UNLOCK(so); ACCEPT_UNLOCK(); wakeup(&so->so_timeo); sorwakeup(so); -- cgit v1.1