From 434a0d24dd0456bb0d6c7a1e2cae9041394b7382 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Mon, 7 May 2007 13:04:25 +0000 Subject: [PATCH] When setting up timewait state for a TCP connection, don't hold the socket lock over a crhold() of so_cred: so_cred is constant after socket creation, so doesn't require locking to read. --- sys/netinet/tcp_subr.c | 2 +- sys/netinet/tcp_timewait.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 4a5e16cc986c..049222de226c 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1811,8 +1811,8 @@ tcp_twstart(struct tcpcb *tp) tcp_discardcb(tp); so = inp->inp_socket; soisdisconnected(so); - SOCK_LOCK(so); tw->tw_cred = crhold(so->so_cred); + SOCK_LOCK(so); tw->tw_so_options = so->so_options; SOCK_UNLOCK(so); if (acknow) diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 4a5e16cc986c..049222de226c 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -1811,8 +1811,8 @@ tcp_twstart(struct tcpcb *tp) tcp_discardcb(tp); so = inp->inp_socket; soisdisconnected(so); - SOCK_LOCK(so); tw->tw_cred = crhold(so->so_cred); + SOCK_LOCK(so); tw->tw_so_options = so->so_options; SOCK_UNLOCK(so); if (acknow)