freebsd-skq/sys/netinet
Peter Wemm 9c9906e912 Plug a mbuf leak in tcp_usr_send(). pru_send() routines are expected
to either enqueue or free their mbuf chains, but tcp_usr_send() was
dropping them on the floor if the tcpcb/inpcb has been torn down in the
middle of a send/write attempt.  This has been responsible for a wide
variety of mbuf leak patterns, ranging from slow gradual leakage to rather
rapid exhaustion.  This has been a problem since before 2.2 was branched
and appears to have been fixed in rev 1.16 and lost in 1.23/1.28.

Thanks to Jayanth Vijayaraghavan <jayanth@yahoo-inc.com> for checking
(extensively) into this on a live production 2.2.x system and that it
was the actual cause of the leak and looks like it fixes it.  The machine
in question was loosing (from memory) about 150 mbufs per hour under
load and a change similar to this stopped it.  (Don't blame Jayanth
for this patch though)

An alternative approach to this would be to recheck SS_CANTSENDMORE etc
inside the splnet() right before calling pru_send() after all the potential
sleeps, interrupts and delays have happened.  However, this would mean
exposing knowledge of the tcp stack's reset handling and removal of the
pcb to the generic code.  There are other things that call pru_send()
directly though.

Problem originally noted by:  John Plevyak <jplevyak@inktomi.com>
1999-06-04 02:27:06 +00:00
..
libalias brucify 1999-05-23 13:52:05 +00:00
fil.c Staticize some more. 1998-11-26 18:54:52 +00:00
icmp_var.h * Change sysctl from using linker_set to construct its tree using SLISTs. 1999-02-16 10:49:55 +00:00
if_atm.c update ATM driver. (base version: midway.c 1.67 --> 1.68) 1998-07-29 05:35:16 +00:00
if_atm.h Forward declare some structs so that this file is more self-sufficient. 1998-02-03 21:52:02 +00:00
if_ether.c Add sufficient braces to keep egcs happy about potentially ambiguous 1999-05-06 18:13:11 +00:00
if_ether.h Make INET a proper option. 1998-01-08 23:42:31 +00:00
if_fddi.h Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
igmp_var.h Move kernel-only declaration inside #ifdef KERNEL section. 1999-03-06 04:51:41 +00:00
igmp.c Rename igmp's MALLOC; it doesn't have anything to do with multicast routing. 1999-01-18 01:56:31 +00:00
igmp.h Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
in_cksum.c Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
in_hostcache.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
in_hostcache.h Add for public examination the beginnings of the per-host cache support 1997-06-18 01:24:28 +00:00
in_pcb.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
in_pcb.h This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
in_proto.c * Change sysctl from using linker_set to construct its tree using SLISTs. 1999-02-16 10:49:55 +00:00
in_rmx.c Add sysctl descriptions to many SYSCTL_XXXs 1999-05-03 23:57:32 +00:00
in_systm.h Declare n_short, n_long and n_time as fixed-sized types. Don't ifdef 1998-07-13 10:54:24 +00:00
in_var.h * Change sysctl from using linker_set to construct its tree using SLISTs. 1999-02-16 10:49:55 +00:00
in.c Suser() simplification: 1999-04-27 11:18:52 +00:00
in.h Pre-declare struct proc to avoid 'inside param list' warnings. 1999-05-08 14:28:52 +00:00
ip_auth.c Staticize some more. 1998-11-26 18:54:52 +00:00
ip_auth.h Made some disgusting ifdefs even more disgusting to enable the support 1998-08-15 21:51:53 +00:00
ip_compat.h Import ipfilter 3.2.7 kernel components 1998-06-20 18:18:05 +00:00
ip_divert.c Suser() simplification: 1999-04-27 11:18:52 +00:00
ip_dummynet.c Fix two warnings; and note a problem where a pointer is stored in an 1999-05-06 22:08:57 +00:00
ip_dummynet.h assorted dummynet cleanup: 1999-05-04 07:30:08 +00:00
ip_fil.c Examine all occurrences of sprintf(), strcat(), and str[n]cpy() 1998-12-04 22:54:57 +00:00
ip_fil.h Merge ipfilter 3.2.3 -> 3.2.7 changes onto mainline. 1998-06-20 18:37:51 +00:00
ip_flow.c Add sysctl descriptions to many SYSCTL_XXXs 1999-05-03 23:57:32 +00:00
ip_flow.h Move (private) struct ipflow out of ip_var.h, to reduce dependencies 1998-05-19 15:53:50 +00:00
ip_frag.c Staticize some more. 1998-11-26 18:54:52 +00:00
ip_frag.h Import ipfilter 3.2.7 kernel components 1998-06-20 18:18:05 +00:00
ip_ftp_pxy.c Examine all occurrences of sprintf(), strcat(), and str[n]cpy() 1998-12-04 22:54:57 +00:00
ip_fw.c close pr 10889: 1999-05-24 10:01:22 +00:00
ip_fw.h Tidy up some stray / unused stuff in the IPFW package and friends. 1999-04-20 13:32:06 +00:00
ip_icmp.c When an incoming packet is reflected back as an ICMP reply, make sure we 1999-03-06 23:10:42 +00:00
ip_icmp.h Declare id_mask as a fixed-size type. 1998-07-13 11:01:03 +00:00
ip_input.c Made net.inet.ip.intr_queue_maxlen writeable. 1999-05-27 12:20:33 +00:00
ip_log.c The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static 1998-12-07 21:58:50 +00:00
ip_mroute.c Add sufficient braces to keep egcs happy about potentially ambiguous 1999-05-06 18:13:11 +00:00
ip_mroute.h Use dynamic memory allocation instead of mbuf's for multicast routing 1999-01-18 02:06:59 +00:00
ip_nat.c Staticize some more. 1998-11-26 18:54:52 +00:00
ip_nat.h Made some disgusting ifdefs even more disgusting to enable the support 1998-08-15 21:51:53 +00:00
ip_output.c Free the dummynet descriptor in ip_dummynet, not in the called 1999-05-04 16:20:33 +00:00
ip_proxy.c Fix warnings in preparation for adding -Wall -Wcast-qual to the 1999-01-27 22:42:27 +00:00
ip_proxy.h Import kernel parts of ipfilter v3.2.3 1998-03-21 10:11:54 +00:00
ip_state.c Fix warnings in preparation for adding -Wall -Wcast-qual to the 1999-01-27 22:42:27 +00:00
ip_state.h Import ipfilter 3.2.7 kernel components 1998-06-20 18:18:05 +00:00
ip_var.h Re-implement tcp and ip fragment reassembly to not store pointers in the 1998-08-24 07:47:39 +00:00
ip.h Fixed pedantic semantics errors (bitfields not of type int, signed int 1998-06-07 12:00:13 +00:00
ipl.h Import ipfilter 3.2.7 kernel components 1998-06-20 18:18:05 +00:00
mlf_ipl.c Simplify cdevsw registration. 1999-05-31 11:29:30 +00:00
raw_ip.c Add sysctl descriptions to many SYSCTL_XXXs 1999-05-03 23:57:32 +00:00
tcp_debug.c Fixed printf format errors. 1998-08-17 01:05:25 +00:00
tcp_debug.h Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
tcp_fsm.h Two cosmetic changes, one a typo and the other, a clarification. 1999-04-07 22:22:06 +00:00
tcp_input.c Add sufficient braces to keep egcs happy about potentially ambiguous 1999-05-06 18:13:11 +00:00
tcp_output.c Added net.inet.tcp.path_mtu_discovery variable which when set to 0 1999-05-27 12:24:21 +00:00
tcp_reass.c Add sufficient braces to keep egcs happy about potentially ambiguous 1999-05-06 18:13:11 +00:00
tcp_seq.h Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
tcp_subr.c Add sysctl descriptions to many SYSCTL_XXXs 1999-05-03 23:57:32 +00:00
tcp_timer.c Add sysctl descriptions to many SYSCTL_XXXs 1999-05-03 23:57:32 +00:00
tcp_timer.h Some staticized variables were still declared to be extern. 1997-09-07 05:27:26 +00:00
tcp_timewait.c Add sysctl descriptions to many SYSCTL_XXXs 1999-05-03 23:57:32 +00:00
tcp_usrreq.c Plug a mbuf leak in tcp_usr_send(). pru_send() routines are expected 1999-06-04 02:27:06 +00:00
tcp_var.h * Change sysctl from using linker_set to construct its tree using SLISTs. 1999-02-16 10:49:55 +00:00
tcp.h Declare tcp_seq and tcp_cc as fixed-size types. Half fixed type 1998-07-13 11:09:52 +00:00
tcpip.h Dike out some obsolete defines which referenced ih_next and ih_prev from 1998-09-26 14:26:59 +00:00
udp_usrreq.c Add sysctl descriptions to many SYSCTL_XXXs 1999-05-03 23:57:32 +00:00
udp_var.h * Change sysctl from using linker_set to construct its tree using SLISTs. 1999-02-16 10:49:55 +00:00
udp.h Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00