freebsd-nq/sys/kern
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
..
bus_if.m * Change device_add_child_after() to device_add_child_ordered() which is 1999-05-28 09:25:16 +00:00
device_if.m * Define a new static method DEVICE_IDENTIFY which is called to add device 1999-05-14 11:22:47 +00:00
imgact_aout.c Add the options MAP_PREFAULT and MAP_PREFAULT_PARTIAL to vm_map_find/insert, 1999-05-17 00:53:56 +00:00
imgact_elf.c Add the options MAP_PREFAULT and MAP_PREFAULT_PARTIAL to vm_map_find/insert, 1999-05-17 00:53:56 +00:00
imgact_gzip.c Fix a couple of warnings and some bitrot in comments. 1999-05-09 16:04:14 +00:00
imgact_shell.c Fix a couple of warnings and some bitrot in comments. 1999-05-09 16:04:14 +00:00
inflate.c kzipboot uses kern/inflate.c outside the kernel by providing its own 1998-11-10 09:08:49 +00:00
init_main.c Use colons instead of semi-colons to behave like UNIX instead of DOS. 1999-05-11 10:08:10 +00:00
init_sysent.c Regenerated. 1999-05-13 09:12:57 +00:00
kern_acct.c Suser() simplification: 1999-04-27 11:18:52 +00:00
kern_clock.c Make the machdep.i8254_freq and machdep.tsc_freq sysctls modify the 1999-04-25 09:00:00 +00:00
kern_conf.c || vs && confusion in cdevsw_add(). 1999-06-01 20:41:26 +00:00
kern_descrip.c Simplify cdevsw registration. 1999-05-31 11:29:30 +00:00
kern_environment.c Fix warnings related to -Wall -Wcast-qual 1999-01-28 17:32:05 +00:00
kern_exec.c Suser() simplification: 1999-04-27 11:18:52 +00:00
kern_exit.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
kern_fork.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
kern_intr.c Stage 1 of a cleanup of the i386 interrupt registration mechanism. 1999-04-21 07:26:30 +00:00
kern_jail.c Add beer-ware license and $Id$ 1999-04-30 06:51:51 +00:00
kern_ktrace.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
kern_linker.c First stages of a module dependency cleanup. This part fixes a 1999-05-08 13:01:59 +00:00
kern_lock.c fix breakage for alphas. 1999-03-15 05:11:27 +00:00
kern_lockf.c Fix a freelist trashing under following confitions: 1999-05-08 22:46:46 +00:00
kern_malloc.c Fixed corruption of the kmemstatistcs list. The first malloc() 1999-05-12 11:11:27 +00:00
kern_mib.c Add sysctl descriptions to many SYSCTL_XXXs 1999-05-03 23:57:32 +00:00
kern_module.c Oops, set module->file.. 1999-05-20 00:00:58 +00:00
kern_ntptime.c Suser() simplification: 1999-04-27 11:18:52 +00:00
kern_physio.c I got tired of seeing all the cdevsw[major(foo)] all over the place. 1999-05-08 06:40:31 +00:00
kern_proc.c Use NOUDEV for udev_t's 1999-05-17 13:50:24 +00:00
kern_prot.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
kern_random.c Add sufficient braces to keep egcs happy about potentially ambiguous 1999-05-06 18:13:11 +00:00
kern_resource.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
kern_shutdown.c Try an fix a couple of dev_t/major/minor etc nits. 1999-05-12 22:30:50 +00:00
kern_sig.c Add sysctl descriptions to many SYSCTL_XXXs 1999-05-03 23:57:32 +00:00
kern_subr.c This solves a deadlock that can occur when read()ing into a file-mmap() 1999-03-12 03:09:29 +00:00
kern_synch.c The magic "no-cpu" cpu number is 0xff. Don't misrepresent cpu 1999-03-05 16:38:13 +00:00
kern_syscalls.c Move lkmnosys() from kern_lkm.c to here. 1999-01-17 18:58:04 +00:00
kern_sysctl.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
kern_tc.c Make the machdep.i8254_freq and machdep.tsc_freq sysctls modify the 1999-04-25 09:00:00 +00:00
kern_threads.c Removed bogus casts to c_caddr_t. This is part of terminating 1999-01-29 08:29:05 +00:00
kern_time.c Suser() simplification: 1999-04-27 11:18:52 +00:00
kern_timeout.c Fix callout_init(). This didn't have any practical effect since it 1999-03-06 22:27:02 +00:00
kern_xxx.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
ksched.c 1. Add new defs for mins and maxs for the POSIX flavor priorities. They 1998-05-19 21:11:53 +00:00
link_aout.c Add enough include files to make this actually compile on an a.out system. 1999-05-15 23:18:32 +00:00
link_elf_obj.c Use KERNBASE for the load address of the kernel rather than magic constants 1999-05-08 13:03:49 +00:00
link_elf.c Use KERNBASE for the load address of the kernel rather than magic constants 1999-05-08 13:03:49 +00:00
Make.tags.inc Update to know about current kernel directory layout. 1999-02-28 22:14:16 +00:00
makedevops.pl Remove hack to accept French spelling of METHOD (METHODE) 1999-05-10 17:45:49 +00:00
Makefile Added ../sys/syscall.mk to targets. Back it up like all the other 1999-05-13 09:19:14 +00:00
makesyscalls.sh Add trailing newline to sys/syscall.mk so that diff doesn't choke on it. 1998-06-28 10:01:52 +00:00
md5c.c This commit fixes various 64bit portability problems required for 1998-06-07 17:13:14 +00:00
p1003_1b.c Well folks, this is it - The second stage of the removal for build support 1999-04-17 08:36:07 +00:00
posix4_mib.c * Change sysctl from using linker_set to construct its tree using SLISTs. 1999-02-16 10:49:55 +00:00
subr_autoconf.c Fix a very long standing bug in run_interrupt_driven_config_hooks(). It 1999-04-25 22:13:34 +00:00
subr_blist.c Add new blist module - radix tree based bitmap allocator with 1999-01-21 08:11:06 +00:00
subr_bus.c * Add a function devclass_create() which looks up the named devclass and 1999-05-30 10:27:11 +00:00
subr_clist.c Cast pointers to uintptr_t/intptr_t instead of to u_long/long, 1998-07-15 02:32:35 +00:00
subr_devstat.c Add sysctl descriptions to many SYSCTL_XXXs 1999-05-03 23:57:32 +00:00
subr_disklabel.c Fix -Wuninitialized warning regarding zero-length var-args ctl element. 1998-12-14 05:37:37 +00:00
subr_diskmbr.c Divorce "dev_t" from the "major|minor" bitmap, which is now called 1999-05-11 19:55:07 +00:00
subr_diskslice.c Divorce "dev_t" from the "major|minor" bitmap, which is now called 1999-05-11 19:55:07 +00:00
subr_dkbad.c Divorce "dev_t" from the "major|minor" bitmap, which is now called 1999-05-11 19:55:07 +00:00
subr_log.c Simplify cdevsw registration. 1999-05-31 11:29:30 +00:00
subr_module.c Align to sizeof(long) rather than sizeof(int32_t). It needs to be 1998-10-14 05:07:23 +00:00
subr_param.c Allow setting MAXFILES in the kernel config. 1999-04-09 16:28:11 +00:00
subr_prf.c Unifdef VM86. 1999-06-01 18:20:36 +00:00
subr_prof.c Fixed profiling of elf kernels. Made high resolution profiling compile 1999-05-06 09:44:57 +00:00
subr_rman.c Bring the 'new-bus' to the i386. This extensively changes the way the 1999-04-16 21:22:55 +00:00
subr_scanf.c Only needed to cast array index from char to unsigned char, did not 1999-02-14 20:58:21 +00:00
subr_smp.c Unifdef VM86. 1999-06-01 18:20:36 +00:00
subr_trap.c Unifdef VM86. 1999-06-01 18:20:36 +00:00
subr_xxx.c Try an fix a couple of dev_t/major/minor etc nits. 1999-05-12 22:30:50 +00:00
sys_generic.c Add standard padding argument to pread and pwrite syscall. That should make them 1999-04-04 21:41:28 +00:00
sys_pipe.c Add standard padding argument to pread and pwrite syscall. That should make them 1999-04-04 21:41:28 +00:00
sys_process.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
sys_socket.c Add standard padding argument to pread and pwrite syscall. That should make them 1999-04-04 21:41:28 +00:00
syscalls.c Regenerated. 1999-05-13 09:12:57 +00:00
syscalls.master Fixed nonsense arg type `const caddr_t' in the prototype() for utrace(). 1999-05-13 09:09:37 +00:00
sysv_ipc.c Change suser_xxx() to suser() where it applies. 1999-04-27 12:21:16 +00:00
sysv_msg.c Change suser_xxx() to suser() where it applies. 1999-04-27 12:21:16 +00:00
sysv_sem.c Change suser_xxx() to suser() where it applies. 1999-04-27 12:21:16 +00:00
sysv_shm.c Change suser_xxx() to suser() where it applies. 1999-04-27 12:21:16 +00:00
tty_compat.c This commit fixes various 64bit portability problems required for 1998-06-07 17:13:14 +00:00
tty_conf.c This commit fixes various 64bit portability problems required for 1998-06-07 17:13:14 +00:00
tty_cons.c Simplify cdevsw registration. 1999-05-31 11:29:30 +00:00
tty_pty.c Simplify cdevsw registration. 1999-05-31 11:29:30 +00:00
tty_snoop.c Simplify cdevsw registration. 1999-05-31 11:29:30 +00:00
tty_subr.c Cast pointers to uintptr_t/intptr_t instead of to u_long/long, 1998-07-15 02:32:35 +00:00
tty_tb.c Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
tty_tty.c Simplify cdevsw registration. 1999-05-31 11:29:30 +00:00
tty.c Don't call calcru() on a swapped-out process. calcru() access p_stats, which 1999-05-22 20:10:31 +00:00
uipc_domain.c Redo domain registration to use SYSINITS rather than linker sets. 1999-04-26 08:56:09 +00:00
uipc_mbuf.c Typo in comment. 1999-04-12 10:07:15 +00:00
uipc_proto.c Register the local (unix domain) sockets ourselves. 1999-04-26 08:56:53 +00:00
uipc_sockbuf.c Update one set of comments.. s/so_q0/so_incomp/ and s/so_q/so_comp/ (that's 1999-05-10 18:15:40 +00:00
uipc_socket2.c Update one set of comments.. s/so_q0/so_incomp/ and s/so_q/so_comp/ (that's 1999-05-10 18:15:40 +00:00
uipc_socket.c Plug a mbuf leak in tcp_usr_send(). pru_send() routines are expected 1999-06-04 02:27:06 +00:00
uipc_syscalls.c Fix warnings in preparation for adding -Wall -Wcast-qual to the 1999-01-27 21:50:00 +00:00
uipc_usrreq.c Divorce "dev_t" from the "major|minor" bitmap, which is now called 1999-05-11 19:55:07 +00:00
vfs_aio.c Introduce the makebdev() function, it does the same as the makedev() 1999-06-01 18:56:26 +00:00
vfs_bio.c Try an fix a couple of dev_t/major/minor etc nits. 1999-05-12 22:30:50 +00:00
vfs_cache.c Fix a braino in the v_id wraparound code. Give more (current) details 1999-04-24 17:58:14 +00:00
vfs_cluster.c The VFS/BIO subsystem contained a number of hacks in order to optimize 1999-05-02 23:57:16 +00:00
vfs_conf.c Back out my previous change (phk didn't like it) in favour of setting 1999-05-24 00:37:26 +00:00
vfs_default.c The VFS/BIO subsystem contained a number of hacks in order to optimize 1999-05-02 23:57:16 +00:00
vfs_export.c Simplify cdevsw registration. 1999-05-31 11:29:30 +00:00
vfs_extattr.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
vfs_init.c * Register sysctl nodes before running sysinits when loading files and 1999-03-07 16:06:41 +00:00
vfs_lookup.c Fix warnings in preparation for adding -Wall -Wcast-qual to the 1999-01-28 00:57:57 +00:00
vfs_mount.c Back out my previous change (phk didn't like it) in favour of setting 1999-05-24 00:37:26 +00:00
vfs_subr.c Simplify cdevsw registration. 1999-05-31 11:29:30 +00:00
vfs_syscalls.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
vfs_vnops.c This Implements the mumbled about "Jail" feature. 1999-04-28 11:38:52 +00:00
vnode_if.pl Declare static __inline functions as __inline in their forward 1999-02-28 11:30:00 +00:00
vnode_if.sh Declare static __inline functions as __inline in their forward 1999-02-28 11:30:00 +00:00
vnode_if.src Remove incorrect lock specs for vop_whiteout (introduced by Lite/2). 1999-03-27 03:08:07 +00:00