dragonfly.git
17 years agoSync with FreeBSD.
Sascha Wildner [Wed, 10 May 2006 15:18:29 +0000 (15:18 +0000)]
Sync with FreeBSD.

17 years agoComment out references to cnw(4). It's unlikely that we'll import it.
Sascha Wildner [Tue, 9 May 2006 07:18:39 +0000 (07:18 +0000)]
Comment out references to cnw(4). It's unlikely that we'll import it.

17 years agoSplit kern/vfs_journal.c. Leave the low level journal support code in
Matthew Dillon [Mon, 8 May 2006 18:45:53 +0000 (18:45 +0000)]
Split kern/vfs_journal.c.  Leave the low level journal support code in
kern/vfs_journal.c and move all the mount-based journaling code and
journaling VNOPS to kern/vfs_jops.c.  This is in preparation for utilizing
the core journaling protocol for userland VFS support.

17 years agoRewrite the POSIX locking code. It was becomming impossible to track
Matthew Dillon [Mon, 8 May 2006 00:38:59 +0000 (00:38 +0000)]
Rewrite the POSIX locking code.  It was becomming impossible to track
down bugs in the previous version due to code complexity (in particular
a large number of undocumented short cuts and gotos), and general lack of
documentation.

The new code uses a more straightforward method for managing the lock list
and is far better documented.  Basically the conflict space is ranged,
if no conflict occurs the new lock is inserted, overlaps are clipped or
removed, and finally a quick optimization to check for and collapse
compatible adjacent locks.

17 years agoAdd a little program that allows one to test posix range locks.
Matthew Dillon [Mon, 8 May 2006 00:30:41 +0000 (00:30 +0000)]
Add a little program that allows one to test posix range locks.

17 years agoRemove the internal F_FLOCK flag. Either F_POSIX or F_FLOCK must be set,
Matthew Dillon [Sun, 7 May 2006 19:17:18 +0000 (19:17 +0000)]
Remove the internal F_FLOCK flag.  Either F_POSIX or F_FLOCK must be set,
so just use F_POSIX to indicate whether its a posix style lock or an flock
style lock.

17 years agolockmgr_kernproc() wasn't checking whether the lockholder as already
Matthew Dillon [Sun, 7 May 2006 00:51:11 +0000 (00:51 +0000)]
lockmgr_kernproc() wasn't checking whether the lockholder as already
LK_KERNTHREAD, resulting in a panic in certain situations.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
17 years agoRecode the streamid selector. The streamid was faked before. Do it for
Matthew Dillon [Sun, 7 May 2006 00:24:58 +0000 (00:24 +0000)]
Recode the streamid selector.  The streamid was faked before.  Do it for
real now, guarenteeing that parallel transactions will have unique stream
identifiers.

In addition, while not required, streamid calculations are such that non
parallel transactions will have a tendancy to use the same id, so someone
observing the streamid's in a journaling stream can easily pick out when
parallel transactions occur.

17 years agoWe have to use pmap_extract() here. If we lose a race against page
Matthew Dillon [Sun, 7 May 2006 00:24:02 +0000 (00:24 +0000)]
We have to use pmap_extract() here.  If we lose a race against page
table cleaning pmap_kextract() could choke on a missing page directory.

17 years agoWe have to use pmap_extract() here. pmap_kextract() will choke on a missing
Matthew Dillon [Sun, 7 May 2006 00:23:08 +0000 (00:23 +0000)]
We have to use pmap_extract() here.  pmap_kextract() will choke on a missing
page directory and the user memory hasn't been touched yet.

17 years agoWe have to use pmap_extract here, pmap_kextract will choke if the page
Matthew Dillon [Sun, 7 May 2006 00:22:37 +0000 (00:22 +0000)]
We have to use pmap_extract here, pmap_kextract will choke if the page
directory is missing and the user memory has not been touched.

17 years agoFix a null pointer indirection, the VM fault rate limiting code only
Matthew Dillon [Sat, 6 May 2006 23:53:34 +0000 (23:53 +0000)]
Fix a null pointer indirection, the VM fault rate limiting code only
applies to processes.

17 years agoRemove the thread argument from all mount->vfs_* function vectors,
Matthew Dillon [Sat, 6 May 2006 18:48:53 +0000 (18:48 +0000)]
Remove the thread argument from all mount->vfs_* function vectors,
replacing it with a ucred pointer when applicable.  This cleans up a
considerable amount of VFS function code that previously delved into
the process structure to get the cred, though some code remains.

Get rid of the compatibility thread argument for hpfs and nwfs.  Our
lockmgr calls are now mostly compatible with NetBSD (which doesn't use a
thread argument either).

Get rid of some complex junk in fdesc_statfs() that nobody uses.

Remove the thread argument from dounmount() as well as various other
filesystem specific procedures (quota calls primarily) which no longer
need it due to the lockmgr, VOP, and VFS cleanups.  These cleanups also
have the effect of making the VFS code slightly less dependant on the
calling thread's context.

17 years agoFix .Os and a .Xr. Expand HISTORY a bit.
Sascha Wildner [Sat, 6 May 2006 17:39:29 +0000 (17:39 +0000)]
Fix .Os and a .Xr. Expand HISTORY a bit.

17 years agoRemove the thread argument from ext2_quotaoff(), ext2_flushfiles(),
Matthew Dillon [Sat, 6 May 2006 16:33:26 +0000 (16:33 +0000)]
Remove the thread argument from ext2_quotaoff(), ext2_flushfiles(),
ext2_mountfs(), and ext2_reload().

17 years agoRemove the thread argument from ffs_flushfiles(), ffs_mountfs(),
Matthew Dillon [Sat, 6 May 2006 16:20:19 +0000 (16:20 +0000)]
Remove the thread argument from ffs_flushfiles(), ffs_mountfs(),
softdep_flushfiles(), ffs_reload(), ufs_quotaon(), and ufs_quotaoff().

17 years agoRemove the thread_t argument from nfs_rslock() and nfs_rsunlock().
Matthew Dillon [Sat, 6 May 2006 16:01:21 +0000 (16:01 +0000)]
Remove the thread_t argument from nfs_rslock() and nfs_rsunlock().

17 years agoThe fdrop() procedure no longer needs a thread argument, remove it.
Matthew Dillon [Sat, 6 May 2006 06:38:39 +0000 (06:38 +0000)]
The fdrop() procedure no longer needs a thread argument, remove it.

17 years agoAdd some ifioctl() td -> ucred changes that were missed.
Matthew Dillon [Sat, 6 May 2006 03:16:44 +0000 (03:16 +0000)]
Add some ifioctl() td -> ucred changes that were missed.

17 years agoThe thread/proc pointer argument in the VFS subsystem originally existed
Matthew Dillon [Sat, 6 May 2006 02:43:15 +0000 (02:43 +0000)]
The thread/proc pointer argument in the VFS subsystem originally existed
for...  well, I'm not sure *WHY* it originally existed when most of the
time the pointer couldn't be anything other then curthread or curproc or
the code wouldn't work.  This is particularly true of lockmgr locks.

Remove the pointer argument from all VOP_*() functions, all fileops functions,
and most ioctl functions.

17 years agoRemove the thread_t argument from vfs_busy() and vfs_unbusy(). Passing a
Matthew Dillon [Fri, 5 May 2006 21:27:58 +0000 (21:27 +0000)]
Remove the thread_t argument from vfs_busy() and vfs_unbusy().  Passing a
thread_t to these functions has always been questionable at best.

17 years agoSimplify vn_lock(), VOP_LOCK(), and VOP_UNLOCK() by removing the thread_t
Matthew Dillon [Fri, 5 May 2006 21:15:11 +0000 (21:15 +0000)]
Simplify vn_lock(), VOP_LOCK(), and VOP_UNLOCK() by removing the thread_t
argument.  These calls now always use the current thread as the lockholder.
Passing a thread_t to these functions has always been questionable at best.

17 years agoRemove the thread pointer argument to lockmgr(). All lockmgr() ops use the
Matthew Dillon [Fri, 5 May 2006 20:15:02 +0000 (20:15 +0000)]
Remove the thread pointer argument to lockmgr().  All lockmgr() ops use the
current thread.

Move the lockmgr code in BUF_KERNPROC to lockmgr_kernproc().  This code
allows the lock owner to be set to a special value so any thread can unlock
the lock and is required for B_ASYNC I/O so biodone() can release the lock.

17 years agoRemove VOP_BWRITE(). This function provided a way for a VFS to override
Matthew Dillon [Fri, 5 May 2006 16:35:11 +0000 (16:35 +0000)]
Remove VOP_BWRITE().  This function provided a way for a VFS to override
the bwrite() function and was used *only* by NFS in order to allow NFS to
handle the B_NEEDCOMMIT flag as part of NFSv3's 2-phase commit operation.
However, over time, the handling of this flag was moved to the strategy code.
Additionally, the kernel now fully supports the redirtying of buffers
during an I/O (which both softupdates and NFS need to be able to do).

The override is no longer needed.  All former calls to VOP_BWRITE() now
simply call bwrite().

17 years agoCleanup procedure prototypes, get rid of extra spaces in pointer decls.
Matthew Dillon [Fri, 5 May 2006 16:15:56 +0000 (16:15 +0000)]
Cleanup procedure prototypes, get rid of extra spaces in pointer decls.

17 years agocorrect "polling" support
Sepherosa Ziehau [Fri, 5 May 2006 14:53:41 +0000 (14:53 +0000)]
correct "polling" support

17 years agoRemove unused label.
Sascha Wildner [Fri, 5 May 2006 09:28:05 +0000 (09:28 +0000)]
Remove unused label.

17 years agoBlock devices generally truncate the size of I/O requests which go past EOF.
Matthew Dillon [Thu, 4 May 2006 18:32:23 +0000 (18:32 +0000)]
Block devices generally truncate the size of I/O requests which go past EOF.
This is exactly what we want when manually reading or writing a block device
such as /dev/ad0s1a, but is not desired when a VFS issues I/O ops on
filesystem buffers.  In such cases, any EOF condition must be considered an
error.

Implement a new filesystem buffer flag B_BNOCLIP, which getblk() and friends
automatically set.  If set, block devices are guarenteed to return an error
if the I/O request is at EOF or would otherwise have to be clipped to EOF.
Block devices further guarentee that b_bcount will not be modified when this
flag is set.

Adjust all block device EOF checks to use the new flag, and clean up the code
while I'm there.  Also, set b_resid in a couple of degenerate cases where
it was not being set.

17 years agoDon't forget to replicate b_cmd, which has been split off of b_flags.
YONETANI Tomokazu [Thu, 4 May 2006 08:00:59 +0000 (08:00 +0000)]
Don't forget to replicate b_cmd, which has been split off of b_flags.

17 years ago- Clarify the definitions of b_bufsize, b_bcount, and b_resid.
Matthew Dillon [Wed, 3 May 2006 20:44:49 +0000 (20:44 +0000)]
- Clarify the definitions of b_bufsize, b_bcount, and b_resid.
- Remove unnecessary assignments based on the clarified fields.
- Add additional checks for premature EOF.

b_bufsize is only used by buffer management entities such as getblk() and
other vnode-backed buffer handling procedures.  b_bufsize is not required
for calls to vn_strategy() or dev_dstrategy().  A number of other subsystems
use it to track the original request size.

b_bcount is the I/O request size, but b_bcount() is allowed to be truncated
by the device chain if the request encompasses EOF (such as on a raw disk
device).  A caller which needs to record the original buffer size verses
the EOF-truncated buffer can compare b_bcount after the I/O against a
recorded copy of the original request size.  This copy can be recorded in
b_bufsize for unmanaged buffers (malloced or getpbuf()'d buffers).

b_resid is always relative to b_bcount, not b_bufsize.  A successful read
that is truncated to the device EOF will thus have a b_resid of 0 and a
truncated b_bcount.

17 years agoDocument the handling of a file holes in ufs_strategy() and clean up
Matthew Dillon [Wed, 3 May 2006 19:57:54 +0000 (19:57 +0000)]
Document the handling of a file holes in ufs_strategy() and clean up
the code flow a little.

17 years agoInvert a mistaken test. Set b_resid to 0 if B_ERROR is not set.
Matthew Dillon [Wed, 3 May 2006 16:34:16 +0000 (16:34 +0000)]
Invert a mistaken test.  Set b_resid to 0 if B_ERROR is not set.

17 years agoRemove the accounting argument from lf_create_range() and lf_destroy_range().
Matthew Dillon [Wed, 3 May 2006 15:20:43 +0000 (15:20 +0000)]
Remove the accounting argument from lf_create_range() and lf_destroy_range().
Integrate p_numposixlocks counting into lf_count_change().  Calculate the
correct delta when changing flags on existing locks.

17 years agoMinor cleanup, plus initialize a few additional fields in the proc
Matthew Dillon [Wed, 3 May 2006 15:18:38 +0000 (15:18 +0000)]
Minor cleanup, plus initialize a few additional fields in the proc
structure so we don't get bitten by them in the future.

17 years agoAdd a missing ohci_waitintr() call that allows polled operation of
Matthew Dillon [Wed, 3 May 2006 15:08:43 +0000 (15:08 +0000)]
Add a missing ohci_waitintr() call that allows polled operation of
bulk transfers to have a chance of working.  Kernel crash dumps
to umass() work with this change.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD PR:usb/93720

17 years agoFix a biodone/AR_WAIT case. b_cmd was not getting set to BUF_CMD_DONE,
Matthew Dillon [Wed, 3 May 2006 06:28:01 +0000 (06:28 +0000)]
Fix a biodone/AR_WAIT case.  b_cmd was not getting set to BUF_CMD_DONE,
causing ATA-RAID to timeout.

Reported-by: Stefan Krueger, YONETANI Tomokazu
17 years agoFix an information disclosure issue on AMD cpus. The x87 debug registers,
Matthew Dillon [Tue, 2 May 2006 22:52:24 +0000 (22:52 +0000)]
Fix an information disclosure issue on AMD cpus.  The x87 debug registers,
in particular the last instruction and last data pointers, are not restored
by fxrstor() if there was no pending exception.  Add some dummy FP
instructions (about ~7ns) to 'clean' the registers so a process has no
visibility into another process's FP state.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD
Security-Advistory: FreeBSD-SA-06:14.fpu

17 years agoFix a bug in close(). When a descriptor is closed, all process leaders
Matthew Dillon [Tue, 2 May 2006 21:30:43 +0000 (21:30 +0000)]
Fix a bug in close().  When a descriptor is closed, all process leaders
sharing that descriptor table must clear any related POSIX locks.  The
code was looping through all the leaders but passing the wrong process
pointer to VOP_ADVLOCK, resulting in an assertion panic later on in exit1().

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
17 years agoThe wrong pointer was being used to calculate the page offset, leading
Matthew Dillon [Tue, 2 May 2006 19:21:50 +0000 (19:21 +0000)]
The wrong pointer was being used to calculate the page offset, leading
to a vmapbuf() assertion.  This bug was introduced in a recent commit.

17 years ago- Add workarounds for dropped interrupts on VIA and ATI controllers.
Matthew Dillon [Tue, 2 May 2006 16:12:01 +0000 (16:12 +0000)]
- Add workarounds for dropped interrupts on VIA and ATI controllers.
- Include more vendor IDs.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD/NetBSD

17 years agoPlug memory leak in umass.
Matthew Dillon [Tue, 2 May 2006 16:08:44 +0000 (16:08 +0000)]
Plug memory leak in umass.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD/NetBSD

17 years agoSupply a stack pointer for a pure thread context so backtrace works.
Matthew Dillon [Mon, 1 May 2006 16:56:01 +0000 (16:56 +0000)]
Supply a stack pointer for a pure thread context so backtrace works.
Otherwise the 'back' command on a paniced kernel thread may get confused.

17 years ago32bit from 64bit value fixup.
Matthew Dillon [Mon, 1 May 2006 16:27:35 +0000 (16:27 +0000)]
32bit from 64bit value fixup.

fixed a bug comparing sav->key_auth and SADB_AALG_NONE. [From KAME]

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agomore strict sanity check for ESP tail. [From KAME]
Matthew Dillon [Mon, 1 May 2006 16:26:54 +0000 (16:26 +0000)]
more strict sanity check for ESP tail. [From KAME]

Fix IPv6 error statistics being recorded as IPv4.

m_cat() may free the mbuf on 2nd arg, so m_pkthdr manipulation
has to happen before the call to m_cat(). [May not apply.]

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agoFix fencepost error causing creation of 0-length mbufs when
Matthew Dillon [Mon, 1 May 2006 16:26:29 +0000 (16:26 +0000)]
Fix fencepost error causing creation of 0-length mbufs when
the boundary between header and data fell on the boundary
between two mbufs.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years ago32bit from 64bit value fixup. Fix typo.
Matthew Dillon [Mon, 1 May 2006 16:26:09 +0000 (16:26 +0000)]
32bit from 64bit value fixup.  Fix typo.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agom_cat() may free the mbuf on 2nd arg, so m_pkthdr manipulation
Matthew Dillon [Mon, 1 May 2006 16:25:41 +0000 (16:25 +0000)]
m_cat() may free the mbuf on 2nd arg, so m_pkthdr manipulation
has to happen before the call to m_cat(). [May not apply.]

Fix IPv6 error statistics being recorded as IPv4.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agoPlug xform memory leaks. Don't re-initialize an xform for an SA that
Matthew Dillon [Mon, 1 May 2006 16:24:43 +0000 (16:24 +0000)]
Plug xform memory leaks. Don't re-initialize an xform for an SA that
already has one.

Add a missing 'break;'

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agoFix kldstat option.
Sascha Wildner [Mon, 1 May 2006 09:22:14 +0000 (09:22 +0000)]
Fix kldstat option.

17 years agoRemove ports(7) reference and reword.
Sascha Wildner [Mon, 1 May 2006 09:06:33 +0000 (09:06 +0000)]
Remove ports(7) reference and reword.

17 years agoDocument recently added devices.
Sascha Wildner [Mon, 1 May 2006 02:06:40 +0000 (02:06 +0000)]
Document recently added devices.

Submitted-by: Gary <gary@velocity-servers.net>
17 years agoAdd missing #includes.
Sascha Wildner [Mon, 1 May 2006 01:32:11 +0000 (01:32 +0000)]
Add missing #includes.

17 years agoRemove buf->b_saveaddr, assert that vmapbuf() is only called on pbuf's. Pass
Matthew Dillon [Sun, 30 Apr 2006 20:23:26 +0000 (20:23 +0000)]
Remove buf->b_saveaddr, assert that vmapbuf() is only called on pbuf's.  Pass
the user pointer and length to vmapbuf() rather then having it try to pull
the information out of the buffer.  vmapbuf() is now responsible for setting
b_data, b_bufsize, and b_bcount.

Also fix a bug in cam_periph_mapmem().  The procedure was failing to unmap
earlier vmapped bufs if later vmapbuf() calls in the loop failed.

17 years agoThe pbuf subsystem now initializes b_kvabase and b_kvasize at startup and
Matthew Dillon [Sun, 30 Apr 2006 18:52:37 +0000 (18:52 +0000)]
The pbuf subsystem now initializes b_kvabase and b_kvasize at startup and
no longer reinitializes these fields in initpbuf().

Users of getpbuf() may no longer modify b_kvabase or b_kvasize.  b_data may
still be modified.

17 years agoAdd some missing manual pages.
Sascha Wildner [Sun, 30 Apr 2006 18:46:39 +0000 (18:46 +0000)]
Add some missing manual pages.

Taken-from: FreeBSD

17 years agoRemove b_xflags. Fold BX_VNCLEAN and BX_VNDIRTY into b_flags as
Matthew Dillon [Sun, 30 Apr 2006 18:25:37 +0000 (18:25 +0000)]
Remove b_xflags.  Fold BX_VNCLEAN and BX_VNDIRTY into b_flags as
B_VNCLEAN and B_VNDIRTY.  Remove BX_AUTOCHAINDONE and recode the
swap pager to use one of the caller data fields in the BIO instead.

17 years agoReplace the the buffer cache's B_READ, B_WRITE, B_FORMAT, and B_FREEBUF
Matthew Dillon [Sun, 30 Apr 2006 17:22:18 +0000 (17:22 +0000)]
Replace the the buffer cache's B_READ, B_WRITE, B_FORMAT, and B_FREEBUF
b_flags with a separate b_cmd field.  Use b_cmd to test for I/O completion
as well (getting rid of B_DONE in the process).  This further simplifies
the setup required to issue a buffer cache I/O.

Remove a redundant header file, bus/isa/i386/isa_dma.h and merge any
discrepancies into bus/isa/isavar.h.

Give ISADMA_READ/WRITE/RAW their own independant flag definitions instead of
trying to overload them on top of B_READ, B_WRITE, and B_RAW.  Add a
routine isa_dmabp() which takes a struct buf pointer and returns the ISA
dma flags associated with the operation.

Remove the 'clear_modify' argument to vfs_busy_pages().  Instead,
vfs_busy_pages() asserts that the buffer's b_cmd is valid and then uses
it to determine the action it must take.

17 years agoAdd NetGear FA-511 support
Sepherosa Ziehau [Sun, 30 Apr 2006 02:02:06 +0000 (02:02 +0000)]
Add NetGear FA-511 support

Obtained-from: FreeBSD
Tested-by: Andrew Thompson <andrew@hijacked.us>
17 years agoBring in SHA256 support from FreeBSD.
Matthew Dillon [Sat, 29 Apr 2006 22:19:26 +0000 (22:19 +0000)]
Bring in SHA256 support from FreeBSD.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD

17 years agoBring in some fixes from NetBSD:
Matthew Dillon [Sat, 29 Apr 2006 22:05:21 +0000 (22:05 +0000)]
Bring in some fixes from NetBSD:

- Avoid NULL pointer dereference (ehci.c)
- Abort quickly if we don't have a buffer in all the cases. (uhci.c)
- Only do the software reset if we are dying, like we do in ohci and
  ehci (uhci.c)

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: NetBSD

17 years agoFix typo.
Sascha Wildner [Fri, 28 Apr 2006 20:16:26 +0000 (20:16 +0000)]
Fix typo.

17 years agoNever generate external references for __cursig().
Sascha Wildner [Fri, 28 Apr 2006 18:23:45 +0000 (18:23 +0000)]
Never generate external references for __cursig().

For what it's worth, this fixes buildkernel with -O0.

__inline-clue-by: joerg

17 years agoMove the error check into the else clause because it only applies there.
Sascha Wildner [Fri, 28 Apr 2006 16:45:34 +0000 (16:45 +0000)]
Move the error check into the else clause because it only applies there.

17 years agoGet rid of pbgetvp() and pbrelvp(). Instead fold the B_PAGING flag directly
Matthew Dillon [Fri, 28 Apr 2006 16:34:02 +0000 (16:34 +0000)]
Get rid of pbgetvp() and pbrelvp().  Instead fold the B_PAGING flag directly
into getpbuf() (the only type of buffer that pbgetvp() could be called on
anyway).  Change related b_flags assignments from '=' to '|='.

Get rid of remaining depdendancies on b_vp.  vn_strategy() now relies solely
on the vp passed to it as an argument.  Remove buffer cache code that sets
b_vp for anonymous pbuf's.

Add a stopgap 'vp' argument to vfs_busy_pages().  This is only really needed
by NFS and the clustering code do to the severely hackish nature of the
NFS and clustering code.

Fix a bug in the ext2fs inode code where vfs_busy_pages() was being called
on B_CACHE buffers.  Add an assertion to vfs_busy_pages() to panic if it
encounters a B_CACHE buffer.

17 years agoRemove non-existant variable from debugging message.
Matthew Dillon [Fri, 28 Apr 2006 16:06:50 +0000 (16:06 +0000)]
Remove non-existant variable from debugging message.

Reported-by: Sascha Wildner <saw@online.de>
17 years agoGet rid of the remaining buffer background bitmap code. It's been turned
Matthew Dillon [Fri, 28 Apr 2006 06:13:56 +0000 (06:13 +0000)]
Get rid of the remaining buffer background bitmap code.  It's been turned
off for a while, and it represents a fairly severe hack to the buffer
cache code that just complicates further development.

17 years agoRemove the buffer cache's B_PHYS flag. This flag was originally used as
Matthew Dillon [Fri, 28 Apr 2006 00:24:46 +0000 (00:24 +0000)]
Remove the buffer cache's B_PHYS flag.  This flag was originally used as
part of a severe hack to treat buffers containing 'user' addresses
differently, in particular by using b_offset instead of b_blkno.  Now that
buffer cache buffers only HAVE b_offset (b_*blkno is gone for good), there
is literally no difference between B_PHYS I/O and non-B_PHYS I/O once
the buffer has been handed off to the device.

17 years agoFix a bug in the POSIX locking code. The system could lose track of
Matthew Dillon [Fri, 28 Apr 2006 00:13:23 +0000 (00:13 +0000)]
Fix a bug in the POSIX locking code.  The system could lose track of
range locks due to a bad flags assignment, resulting in odd operation and/or
an assertion at process exit.  Fix the flags assignment.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
17 years agoMove most references to the buffer cache array (buf[]) to kern/vfs_bio.c.
Matthew Dillon [Thu, 27 Apr 2006 23:28:37 +0000 (23:28 +0000)]
Move most references to the buffer cache array (buf[]) to kern/vfs_bio.c.
Implement a procedure which scans all buffers, called scan_all_buffers().
Cleanup unused debugging code referencing buf[].

17 years agoGet rid of libcr, the idea(s) behind it are not really applicable anymore
Matthew Dillon [Thu, 27 Apr 2006 17:23:14 +0000 (17:23 +0000)]
Get rid of libcr, the idea(s) behind it are not really applicable anymore
now that libc_r is properly linked against libc.

17 years agogrrr...fix reverse chronological order
Sascha Wildner [Thu, 27 Apr 2006 16:01:33 +0000 (16:01 +0000)]
grrr...fix reverse chronological order

17 years agoUpdate HISTORY section for preadv and pwritev.
Sascha Wildner [Thu, 27 Apr 2006 15:49:57 +0000 (15:49 +0000)]
Update HISTORY section for preadv and pwritev.

17 years agoAdd documentation for the new preadv(2) and pwritev(2) system calls.
Sascha Wildner [Thu, 27 Apr 2006 15:36:00 +0000 (15:36 +0000)]
Add documentation for the new preadv(2) and pwritev(2) system calls.

Submitted-by: Chuck Tuffli <ctuffli@gmail.com>
17 years agoSignals are described in signal(3).
Sascha Wildner [Thu, 27 Apr 2006 10:25:34 +0000 (10:25 +0000)]
Signals are described in signal(3).

17 years agoRemove unneeded comma.
Sascha Wildner [Thu, 27 Apr 2006 10:24:14 +0000 (10:24 +0000)]
Remove unneeded comma.

17 years agoRemove trailing whitespace.
Sascha Wildner [Thu, 27 Apr 2006 10:23:20 +0000 (10:23 +0000)]
Remove trailing whitespace.

17 years agos/pxeldr/pxeboot/
Sascha Wildner [Thu, 27 Apr 2006 10:22:08 +0000 (10:22 +0000)]
s/pxeldr/pxeboot/

17 years agoAdd missing braces.
Sascha Wildner [Thu, 27 Apr 2006 08:19:29 +0000 (08:19 +0000)]
Add missing braces.

Submitted-by: Csaba Henk <csaba.henk@creo.hu>
17 years agoFix LINT build.
Sascha Wildner [Thu, 27 Apr 2006 08:03:56 +0000 (08:03 +0000)]
Fix LINT build.

kern_readv() and kern_writev() were renamed to kern_preadv() and
kern_pwritev().

17 years agoFix the range checking for all read and write system calls. Fix the
Matthew Dillon [Wed, 26 Apr 2006 17:42:55 +0000 (17:42 +0000)]
Fix the range checking for all read and write system calls.  Fix the
iovec code to properly range-check iovec elements and to ensure that
the total length does not overflow a signed integer.  Regardless of
'size_t', the kernel does not allow any single I/O operation to exceed
2^31 bytes.

17 years agoAdd the preadv() and pwritev() systems and regenerate.
Matthew Dillon [Wed, 26 Apr 2006 17:17:57 +0000 (17:17 +0000)]
Add the preadv() and pwritev() systems and regenerate.

Submitted-by: Chuck Tuffli <ctuffli@gmail.com>
Loosely-based-on: FreeBSD

17 years agoGet rid of the weird FSMID update path in the vnode and namecache code.
Matthew Dillon [Tue, 25 Apr 2006 22:11:32 +0000 (22:11 +0000)]
Get rid of the weird FSMID update path in the vnode and namecache code.
Instead, mark the vnode as needing an FSMID update when the vnode is
disconnected from the namecache.

This fixes a bug where FSMID updates were being lost at unmount time.

17 years agoSeparate the MD5 code into its own module.
Matthew Dillon [Tue, 25 Apr 2006 21:30:45 +0000 (21:30 +0000)]
Separate the MD5 code into its own module.

Add -k/-K to have cpdup use the experimental FSMID to detect changes,
allowing it to shortcut whole directory subhiearchies.

It should be noted that using cpdup with a NFS or other remote filesystem
as the source with this option will not work, since the NFS client cannot
currently detect if the server (or some other client) has modified a file
or directory.

17 years agoGenerate unique identifiers for simulated FSMIDs so any errors appear to
Matthew Dillon [Tue, 25 Apr 2006 19:36:03 +0000 (19:36 +0000)]
Generate unique identifiers for simulated FSMIDs so any errors appear to
indicate that a modification has occured.

17 years agoRename KVM_READ() to kread() and make it a real procedure. Also incorporate
Matthew Dillon [Tue, 25 Apr 2006 16:37:44 +0000 (16:37 +0000)]
Rename KVM_READ() to kread() and make it a real procedure.  Also incorporate
some suggestions by Mark W. Krentel.

Submitted-by: (references to Mark's suggestions) Stefan Krueger
17 years agoAdd a memory wrap check to kernacc to try to reduce instances of a bogus
Matthew Dillon [Tue, 25 Apr 2006 16:22:32 +0000 (16:22 +0000)]
Add a memory wrap check to kernacc to try to reduce instances of a bogus
kmem access crashing the kernel.

Taken-from: posting by Mark W. Krentel to the FreeBSD lists
Submitted-by: Stefan Krueger <skrueger@meinberlikomm.de>
17 years agovfsync() is not in the business of removing buffers beyond the file EOF.
Matthew Dillon [Mon, 24 Apr 2006 22:01:52 +0000 (22:01 +0000)]
vfsync() is not in the business of removing buffers beyond the file EOF.
Remove the procedural argument and related code.

17 years agoCall vnode_pager_setsize() before BALLOC rather than after.
Matthew Dillon [Mon, 24 Apr 2006 21:45:47 +0000 (21:45 +0000)]
Call vnode_pager_setsize() before BALLOC rather than after.

17 years agoIf softupdates or some other entity re-dirties a buffer, make sure
Matthew Dillon [Mon, 24 Apr 2006 21:44:52 +0000 (21:44 +0000)]
If softupdates or some other entity re-dirties a buffer, make sure
that B_NOCACHE is cleared to prevent the buffer from being discarded.
Add printfs to warn if the situation is encountered.

Fix a bug in brelse() where a buffer's flags were being modified after
the unlock instead of before.

17 years agoB_INVAFTERWRITE is no longer used, remove it.
Matthew Dillon [Mon, 24 Apr 2006 19:15:47 +0000 (19:15 +0000)]
B_INVAFTERWRITE is no longer used, remove it.

17 years agoFix an incorrect header length comparison for IPSEC AH. Add required
Matthew Dillon [Sun, 23 Apr 2006 17:56:36 +0000 (17:56 +0000)]
Fix an incorrect header length comparison for IPSEC AH.  Add required
includes for two other files.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
17 years agoThe nticks calculation is still broken. Sometimes the delta systimer
Matthew Dillon [Sun, 23 Apr 2006 17:48:59 +0000 (17:48 +0000)]
The nticks calculation is still broken.  Sometimes the delta systimer
value is less then the periodic value.  This has been tracked down to
a 32 bit overflow, but 32 bit overflows are SOP for systimers.  The
actual bug is related to lwp_slptime.  lwp_slptime is supposed to detect
that an overflow might have occured but apparently it can wind up 0 in
certain cases which have yet to be tracked down.

For now just sanitize nticks.

Reported-by: "Simon 'corecode' Schubert" <corecode@fs.ei.tum.de>
17 years agoAdjust manual pages to recent lock related changes.
Sascha Wildner [Sun, 23 Apr 2006 16:23:12 +0000 (16:23 +0000)]
Adjust manual pages to recent lock related changes.

17 years agoRemove LK_REENABLE (related to the LK_DRAIN removal).
Matthew Dillon [Sun, 23 Apr 2006 06:31:47 +0000 (06:31 +0000)]
Remove LK_REENABLE (related to the LK_DRAIN removal).

17 years agoRemove the now unused interlock argument to the lockmgr() procedure.
Matthew Dillon [Sun, 23 Apr 2006 03:08:04 +0000 (03:08 +0000)]
Remove the now unused interlock argument to the lockmgr() procedure.
This argument has been abused over the years by kernel programmers
attempting to optimize certain locking and data modification sequences,
resulting in a virtually unreadable code in some cases.  The interlock
also made porting between BSDs difficult as each BSD implemented their
interlock differently.  DragonFly has slowly removed use of the interlock
argument and we can now finally be rid of it entirely.

17 years agoRemove remaining uses of the lockmgr LK_INTERLOCK flag.
Matthew Dillon [Sun, 23 Apr 2006 02:43:19 +0000 (02:43 +0000)]
Remove remaining uses of the lockmgr LK_INTERLOCK flag.

17 years agoRemove all remaining support for LK_DRAIN lockmgr locks. LK_DRAIN was a
Matthew Dillon [Sun, 23 Apr 2006 02:41:15 +0000 (02:41 +0000)]
Remove all remaining support for LK_DRAIN lockmgr locks.  LK_DRAIN was a
mechanism that allowed lock requests to fail while a thread is blocked
disposing of a structure that has not been entirely unlinked from the
rest of the system, but LK_DRAIN's design only works on UP systems or
while the BGL is held.  It cannot be used in concurrent environments.
Just get rid of it entirely.

17 years agoGet rid of LK_DRAIN, rely on nc_lwant to interlock lock races against
Matthew Dillon [Sun, 23 Apr 2006 02:33:23 +0000 (02:33 +0000)]
Get rid of LK_DRAIN, rely on nc_lwant to interlock lock races against
termination.  Only unlock/relock in ncp_conn_free() if lwant is non-zero.

It is unclear whether nc_lwant is sufficient, though, but the original
code was pretty horrendous.

17 years agoGet rid of LK_DRAIN and LK_INTERLOCK interactions. Recode interlocks when
Matthew Dillon [Sun, 23 Apr 2006 02:29:33 +0000 (02:29 +0000)]
Get rid of LK_DRAIN and LK_INTERLOCK interactions.  Recode interlocks when
handling node termination (smb_co_gone) and fix a couple of race conditions
while we are in here that we used to rely on LK_DRAIN to handle.

17 years agoRun the lockmgr() call independant of the KASSERT() in smb_co_init().
Matthew Dillon [Sun, 23 Apr 2006 01:17:25 +0000 (01:17 +0000)]
Run the lockmgr() call independant of the KASSERT() in smb_co_init().