summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2004-11-29 23:10:59 +0000
committerps <ps@FreeBSD.org>2004-11-29 23:10:59 +0000
commit8932ce4fb41694ceb46a12ae914556cbd9d98e3b (patch)
treea750ee4a7b93adc3137a3625ca25019d99d53ce0 /sys/kern
parent9ed5c9cd2b025cf0c8f4e4c29b4145cd3b891364 (diff)
downloadFreeBSD-src-8932ce4fb41694ceb46a12ae914556cbd9d98e3b.zip
FreeBSD-src-8932ce4fb41694ceb46a12ae914556cbd9d98e3b.tar.gz
If soreceive() is called from a socket callback, there's no reason
to do a window update to the peer (thru an ACK) from soreceive() itself. TCP will do that upon return from the socket callback. Sending a window update from soreceive() results in a lock reversal. Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com Reviewed by: rwatson
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index f5299fd..b741f41 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1388,7 +1388,13 @@ dontblock:
}
SBLASTRECORDCHK(&so->so_rcv);
SBLASTMBUFCHK(&so->so_rcv);
- if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) {
+ /*
+ * If soreceive() is being done from the socket callback, then
+ * don't need to generate ACK to peer to update window, since
+ * ACK will be generated on return to TCP.
+ */
+ if (!(flags & MSG_SOCALLBCK) &&
+ (pr->pr_flags & PR_WANTRCVD) && so->so_pcb) {
SOCKBUF_UNLOCK(&so->so_rcv);
(*pr->pr_usrreqs->pru_rcvd)(so, flags);
SOCKBUF_LOCK(&so->so_rcv);
OpenPOWER on IntegriCloud