15 years agoLK_DRAIN locks are no longer obtained on vnodes, rip out the check.
Matthew Dillon [Sun, 23 Apr 2006 00:54:57 +0000 (00:54 +0000)]
LK_DRAIN locks are no longer obtained on vnodes, rip out the check.

15 years agoGet rid of LK_DRAIN in dounmount(). LK_DRAIN locks are not SMP friendly and
Matthew Dillon [Sun, 23 Apr 2006 00:54:11 +0000 (00:54 +0000)]
Get rid of LK_DRAIN in dounmount().  LK_DRAIN locks are not SMP friendly and
can lead to structural pointer races against free() operations.  Struct mount
is protected by the MNTK_UNMOUNT flag.

15 years agoRemove unused code label.
Matthew Dillon [Sun, 23 Apr 2006 00:47:10 +0000 (00:47 +0000)]
Remove unused code label.

15 years agoGet rid of LK_PCATCH in the agp lockmgr() calls. AGP ignores the return
Matthew Dillon [Sat, 22 Apr 2006 23:41:43 +0000 (23:41 +0000)]
Get rid of LK_PCATCH in the agp lockmgr() calls.  AGP ignores the return
value and a caught event would only result in a panic.

Get rid of LK_DRAIN in the device detach code.  The device had better not
be in operation during a detach!

Add missing lockmgr LK_RELEASE calls in a number of early-return cases.

15 years agoGet rid of unused arg.
Matthew Dillon [Sat, 22 Apr 2006 22:34:06 +0000 (22:34 +0000)]
Get rid of unused arg.

15 years agoMisc sysperf cleanups. Add another mutex tester to test the xchgl
Matthew Dillon [Sat, 22 Apr 2006 22:32:52 +0000 (22:32 +0000)]
Misc sysperf cleanups.  Add another mutex tester to test the xchgl

15 years agoAdd spin_uninit() to provide symmetry with spin_init().
Matthew Dillon [Sat, 22 Apr 2006 22:19:19 +0000 (22:19 +0000)]
Add spin_uninit() to provide symmetry with spin_init().

15 years agoMinor typing cleanups for aicasm.
Matthew Dillon [Sat, 22 Apr 2006 16:15:26 +0000 (16:15 +0000)]
Minor typing cleanups for aicasm.

Submitted-by: Xin LI <delphij@delphij.net>
15 years agoZero out stack memory before copying out to requesting process.
Jeffrey Hsu [Fri, 21 Apr 2006 19:43:58 +0000 (19:43 +0000)]
Zero out stack memory before copying out to requesting process.
NetBSD Security Advisory 2006-005:  minor stack information leak.
Same as NetBSD revs 1.35 and 1.36.  Originally reported by Xin Li.

15 years agom_free -> m_freem
Sepherosa Ziehau [Fri, 21 Apr 2006 13:01:34 +0000 (13:01 +0000)]
m_free -> m_freem

15 years agoIntroduce a new variable to hold the size of buf.
Joerg Sonnenberger [Tue, 18 Apr 2006 22:11:35 +0000 (22:11 +0000)]
Introduce a new variable to hold the size of buf.

15 years agoAdd missing cm(4), mn(4) and my(4) manual pages.
Sascha Wildner [Mon, 17 Apr 2006 21:32:57 +0000 (21:32 +0000)]
Add missing cm(4), mn(4) and my(4) manual pages.

Taken-from: FreeBSD

15 years agoSync with FreeBSD's rev. 1.7.
Sascha Wildner [Mon, 17 Apr 2006 20:13:57 +0000 (20:13 +0000)]
Sync with FreeBSD's rev. 1.7.

15 years agoAssorted .Xr fixes:
Sascha Wildner [Mon, 17 Apr 2006 18:01:38 +0000 (18:01 +0000)]
Assorted .Xr fixes:

* Add section numbers and fix wrong ones.

* Use .Em, .Nm and .Pa instead of .Xr where appropriate.

* Fix obsolete references.

* Fix typos.

15 years agoWe use RCNG for restarting.
Sascha Wildner [Mon, 17 Apr 2006 17:52:17 +0000 (17:52 +0000)]
We use RCNG for restarting.

15 years agos/ndc/rndc/
Sascha Wildner [Mon, 17 Apr 2006 17:51:37 +0000 (17:51 +0000)]

15 years agoChange some documentation mentioning ports to pkgsrc.
Sascha Wildner [Mon, 17 Apr 2006 17:40:34 +0000 (17:40 +0000)]
Change some documentation mentioning ports to pkgsrc.

15 years agoRemove sysinstall(8) reference and fix wording.
Sascha Wildner [Mon, 17 Apr 2006 17:34:21 +0000 (17:34 +0000)]
Remove sysinstall(8) reference and fix wording.

15 years agoBring in some small changes from FreeBSD.
Matthew Dillon [Mon, 17 Apr 2006 15:59:55 +0000 (15:59 +0000)]
Bring in some small changes from FreeBSD.

-  Close a very small race with command hand-off.  Add an extra diagnostic
   to the timeout code.
- Fix a potential adapter deadlock/panic.
- Add support for a few cards

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

15 years agoAdd MLINK for rc.d(8).
Sascha Wildner [Sat, 15 Apr 2006 07:44:48 +0000 (07:44 +0000)]
Add MLINK for rc.d(8).

15 years agoGenerate a host-unreachable failure rather then a crash if the MTU is too
Matthew Dillon [Fri, 14 Apr 2006 21:18:24 +0000 (21:18 +0000)]
Generate a host-unreachable failure rather then a crash if the MTU is too
small to support the required TCP/IP/IPSEC options.

Reported-by: Johannes Hofmann <Johannes.Hofmann@gmx.de>
15 years agoRecent bug fixes make this worthy for testing, update to 1.5.3 and slip the
Matthew Dillon [Fri, 14 Apr 2006 21:06:35 +0000 (21:06 +0000)]
Recent bug fixes make this worthy for testing, update to 1.5.3 and slip the
Preview tag.

15 years agoFix a bug in the pkg_add -n tests where pkg_add was incorrectly reporting
Matthew Dillon [Fri, 14 Apr 2006 20:56:53 +0000 (20:56 +0000)]
Fix a bug in the pkg_add -n tests where pkg_add was incorrectly reporting
conflicts with the machine's currently installed package set.

Update the installer to fix a segfault-on-install bug due to the code
incorrectly assuming that dirname() returned malloc()'d memory that the
caller must free.

The installed /etc will have a proper aliases.db (sendmail) file, fixing
a syslog warning from sendmail.

15 years agoConditionalize a lwkt_send_ipiq2() to fix the UP build.
Matthew Dillon [Fri, 14 Apr 2006 20:08:34 +0000 (20:08 +0000)]
Conditionalize a lwkt_send_ipiq2() to fix the UP build.

15 years agoAlways guarentee at least one space between two network addresses.
Matthew Dillon [Fri, 14 Apr 2006 16:48:27 +0000 (16:48 +0000)]
Always guarentee at least one space between two network addresses.
Otherwise IPV6 addresses will abut each other.

Submitted-by: Francis Gudin <fgudin@nerim.net>
15 years ago* Comment out reference to non-existing format command.
Sascha Wildner [Fri, 14 Apr 2006 05:45:15 +0000 (05:45 +0000)]
* Comment out reference to non-existing format command.

* Fix wording.

Taken-from: FreeBSD

15 years agoFix an edge case where objects can be returned to a per-cpu cache while
Matthew Dillon [Fri, 14 Apr 2006 02:58:49 +0000 (02:58 +0000)]
Fix an edge case where objects can be returned to a per-cpu cache while
the objcache is blocked on the depot token.  the depot is found to be
exhausted and objcache blocks anyway.  Rechecking the per-cpu cache after
obtaining the token deals with the problem.

Normally this isn't a problem but on low-memory machines the objcache
is tight enough on memory that the returned objects could represent all
returnable objects at that time and a tsleep without checking for their
presence would block the calling thread forever.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
Also-thanks-to: Peter Holms filesystem and load testing suite (stress2).

15 years agovop_stdopen() must be called when a fifo_open fails in order to then be
Matthew Dillon [Fri, 14 Apr 2006 01:07:38 +0000 (01:07 +0000)]
vop_stdopen() must be called when a fifo_open fails in order to then be
able to call VOP_CLOSE().  Otherwise the opencount or writecount gets out
of synch and causes a panic.

Reported-by: "David Rhodus" <drhodus@machdep.com>
15 years agoFix a livelock in the objcache blocking code. PCATCH was being improperly
Matthew Dillon [Fri, 14 Apr 2006 01:06:21 +0000 (01:06 +0000)]
Fix a livelock in the objcache blocking code.  PCATCH was being improperly
passed to tsleep.

Fix harmless but inefficient wakeups in the objcache code.  When a thread
blocks on the objcache it tsleep's on the depot.  When objects are returned
to the objcache a wakeup is performed on the depot.  However, objects can
be returned to the depot OR returned to the current cpu's cache.  When an
object is returned to the current cpu's cache, only wakeup threads blocked
on the depot originating from the current cpu, rather then all cpus.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
Also-thanks-to: Peter Holms filesystem and load testing suite (stress2).

15 years agoSupply version of wakeup() which only operate on threads blocked on the
Matthew Dillon [Fri, 14 Apr 2006 01:00:16 +0000 (01:00 +0000)]
Supply version of wakeup() which only operate on threads blocked on the
same cpu, or on a particular cpu.

15 years agoIf a process forks while being scanned, a non-zero p_lock will be inherited
Matthew Dillon [Fri, 14 Apr 2006 00:59:05 +0000 (00:59 +0000)]
If a process forks while being scanned, a non-zero p_lock will be inherited
by the child process preventing it from being able to exit.  Make sure that
p_lock is zero'd on fork.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
Also-thanks-to: Peter Holms filesystem and load testing suite (stress2).

15 years agoNTFS sometimes splits the initialization of a new vnode into two parts.
Matthew Dillon [Thu, 13 Apr 2006 19:25:09 +0000 (19:25 +0000)]
NTFS sometimes splits the initialization of a new vnode into two parts.
Make sure VMIO is enabled for regular files so BUF/BIO ops work in the
second part as VREG might not be set in the first part.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
15 years agoAdd gbk.5 to the Makefile (forgotten when it was moved here).
Sascha Wildner [Thu, 13 Apr 2006 18:41:05 +0000 (18:41 +0000)]
Add gbk.5 to the Makefile (forgotten when it was moved here).

15 years agoSeperate _mutex_cv_unlock from _mutex_unlock_common.
David Xu [Thu, 13 Apr 2006 11:53:39 +0000 (11:53 +0000)]
Seperate _mutex_cv_unlock from _mutex_unlock_common.

15 years agonamespace cleanup.
David Xu [Thu, 13 Apr 2006 11:48:35 +0000 (11:48 +0000)]
namespace cleanup.

15 years ago1) Use int for m_flags of pthread_mutexattr.
David Xu [Thu, 13 Apr 2006 11:48:01 +0000 (11:48 +0000)]
1) Use int for m_flags of pthread_mutexattr.
2) Move up COND_FLAGS.
3) Remove some unused flags.
4) Remove unused arg_attr of pthread_cleanup.
5) Remove unused pthread_wait_data.

15 years agoFor symmetry's sake, put as(1) into the amd64 Makefile, too.
Sascha Wildner [Wed, 12 Apr 2006 19:39:55 +0000 (19:39 +0000)]
For symmetry's sake, put as(1) into the amd64 Makefile, too.

15 years agoMerge from vendor branch BINUTILS:
Sascha Wildner [Wed, 12 Apr 2006 19:21:23 +0000 (19:21 +0000)]
Merge from vendor branch BINUTILS:
Add as(1) manual page.

15 years agoAdd as(1) manual page.
Sascha Wildner [Wed, 12 Apr 2006 19:21:23 +0000 (19:21 +0000)]
Add as(1) manual page.

15 years agoAdd as(1) manual page.
Sascha Wildner [Wed, 12 Apr 2006 19:21:23 +0000 (19:21 +0000)]
Add as(1) manual page.

15 years agoNote: the previous rev's CVS comment was messed up due to an editor snafu.
Matthew Dillon [Wed, 12 Apr 2006 18:28:30 +0000 (18:28 +0000)]
Note: the previous rev's CVS comment was messed up due to an editor snafu.

/dev/random was almost always returning 0 bytes.  This was due to several
factors, primarily the fact that the stack smash handler reads 32 bytes from
/dev/urandom every time a program is exec'd, and because /dev/random and
/dev/urandom share the same pool.

* Give /dev/random and /dev/urandom their own separate pools.

* Be slightly less conservative on the number of bits of randomness we
  think we've added.

* extract_entropy() calls add_timer_randomness(), which adds entropy.  This
  can create a situation where entropy always appears to be available when,
  in fact, it is of very low quality.  Add a little hysteresis so degenerate
  cases return 0 bytes instead of 1 byte.

* Also (in this commit) fix a bug in the previous commit where the randomness
  added was accidently halved.

Reported-by: David Rhodus
15 years ago/dev/random was almost always returning 0 bytes. This was due to several
Matthew Dillon [Wed, 12 Apr 2006 18:20:54 +0000 (18:20 +0000)]
/dev/random was almost always returning 0 bytes.  This was due to several
factors, primarily the fact that the stack smash handler reads 32 bytes from
/dev/urandom every time a program is exec'd, and because /dev/random and
/dev/urandom share the same pool.

involved:  (1) The stack smash handler reads 32 bytes from /dev/urandom every
time a program is exec'd.  This exhausts the pool almost immediately.
(2) /dev/random and /dev/urandom share the same pool, and /dev/urandom is
called so often that there is never any entropy available for /dev/random.

Give /dev/random and /dev/urandom separate entropy pools and make the entropy
loss calculation less conservative.

Reported-by: David Rhodus
15 years agolinux(4) was added in Sep 2003 but never made it into the Makefile.
Sascha Wildner [Wed, 12 Apr 2006 13:10:16 +0000 (13:10 +0000)]
linux(4) was added in Sep 2003 but never made it into the Makefile.

15 years agoMerge bug fix from binutils main line:
Joerg Sonnenberger [Tue, 11 Apr 2006 12:14:01 +0000 (12:14 +0000)]
Merge bug fix from binutils main line:
When a thread local symbol is accessed both from PIC and
non-PIC code, ld incorrectly merged both entries in the main
program, ignoring the different relocation offsets. This occured
originally in dbus-0.61 and showed itself in segfaults within rtld.

MFC after 3 days

15 years agoDocument that the caret works like the excalamation mark
Jeremy C. Reed [Tue, 11 Apr 2006 11:57:00 +0000 (11:57 +0000)]
Document that the caret works like the excalamation mark
for inverting the set.

This code was added in FreeBSD src/bin/sh/expand.c revision 1.19
(Jun. 6 1997).

(Maybe should say "inverted" instead of mathematical "complemented"?)

15 years agoin_ifadown() was only cleaning up the route table on the originating cpu,
Matthew Dillon [Tue, 11 Apr 2006 06:59:36 +0000 (06:59 +0000)]
in_ifadown() was only cleaning up the route table on the originating cpu,
it needs to clean up the route table on ALL cpus.  This routine is
called when an interface is brought down, typically during a reinitialization
of the interface's IP address(es).  An example of this would be if
DHCP were re-run on an interface by killing dhclient and re-running it.

Change in_ifadown() to iterate over all cpu's route tables.

Reported-by: multiple people
15 years agoCalculate the correct buffer size when reading a symlink via NFS.
Matthew Dillon [Mon, 10 Apr 2006 17:46:44 +0000 (17:46 +0000)]
Calculate the correct buffer size when reading a symlink via NFS.

Reported-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk>
15 years agoImprove portability of patch(1):
Joerg Sonnenberger [Mon, 10 Apr 2006 08:11:43 +0000 (08:11 +0000)]
Improve portability of patch(1):
- basename(3) and dirname(3) can either return a pointer to
  static storage (like on all BSDs) or modify the argument
  (like on Linux). strdup the argument to support both.
- fix argument range of ctype macros.

15 years agoRemove debugging printfs.
Matthew Dillon [Sun, 9 Apr 2006 20:47:56 +0000 (20:47 +0000)]
Remove debugging printfs.

Reported-by: Csaba Henk <csaba.henk@creo.hu>
15 years agoFix one place where the superblock was being read (and written) at the
Matthew Dillon [Sun, 9 Apr 2006 20:07:43 +0000 (20:07 +0000)]
Fix one place where the superblock was being read (and written) at the
wrong offset (due to the recent BUF/BIO work), and normalize all superblock
ops to use SBOFF.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
15 years agoFollowup last commit, fix missing argument to vinitvmio().
Matthew Dillon [Sun, 9 Apr 2006 17:56:48 +0000 (17:56 +0000)]
Followup last commit, fix missing argument to vinitvmio().

15 years agoGet rid of bogus 'pushing active' reports. Initialize a VM object for VREG
Matthew Dillon [Sun, 9 Apr 2006 17:51:28 +0000 (17:51 +0000)]
Get rid of bogus 'pushing active' reports.  Initialize a VM object for VREG

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
15 years agoThere are no manual pages for hosts.allow and hosts.deny.
Sascha Wildner [Sat, 8 Apr 2006 21:57:05 +0000 (21:57 +0000)]
There are no manual pages for hosts.allow and hosts.deny.

Use .Pa for filenames and fix references.

15 years agos/pthread_mutex_create/pthread_mutex_init/
Sascha Wildner [Sat, 8 Apr 2006 20:55:59 +0000 (20:55 +0000)]

15 years agoAdd MLINKS for all functions.
Sascha Wildner [Sat, 8 Apr 2006 20:16:45 +0000 (20:16 +0000)]
Add MLINKS for all functions.

15 years agoAdd missing isnormal(3) manual page.
Sascha Wildner [Sat, 8 Apr 2006 14:12:36 +0000 (14:12 +0000)]
Add missing isnormal(3) manual page.

15 years agoThe new bridge(4) manual page somehow never found its way into the Makefile.
Sascha Wildner [Sat, 8 Apr 2006 12:48:16 +0000 (12:48 +0000)]
The new bridge(4) manual page somehow never found its way into the Makefile.

15 years agoRemove references to multibyte(3) which is no longer there.
Sascha Wildner [Sat, 8 Apr 2006 08:57:00 +0000 (08:57 +0000)]
Remove references to multibyte(3) which is no longer there.

15 years agoAdd section numbers to references and fix .Xr abuse
Sascha Wildner [Sat, 8 Apr 2006 08:17:07 +0000 (08:17 +0000)]
Add section numbers to references and fix .Xr abuse

15 years agoUse .St for references to standards.
Sascha Wildner [Sat, 8 Apr 2006 07:23:35 +0000 (07:23 +0000)]
Use .St for references to standards.

15 years agoPut the 'V' option back in.
Sascha Wildner [Fri, 7 Apr 2006 16:44:51 +0000 (16:44 +0000)]
Put the 'V' option back in.

It was accidentally removed with the last commit.

Submitted-by: Kevin L. Kane <kevin.kane@gmail.com>
15 years agoUse the branch prediction macros in sys/cdefs.h.
David Xu [Fri, 7 Apr 2006 14:11:22 +0000 (14:11 +0000)]
Use the branch prediction macros in sys/cdefs.h.

15 years agoAdd compiler branch prediction hint macros, obtained from FreeBSD.
David Xu [Fri, 7 Apr 2006 14:09:59 +0000 (14:09 +0000)]
Add compiler branch prediction hint macros, obtained from FreeBSD.

15 years agoTweak source code a bit to make gcc to generate better code.
David Xu [Fri, 7 Apr 2006 13:53:50 +0000 (13:53 +0000)]
Tweak source code a bit to make gcc to generate better code.
Update copyright.

15 years agoMore mdoc cleanup.
Sascha Wildner [Fri, 7 Apr 2006 09:57:37 +0000 (09:57 +0000)]
More mdoc cleanup.

15 years agoDue to continuing issues with VOP_READ/VOP_WRITE ops being called without
Matthew Dillon [Fri, 7 Apr 2006 06:38:33 +0000 (06:38 +0000)]
Due to continuing issues with VOP_READ/VOP_WRITE ops being called without
a VOP_OPEN, particularly by NFS, redo the way VM objects are associated
with vnodes.

* The size of the object is now passed to vinitvmio().  vinitvmio() no
  longer calls VOP_GETATTR().

* Instead of trying to call vinitvmio() conditionally in various places,
  we now call it unconditionally when a vnode is instantiated if
  the filesystem at any time in the future intends to use the buffer
  cache to access that vnode's dataspace.

* Specfs 'disk' devices are an exception.  Since we cannot safely do I/O
  on such vnodes if they have not been VOP_OPEN()'ed anyhow, the VM objects
  for those vnodes are still only associated on open.

The performance impact is limited to the case where large numbers of vnodes
are being created and destroyed.  This case only occurs when a large
directory topology (number of files > kernel's vnode cache) is traversed
and all related inodes are cached by the system.  Being a pure-cpu case
the slight loss of performance due to the VM object allocations is
not really a big dael.

15 years agoUnlock recursive mutex in pthread_cond_wait, though this is arguable.
David Xu [Thu, 6 Apr 2006 23:50:13 +0000 (23:50 +0000)]
Unlock recursive mutex in pthread_cond_wait, though this is arguable.

15 years ago* Add documentation for the batch and lastcpu keywords.
Sascha Wildner [Thu, 6 Apr 2006 17:26:54 +0000 (17:26 +0000)]
* Add documentation for the batch and lastcpu keywords.

* Remove documentation for the poip, uprocp and upr keywords.

* Update the flags description from proc.h.

* General mdoc overhaul.

* Add a HISTORY section (taken from FreeBSD).

There's probably more work to be done here.

15 years agoChange forgotten getinoquota to ext2_getinoquota to fix building
Sascha Wildner [Thu, 6 Apr 2006 17:04:30 +0000 (17:04 +0000)]
Change forgotten getinoquota to ext2_getinoquota to fix building
with 'options QUOTA'.

15 years agos/long/int
David Xu [Thu, 6 Apr 2006 13:05:35 +0000 (13:05 +0000)]

15 years agoWARNS level 4 cleanup.
David Xu [Thu, 6 Apr 2006 13:03:09 +0000 (13:03 +0000)]
WARNS level 4 cleanup.

15 years agoAdd all pthread functions into libc namespace.
David Xu [Thu, 6 Apr 2006 13:02:12 +0000 (13:02 +0000)]
Add all pthread functions into libc namespace.

15 years agoAdd function prototypes: pthread_atfork, pthread_attr_getguardsize,
David Xu [Thu, 6 Apr 2006 13:00:44 +0000 (13:00 +0000)]
Add function prototypes: pthread_atfork, pthread_attr_getguardsize,

15 years agoSynchronize vinitvmio() calls from UFS to EXT2FS.
Matthew Dillon [Wed, 5 Apr 2006 21:06:22 +0000 (21:06 +0000)]
Synchronize vinitvmio() calls from UFS to EXT2FS.

Reported-by: Csaba Henk <csaba.henk@creo.hu>
15 years agoUnconditionally initialize a VM object for a directory vnode. Continue
Matthew Dillon [Wed, 5 Apr 2006 20:22:30 +0000 (20:22 +0000)]
Unconditionally initialize a VM object for a directory vnode.  Continue
to try to optimize (skip) initialization for file vnodes that are only

15 years agoMove some global variables into its module, remove priority mutex code
David Xu [Wed, 5 Apr 2006 12:12:23 +0000 (12:12 +0000)]
Move some global variables into its module, remove priority mutex code
which does not work correctly.

15 years agoUnbreak buildworld.
David Xu [Wed, 5 Apr 2006 06:53:27 +0000 (06:53 +0000)]
Unbreak buildworld.

15 years agoPull in all symbols needed for static binary.
David Xu [Wed, 5 Apr 2006 00:48:50 +0000 (00:48 +0000)]
Pull in all symbols needed for static binary.

15 years agoConvert weak reference to strong reference so that static library
David Xu [Wed, 5 Apr 2006 00:24:36 +0000 (00:24 +0000)]
Convert weak reference to strong reference so that static library
will work better.

15 years agoTransplant all the UFS ops that EXT2 used to call into the EXT2 tree and
Matthew Dillon [Tue, 4 Apr 2006 17:34:32 +0000 (17:34 +0000)]
Transplant all the UFS ops that EXT2 used to call into the EXT2 tree and
reconnect it to the build.  Recent BUF/BIO work made most of the UFS tree
incompatible with EXT2FS.

Reported-by: Csaba Henk <csaba.henk@creo.hu>
15 years agoProperly calculate the ronly flag at unmount time.
Matthew Dillon [Tue, 4 Apr 2006 16:50:44 +0000 (16:50 +0000)]
Properly calculate the ronly flag at unmount time.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
15 years agoUpdate UMTX_LOCKED and add UMTX_CONTESTED macro.
David Xu [Tue, 4 Apr 2006 14:23:04 +0000 (14:23 +0000)]
Update UMTX_LOCKED and add UMTX_CONTESTED macro.

15 years agoRevamp the algorithm to acquire a contested lock, the intention
David Xu [Tue, 4 Apr 2006 14:04:39 +0000 (14:04 +0000)]
Revamp the algorithm to acquire a contested lock, the intention
is to reduce cache line ownership transfering on many-cpu system.

15 years agoBecause multiple opens of /dev/tty only issue one actual open to the
Matthew Dillon [Mon, 3 Apr 2006 21:32:23 +0000 (21:32 +0000)]
Because multiple opens of /dev/tty only issue one actual open to the
underlying tty, unconditionally use FREAD|FWRITE for the VOP_OPEN/VOP_CLOSE
calls.  Otherwise the modes may not match up on final close.

Unconditionally reference the underlying tty when obtaining the lock for a
read or write of /dev/tty.  If we do not do this then it is possible for
the session reference to be ripped out from under us while we are obtaining
the lock and for the vnode to be reused for another purpose without our

Reported-by: Kyle Butt <kylebutt@gmail.com>
15 years agoufs_readdir() can be called from NFS with the vnode being opened, create
Matthew Dillon [Mon, 3 Apr 2006 02:18:22 +0000 (02:18 +0000)]
ufs_readdir() can be called from NFS with the vnode being opened, create
a VM object if necessary.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
15 years agoA number of structures related to UFS and QUOTAS have changed name.
Matthew Dillon [Mon, 3 Apr 2006 02:02:37 +0000 (02:02 +0000)]
A number of structures related to UFS and QUOTAS have changed name.

dinode -> ufs1_dinode
dqblk -> ufs_dqblk (and other quota related structures)

In addition, a large number of UFS related structures and procedures have
been prefixed with 'ufs_' to allow us to split off EXT2FS.

ufs_daddr_t has been moved out of sys/types.h and into vfs/ufs/dinode.h.

The #ifndef header file checks for UFS have been normalized.

15 years agoA number of structures related to UFS and QUOTAS have changed name.
Matthew Dillon [Mon, 3 Apr 2006 01:59:28 +0000 (01:59 +0000)]
A number of structures related to UFS and QUOTAS have changed name.

dinode -> ufs1_dinode
dqblk -> ufs_dqblk (and other quota related structures)

15 years agoA number of structures related to UFS and QUOTAS have changed name.
Matthew Dillon [Mon, 3 Apr 2006 01:58:49 +0000 (01:58 +0000)]
A number of structures related to UFS and QUOTAS have changed name.

dinode -> ufs1_dinode
dqblk -> ufs_dqblk (and other quota related structures)

15 years agoDocument the use of SDT_SYS386IGT vs SDT_SYS386TGT when setting up the
Matthew Dillon [Sun, 2 Apr 2006 20:50:33 +0000 (20:50 +0000)]
Document the use of SDT_SYS386IGT vs SDT_SYS386TGT when setting up the
hardware exception table.

15 years agoA floating point fault (instead of DNA fault) can occur when the TS bit
Matthew Dillon [Sun, 2 Apr 2006 20:43:27 +0000 (20:43 +0000)]
A floating point fault (instead of DNA fault) can occur when the TS bit
in CR0 is clear and will call npx_intr().  However, because we are using
a trap exception vector this fault does not disable interrupts and it is
possible for a preemption to come along after the fault is dispatched
before but npx_intr() has time to do anything.  This preemption can wind
up changing the FP state, causing npx_intr() to hit an assertion and panic
the machine.

Keep using the interrupt-enabled version of the vector (SDT_SYS386TGT
instead of SDT_SYS386IGT), but adjust npx_intr() to enter a critical
section to avoid getting the FP state ripped out from under it, then have
it check for the race case and call npxdna() as appropriate.  Document the
whole mess.

Reported-by: Sascha Wildner <saw@online.de>
Found-with: sysutils/crashme using crashme +2000 666 100 1:00:00 5

15 years agoSmall comma fixes.
Sascha Wildner [Sun, 2 Apr 2006 17:24:56 +0000 (17:24 +0000)]
Small comma fixes.

15 years agoUse .Cd for kernel options.
Sascha Wildner [Sun, 2 Apr 2006 16:50:05 +0000 (16:50 +0000)]
Use .Cd for kernel options.

15 years agoAdd a SYNOPSIS section and put the kernel config option there.
Sascha Wildner [Sun, 2 Apr 2006 08:42:30 +0000 (08:42 +0000)]
Add a SYNOPSIS section and put the kernel config option there.

15 years agoufs_dirempty() issues I/O on the directory vnode and needs to make sure
Matthew Dillon [Sun, 2 Apr 2006 04:13:40 +0000 (04:13 +0000)]
ufs_dirempty() issues I/O on the directory vnode and needs to make sure
that it has an associated VM object.

15 years agoBring in new ifconfig(8) from FreeBSD6. It is more modular and flexible with
Sepherosa Ziehau [Sun, 2 Apr 2006 03:33:59 +0000 (03:33 +0000)]
Bring in new ifconfig(8) from FreeBSD6.  It is more modular and flexible with
respect to supporting interface specific functionality.

Thank Sam Leffler and many other people for their work on ifconfig(8)

- There is no noticeable changes from users' point of view
- Three files have been left out: ifmac.c, ifcarp.c, ifpfsync.c
- Old ifieee80211.c is adapted to fit in the new ifconfig(8), newer one will
  be imported with the updating of netproto/802_11

Submitted-by: Andrew Atrens <atrens@nortel.com>
      Adrian Michael Nida <nida@musc.edu>

15 years agoGive the MFS pseudo block device vnode a VM object, as is now required
Matthew Dillon [Sun, 2 Apr 2006 01:35:34 +0000 (01:35 +0000)]
Give the MFS pseudo block device vnode a VM object, as is now required
for buffer cache operations.  Do not try to optimize it for now
(i.e. MFS will still double-cache everything).

15 years agoRequire that *ALL* vnode-based buffer cache ops be backed by a VM object.
Matthew Dillon [Sat, 1 Apr 2006 22:20:19 +0000 (22:20 +0000)]
Require that *ALL* vnode-based buffer cache ops be backed by a VM object.
No exceptions.  Start simplifying the getblk() based on the new requirements.

15 years agoClone cd9660_blkatoff() into a new procedure, cd9660_devblkatoff(), which
Matthew Dillon [Sat, 1 Apr 2006 21:55:13 +0000 (21:55 +0000)]
Clone cd9660_blkatoff() into a new procedure, cd9660_devblkatoff(), which
returns a devvp-relative buffer rather then the vp-relative buffer.  This
allows us to access meta-data relative to a vnode without having to
instantiate a VM object for that vnode.  The new function is used for
all directory scans and (negative offset) meta-data access.

This fixes a panic due to recent buffer cache commits that formalized
the requirements for using the buffer cache.

Also, prior to this change, the CD9660 filesystem was using B_MALLOC buffers
for a great deal of meta-data access that could very easily have been backed
by the device vnode's VM object instead.  B_MALLOC buffers have severe
caching limitations.  This commit fixes all of that as well.

15 years agoUse the vnode v_opencount and v_writecount universally. They were previously
Matthew Dillon [Sat, 1 Apr 2006 20:46:54 +0000 (20:46 +0000)]
Use the vnode v_opencount and v_writecount universally.  They were previously
only used by specfs.  Require that VOP_OPEN and VOP_CLOSE calls match.
Assert on boundary errors.

Clean up umount's FORCECLOSE mode.  Adjust deadfs to allow duplicate closes
(which can happen due to a forced unmount or revoke).

Add vop_stdopen() and vop_stdclose() and adjust the default vnode ops to
call them.  All VFSs except DEADFS which supply their own vop_open and
vop_close now call vop_stdopen() and vop_stdclose() to handle v_opencount
and v_writecount adjustments.

Change the VOP_OPEN/fp specs.  VOP_OPEN (aka vop_stdopen) is now responsible
for filling in the file pointer information, rather than the caller of
VOP_OPEN.  Additionally, when supplied a file pointer, VOP_OPEN is now
allowed to populate the file pointer with a different vnode then the one
passed to it, which will be used later on to allow filesystems which
synthesize different vnodes on open, for example so we can create a generic
tty/pty pairing devices rather than scanning for an unused pty, and so we
can create swap-backed generic anonymous file descriptors rather than having
to use /tmp.  And for other purposes as well.

Fix UFS's mount/remount/unmount code to make the proper VOP_OPEN and
VOP_CLOSE calls when a filesystem is remounted read-only or read-write.

15 years agoRemove owi(4) from build.
Sascha Wildner [Sat, 1 Apr 2006 10:08:36 +0000 (10:08 +0000)]
Remove owi(4) from build.