opnsense-src/sys/sys
Julian Elischer 4ef2094e45 Reviewed by: Many at differnt times in differnt parts,
including alan, john, me, luoqi, and kirk
Submitted by:	Matt Dillon <dillon@frebsd.org>

This change implements a relatively sophisticated fix to getnewbuf().
There were two problems with getnewbuf(). First, the writerecursion
can lead to a system stack overflow when you have NFS and/or VN
devices in the system. Second, the free/dirty buffer accounting was
completely broken. Not only did the nfs routines blow it trying to
manually account for the buffer state, but the accounting that was
done did not work well with the purpose of their existance: figuring
out when getnewbuf() needs to sleep.

The meat of the change is to kern/vfs_bio.c. The remaining diffs are
all minor except for NFS, which includes both the fixes for bp
interaction AND fixes for a 'biodone(): buffer already done' lockup.
Sys/buf.h also contains a chaining structure which is not used by
this patchset but is used by other patches that are coming soon.
This patch deliniated by tags PRE_MAT_GETBUF and POST_MAT_GETBUF.
(sorry for the missing T matt)
1999-03-12 02:24:58 +00:00
..
_posix.h *gulp*. Jordan specifically OK'ed this.. 1998-10-16 03:55:01 +00:00
_sigset.h Define ss_size in struct sigaltstack as size_t instead of int. 1998-08-05 09:04:36 +00:00
acct.h Forward declare more structs that are used in prototypes here - don't 1998-02-01 20:08:39 +00:00
aio.h Bring a bit closer to the normal form. (In particular, add 1999-01-17 22:33:08 +00:00
bio.h Reviewed by: Many at differnt times in differnt parts, 1999-03-12 02:24:58 +00:00
bitstring.h
blist.h Add new blist module - radix tree based bitmap allocator with 1999-01-21 08:11:06 +00:00
buf.h Reviewed by: Many at differnt times in differnt parts, 1999-03-12 02:24:58 +00:00
bus.h Include <sys/queue.h> so that this file is almost self-sufficient, as is 1999-03-06 16:52:04 +00:00
bus_dma.h Don't pretend to support ix86's with 16-bit ints by using longs just 1998-09-29 09:06:00 +00:00
bus_private.h My changes to the new device interface: 1998-11-14 21:58:51 +00:00
callout.h Expose a slightly-lower-level interface to timeouts which allows callers 1999-03-06 04:46:20 +00:00
ccdvar.h system.h: 1998-09-15 10:07:26 +00:00
cdefs.h Per request from ache, change the numbering scheme of __FreeBSD_cc_version. 1998-10-29 22:11:08 +00:00
cdio.h Add new atapi-cd driver that supports atapi CD-R/RW drives. 1998-09-08 20:57:47 +00:00
chio.h Fixed pedantic syntax error (trailing comma in enum). 1999-03-06 16:57:12 +00:00
clist.h Some staticized variables were still declared to be extern. 1997-09-07 05:27:26 +00:00
conf.h Reviewed by: Julian Elischer <julian@whistle.com> 1999-02-25 05:22:30 +00:00
cons.h Fixed pedantic syntax errors caused by a trailing semicolon in a macro 1999-01-09 14:07:37 +00:00
copyright.h Fixed COPYRIGHT_PC98 (good bye 1998). 1999-02-10 13:09:09 +00:00
dataacq.h Put back this wholly innocent victim of Mike's drive-by shooting on alog; 1999-01-20 13:09:28 +00:00
devfsext.h Rename one of the two devfs_link's to devfs_makelink. 1998-12-10 19:57:01 +00:00
device.h Remove '???' because it generates an annoying message about 1998-07-04 19:00:47 +00:00
devicestat.h Add a prioritization field to the devstat_add_entry() call so that 1999-02-10 00:04:13 +00:00
dir.h
dirent.h Make <sys/dirent.h> and <dirent.h> self-sufficient, using new __intN_t types. 1998-12-19 00:30:01 +00:00
disk.h buf.h: 1997-09-21 22:09:24 +00:00
disklabel.h catch a /boot doc instance I missed. 1999-01-03 07:38:58 +00:00
diskmbr.h catch a /boot doc instance I missed. 1999-01-03 07:38:58 +00:00
diskpc98.h catch a /boot doc instance I missed. 1999-01-03 07:38:58 +00:00
diskslice.h remove bdevsw arg from dsopen(); 1998-08-23 20:16:35 +00:00
dkbad.h Forward declare more structs that are used in prototypes here - don't 1998-02-01 20:08:39 +00:00
dkstat.h New Kernel device statistics code. 1998-09-15 08:16:17 +00:00
dmap.h
domain.h Minor rearranging of code to allow simple protocol domains to be 1999-01-21 00:26:41 +00:00
elf32.h Add generic defines ELF_ARCH, ELF_CLASS, and ELF_DATA. These give 1998-09-14 20:30:13 +00:00
elf64.h Add generic defines ELF_ARCH, ELF_CLASS, and ELF_DATA. These give 1998-09-14 20:30:13 +00:00
elf_common.h Add generic defines ELF_ARCH, ELF_CLASS, and ELF_DATA. These give 1998-09-14 20:30:13 +00:00
elf_generic.h Add generic defines ELF_ARCH, ELF_CLASS, and ELF_DATA. These give 1998-09-14 20:30:13 +00:00
errno.h Added 3 new errno values, requred by various standards: EOVERFLOW, 1998-12-14 18:54:04 +00:00
exec.h More -Wall / -Wcast-qual cleanup. Also, EXEC_SET can't use 1999-01-29 08:36:45 +00:00
fbio.h
fcntl.h Implement a new open(2) flag: O_NOFOLLOW. This will instruct open 1998-04-06 17:38:43 +00:00
fdcio.h
file.h This commit fixes various 64bit portability problems required for 1998-06-07 17:13:14 +00:00
filedesc.h I got another batch of suggestions for cosmetic changes from bde. 1998-11-11 10:56:07 +00:00
filio.h
ftape.h
gmon.h Changed to the C9x draft spelling of the (unsigned) integral type 1998-07-14 05:09:48 +00:00
imgact.h Various changes to support OSF1 emulation: 1998-12-30 10:38:59 +00:00
imgact_aout.h Add provisions for variant core dump file formats, depending on the 1998-09-14 05:36:51 +00:00
imgact_elf.h Hmm- I must be blind. There *was* already an appropriate typedef still 1999-02-06 17:58:06 +00:00
inflate.h Fixed gratuitous ANSIisms. 1997-09-16 11:44:05 +00:00
interrupt.h Implemented dynamic registration of software interrupt handlers. Not 1998-08-11 15:08:13 +00:00
inttypes.h Little reorganization: 1998-12-19 00:02:34 +00:00
ioccom.h This commit fixes various 64bit portability problems required for 1998-06-07 17:13:14 +00:00
ioctl.h
ioctl_bt848.h Corrected ioctl numbers conflict. 1999-02-15 11:04:36 +00:00
ioctl_compat.h
ioctl_meteor.h
ipc.h Removed _POSIX_SOURCE ifdef. This is not a POSIX.1 header. 1998-02-25 02:17:46 +00:00
joystick.h
kernel.h More const fixes for -Wall, -Wcast-qual 1999-01-29 23:18:50 +00:00
ktrace.h
libkern.h
linedisc.h Reviewed by: Julian Elischer <julian@whistle.com> 1999-02-25 05:22:30 +00:00
link_aout.h Add GDB support for ELF shared libs. 1998-05-23 15:17:53 +00:00
link_elf.h Add GDB support for ELF shared libs. 1998-05-23 15:17:53 +00:00
linker.h Add MODINFO_ARGS, parameters passed to a module at load time. 1999-03-08 11:05:52 +00:00
linker_set.h Move the linker set definitions into a new header file 1999-01-14 05:48:46 +00:00
lkm.h There is no such thing any more as "struct bdevsw". 1998-07-04 22:30:26 +00:00
lock.h Add 'options DEBUG_LOCKS', which stores extra information in struct 1999-01-20 14:49:12 +00:00
lockf.h Forward declare a struct and #include <sys/queue.h> so that this file 1998-02-03 22:17:45 +00:00
lockmgr.h Add 'options DEBUG_LOCKS', which stores extra information in struct 1999-01-20 14:49:12 +00:00
malloc.h Fix warnings in preparation for adding -Wall -Wcast-qual to the 1999-01-27 21:50:00 +00:00
mbuf.h Get rid of MT_RTABLE; multicast routing no longer uses it. 1999-01-18 02:09:52 +00:00
md5.h Export MD5Transform in md5.c and remove a private version in random_machdep.c 1998-03-29 11:55:06 +00:00
mdioctl.h
mman.h Mostly remove the VM_STACK OPTION. 1999-01-26 02:49:52 +00:00
module.h More -Wall / -Wcast-qual cleanup. Also, EXEC_SET can't use 1999-01-29 08:36:45 +00:00
mount.h * Change sysctl from using linker_set to construct its tree using SLISTs. 1999-02-16 10:49:55 +00:00
mouse.h 1) Added define for USB as an interface 1999-02-21 16:08:43 +00:00
msg.h
msgbuf.h Some cleanups related to timecounters and weird ifdefs in <sys/time.h>. 1998-05-28 09:30:28 +00:00
mtio.h minor tweaks 1999-02-05 07:57:26 +00:00
namei.h This commit fixes various 64bit portability problems required for 1998-06-07 17:13:14 +00:00
nlist_aout.h Move nlist related defines from link.h into nlist.h. Clean up 1997-12-06 17:59:52 +00:00
param.h Increment __FreeBSD_version to reflect the fact that the kernel can 1999-02-20 23:54:00 +00:00
pciio.h Revive PCIConf. 1998-09-15 08:21:13 +00:00
pioctl.h Add a copyright and license notice, on Jordan's request. 1997-12-20 18:36:02 +00:00
pipe.h I got another batch of suggestions for cosmetic changes from bde. 1998-11-11 10:56:07 +00:00
poll.h Cleaned up some comments and ifdefs. 1998-02-03 22:32:23 +00:00
posix4.h The system call stubs for the sched_* system calls can't be 1998-03-28 22:44:28 +00:00
proc.h Reviewed by: Many at differnt times in differnt parts, 1999-03-12 02:24:58 +00:00
procfs.h Viola! The kernel now generates standard ELF core dumps for ELF 1998-09-14 22:46:08 +00:00
protosw.h Add a flag, passed to pru_send routines, PRUS_MORETOCOME. This 1999-01-20 17:32:01 +00:00
ptrace.h This commit fixes various 64bit portability problems required for 1998-06-07 17:13:14 +00:00
queue.h Name change suggested by Justin (QUEUE->UNTIL) 1999-01-07 22:27:53 +00:00
random.h Converted add_interrupt_randomness() to take a `void *' arg. Rewrote 1998-06-21 11:33:32 +00:00
reboot.h Define shift, mask and extraction macros for obtaining the slice number 1998-03-08 15:04:20 +00:00
resource.h Don't #include <sys/types.h>. I mistakenly #included it unconditionally 1997-11-18 08:07:37 +00:00
resourcevar.h Some cleanups related to timecounters and weird ifdefs in <sys/time.h>. 1998-05-28 09:30:28 +00:00
rlist.h
rman.h The new resource manager, hopefully in a reasonably stable form. 1998-10-29 01:48:36 +00:00
rtprio.h Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B and 1998-03-28 11:51:01 +00:00
scsiio.h Serves me right for committing code late at night... 1998-02-01 18:09:50 +00:00
select.h
selinfo.h
sem.h Remove hardwired alignment, align to sizeof(long) which should be more 1998-12-14 21:34:55 +00:00
semaphore.h Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B and 1998-03-28 11:51:01 +00:00
shm.h Forward declare more structs that are used in prototypes here - don't 1998-02-01 20:08:39 +00:00
signal.h Define ss_size in struct sigaltstack as size_t instead of int. 1998-08-05 09:04:36 +00:00
signalvar.h Enable Linux threads support by default. 1999-01-26 02:38:12 +00:00
sliceio.h Bad144 support for the slice system (!) 1998-04-22 19:27:54 +00:00
smp.h Maintain a mapping from irq number to (ioapic number, int pin) tuple, 1998-09-06 22:41:42 +00:00
snoop.h Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108. 1998-04-17 22:37:19 +00:00
socket.h Implemented zero-copy TCP/IP extensions via sendfile(2) - send a 1998-11-05 14:28:26 +00:00
socketvar.h Moved prototypes for soo_{read,write,close} into socketvar.h where they 1999-02-01 21:16:31 +00:00
sockio.h Introduce the SIOC[SG]IFGENERIC hooks that can be used to pass an 1997-10-07 07:39:40 +00:00
soundcard.h soundcard.h wasn't upgraded when i386/isa/snd was 1998-02-18 02:27:00 +00:00
stat.h Fix the futimes/undelete/utrace conflict with other BSD's. Note that 1998-05-11 03:55:28 +00:00
syscall-hide.h regenerate (+kldsym) 1998-11-11 12:57:05 +00:00
syscall.h regenerate (+kldsym) 1998-11-11 12:57:05 +00:00
syscall.mk regenerate (+kldsym) 1998-11-11 12:57:05 +00:00
sysctl.h Add forward-declaration of struct linker_set, to fix a few warnings. 1999-02-28 17:38:28 +00:00
sysent.h Implement support for adding syscalls in KLD modules. 1999-01-09 14:15:41 +00:00
syslimits.h
syslog.h Added macros __printflike() and __scanflike() to <sys/cdefs.h>. 1998-07-13 06:45:23 +00:00
sysproto.h regenerate (+kldsym) 1998-11-11 13:05:29 +00:00
systm.h Make even more of the PPSAPI implementations generic. 1999-03-11 15:09:51 +00:00
tablet.h
termios.h Change a couple of long types to int to match NetBSD so that termios 1998-05-05 21:49:37 +00:00
time.h Make even more of the PPSAPI implementations generic. 1999-03-11 15:09:51 +00:00
timeb.h
timepps.h Make even more of the PPSAPI implementations generic. 1999-03-11 15:09:51 +00:00
timers.h
times.h
timetc.h Make even more of the PPSAPI implementations generic. 1999-03-11 15:09:51 +00:00
timex.h Make even more of the PPSAPI implementations generic. 1999-03-11 15:09:51 +00:00
tprintf.h Added macros __printflike() and __scanflike() to <sys/cdefs.h>. 1998-07-13 06:45:23 +00:00
tty.h I got another batch of suggestions for cosmetic changes from bde. 1998-11-11 10:56:07 +00:00
ttychars.h
ttycom.h follow up to: 1998-12-29 13:06:54 +00:00
ttydefaults.h Map CSTATUS to ^T by default or it never noticed by novice users 1997-08-15 22:43:22 +00:00
ttydev.h
types.h Fix warnings in preparation for adding -Wall -Wcast-qual to the 1999-01-28 00:57:57 +00:00
ucred.h Fixed English in previous commit. 1999-01-31 10:05:59 +00:00
uio.h Make our v_usecount vnode reference count work identically to the 1998-01-06 05:26:17 +00:00
un.h Fixed missing and unused forward declarations of structs. 1998-05-17 18:17:59 +00:00
unistd.h Changes to the LINUX_THREADS support to only allocate extra memory for 1999-01-07 21:23:50 +00:00
unpcb.h Convert socket structures to be type-stable and add a version number. 1998-05-15 20:11:40 +00:00
user.h Enable Linux threads support by default. 1999-01-26 02:38:12 +00:00
utsname.h
vadvise.h
vcmd.h
vlimit.h
vmmeter.h Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> 1999-02-25 06:05:28 +00:00
vnioctl.h
vnode.h Make worklist add function a static, remove from sys/vnode.h 1999-02-19 17:41:14 +00:00
vsio.h
wait.h Fix thread/process tracking and differentiation for Linux threads emulation. 1999-03-02 00:28:09 +00:00
wormio.h Add an ioctl to retrieve the next writable address. 1998-03-31 01:56:29 +00:00
xrpuio.h Header file for XRPU devices. 1998-10-24 19:47:29 +00:00