]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
16 years ago- In all structures other than port info port is a pointer to a port info,
kmacy [Fri, 10 Aug 2007 23:33:34 +0000 (23:33 +0000)]
- In all structures other than port info port is a pointer to a port info,
  make the code less confusing by renaming the port number to port_id

Approved by: re (blanket)

16 years agoMFp4:
delphij [Fri, 10 Aug 2007 11:00:30 +0000 (11:00 +0000)]
MFp4:
 - LK_RETRY prohibits vget() and vn_lock() to return error.
   Remove associated code. [1]
 - Properly use vhold() and vdrop() instead of their unlocked
   versions, we are guaranteed to have the vnode's interlock
   unheld. [1]
 - Fix a pseudo-infinite loop caused by 64/32-bit arithmetic
   with the same way used in modern NetBSD versions. [2]
 - Reorganize tmpfs_readdir to reduce duplicated code.

Submitted by: kib [1]
Obtained from: NetBSD [2]
Approved by: re (tmpfs blanket)

16 years agoNew regression test updates for rename, etc.
delphij [Fri, 10 Aug 2007 10:08:43 +0000 (10:08 +0000)]
New regression test updates for rename, etc.

Obtained from: NetBSD
Approved by: re (tmpfs blanket)

16 years agoFix fscking gjournaled root file system: root file system is already mounted
pjd [Fri, 10 Aug 2007 06:29:54 +0000 (06:29 +0000)]
Fix fscking gjournaled root file system: root file system is already mounted
read-only, so we can't simply exit right after calling gjournal_check(),
instead we need to ask about super block reload.

Submitted by: Niki Denev <niki@totalterror.net>
PR: misc/113889
Approved by: re (kensmith)

16 years agoMFp4:
delphij [Fri, 10 Aug 2007 05:24:49 +0000 (05:24 +0000)]
MFp4:

 - Respect cnflag and don't lock vnode always as LK_EXCLUSIVE [1]
 - Properly lock around tn_vnode to avoid NULL deference
 - Be more careful handling vnodes (*)

(*) This is a WIP
[1] by pjd via howardsu

Thanks kib@ for his valuable VFS related comments.

Tested with: fsx, fstest, tmpfs regression test set
Found by: pho's stress2 suite
Approved by: re (tmpfs blanket)

16 years agoCorrections and clarifications
julian [Thu, 9 Aug 2007 21:09:56 +0000 (21:09 +0000)]
Corrections and clarifications

Approved by: re (bmah)

16 years agoAdd "show sysregs" command to ddb. On i386, this gives gdt, idt, ldt,
njl [Thu, 9 Aug 2007 20:14:35 +0000 (20:14 +0000)]
Add "show sysregs" command to ddb.  On i386, this gives gdt, idt, ldt,
cr0-4, etc.  Support should be added for other platforms that have a
different set of registers for system use.

Loosely based on: OpenBSD
Approved by: re

16 years agoMFP4(123963): Fixing a possible NULL pointer dereference by making
avatar [Thu, 9 Aug 2007 13:29:26 +0000 (13:29 +0000)]
MFP4(123963): Fixing a possible NULL pointer dereference by making
the actual assignment after the NULL check.

Found by: Coverity Prevent(tm)
CID: 2303 (run 4156)
Reviewed by: sam
Approved by: re (bmah)

16 years ago- Renaming repocopied cached to nscd
bushman [Thu, 9 Aug 2007 13:06:12 +0000 (13:06 +0000)]
- Renaming repocopied cached to nscd

Approved by: re (kensmith), brooks (mentor)

16 years agoUse the .S version for now. I have a version optimized for size p4,
imp [Thu, 9 Aug 2007 05:16:55 +0000 (05:16 +0000)]
Use the .S version for now.  I have a version optimized for size p4,
but I'm unsure of its provenance, so rather than add it here, revert
the migration to it.

Approved by: re@ (blanket)

16 years agoMerge in the AX88178 and AX88772 register definions (along with
imp [Thu, 9 Aug 2007 04:40:07 +0000 (04:40 +0000)]
Merge in the AX88178 and AX88772 register definions (along with
rename) from OpenBSD.  This also dribbles in a few fields from OpenBSD
as well.

Approved by: re@ (blanket)
Obtained from: OpenBSD

16 years agoCompile ipfilter:ip_lookup.c without -Werror. The file contains
marcel [Thu, 9 Aug 2007 01:11:21 +0000 (01:11 +0000)]
Compile ipfilter:ip_lookup.c without -Werror. The file contains
a test that assumes that char is signed by default and causes a
warning with GCC 4.2 on PowerPC.
A patch has been sent to the maintainer that addresses this.

Approved by: re (blanket)

16 years agoKeep the snmp_bridge(3) module up to date with if_bridge(4) and add an
syrinx [Wed, 8 Aug 2007 19:27:50 +0000 (19:27 +0000)]
Keep the snmp_bridge(3) module up to date with if_bridge(4) and add an
object to control the value of the new 'PRIVATE' bridge members' flag.
While here, remove stale '__unused' compiler directives.

Reviewed by: bz
Approved by: re (bmah), bz (mentor)

16 years agoRe-enable -Werror for PowerPC. This should really be unconditional again.
marcel [Wed, 8 Aug 2007 19:12:06 +0000 (19:12 +0000)]
Re-enable -Werror for PowerPC. This should really be unconditional again.

Approved by: re (blanket)

16 years agoOoops, we need to define TD_LOCK here.
cognet [Wed, 8 Aug 2007 09:27:52 +0000 (09:27 +0000)]
Ooops, we need to define TD_LOCK here.

Approved by: re (blanket)
Pointy hat to: cognet

16 years agoRe-enable external interrupts for faults, traps and syscalls.
marcel [Wed, 8 Aug 2007 01:19:12 +0000 (01:19 +0000)]
Re-enable external interrupts for faults, traps and syscalls.

Approved by: re (blanket)

16 years agoThe PowerPC specific header interruptvar.h has been removed.
marcel [Tue, 7 Aug 2007 23:48:30 +0000 (23:48 +0000)]
The PowerPC specific header interruptvar.h has been removed.

Approved by: re (blanket)

16 years agoEliminate <machine/interruptvar.h> as it has only a single
marcel [Tue, 7 Aug 2007 23:33:35 +0000 (23:33 +0000)]
Eliminate <machine/interruptvar.h> as it has only a single
prototype. In the future that prototype will not be needed
at all anyway, but for now it's moved to intr_machdep.h.

Approved by: re (blanket)

16 years agoWhen storing old versions of files for use in generating new files via
cperciva [Tue, 7 Aug 2007 19:33:46 +0000 (19:33 +0000)]
When storing old versions of files for use in generating new files via
patching and for rolling back updates, don't copy a file if it has already
been stored.  This provides a significant speedup to the "Preparing to
download files" stage of "freebsd-update fetch" if many updates have already
been applied or if a file being updated is linked many times (such as
/rescue/*).

Reported by: Paul Dekkers
MFC after: 1 week
Approved by: re (bmah)

16 years agoRemove redundant prototype.
marcel [Tue, 7 Aug 2007 18:40:02 +0000 (18:40 +0000)]
Remove redundant prototype.

Approved by: re (blanket)

16 years agoAdd prototype for trap().
marcel [Tue, 7 Aug 2007 18:39:28 +0000 (18:39 +0000)]
Add prototype for trap().

Approved by: re (blanket)

16 years agoAdd cast to silent gcc warnings.
cognet [Tue, 7 Aug 2007 18:37:21 +0000 (18:37 +0000)]
Add cast to silent gcc warnings.

Approved by: re (blanket)

16 years agoUse the third argument of cpu_switch(), as done for i386/amd63, as it is
cognet [Tue, 7 Aug 2007 18:20:55 +0000 (18:20 +0000)]
Use the third argument of cpu_switch(), as done for i386/amd63, as it is
required for ULE.

Approved by: re (blanket)

16 years agoProtect the creation of the device pager with the dev_pager_mtx. Lookup
kib [Tue, 7 Aug 2007 15:36:25 +0000 (15:36 +0000)]
Protect the creation of the device pager with the dev_pager_mtx. Lookup
of device pager in the pagers list by handle is now synchronized with
its removal from the list, and dev_pager_mtx is put before vm object
lock in lock order. Dispose the dev_pager_sx lock, since dev_pager_mtx
now covers the same block.

Noted by: kensmith
Reviewed by: alc
Approved by: re (kensmith)

16 years agoo Indent "DragonFly".
maxim [Tue, 7 Aug 2007 15:35:24 +0000 (15:35 +0000)]
o Indent "DragonFly".

Approved by: re (bmah)

16 years agoo DragonFlyBSD 1.10.0 added.
maxim [Tue, 7 Aug 2007 15:34:24 +0000 (15:34 +0000)]
o DragonFlyBSD 1.10.0 added.

Approved by: re (bmah)
MFC after: 1 week

16 years agoUse ioctl() to get correct media size so that we can locate
simokawa [Tue, 7 Aug 2007 12:42:03 +0000 (12:42 +0000)]
Use ioctl() to get correct media size so that we can locate
ZFS labels in the tail of the media.

Approved by: re (kensmith), pjd

16 years agoMFP4(123687): Closing another LOR by dropping the driver lock around calls
avatar [Tue, 7 Aug 2007 12:26:19 +0000 (12:26 +0000)]
MFP4(123687): Closing another LOR by dropping the driver lock around calls
to if_input().

Reviewed by: ambrisko
Tested by: dhw
Approved by: re (kensmith)

16 years agoIn msdosfs_read() and msdosfs_write(), don't check explicitly for
bde [Tue, 7 Aug 2007 10:35:27 +0000 (10:35 +0000)]
In msdosfs_read() and msdosfs_write(), don't check explicitly for
(uio_offset < 0) since this can't happen.  If this happens, then the
general code handles the problem safely (better than before for reading,
returning 0 (EOF) instead of the bogus errno EINVAL, and the same as
before for writing, returning EFBIG).

In msdosfs_read(), don't check for (uio_resid < 0).  msdosfs_write()
already didn't check.

In msdosfs_read(), document in a comment our assumptions that the caller
passed a valid uio_offset and uio_resid.  ffs checks using KASSERT(),
and that is enough sanity checking.  In the same comment, partly document
there is no need to check for the EOVERFLOW case, unlike in ffs where this
case can happen at least in theory.

In msdosfs_write(), add a comment about why the checking of
(uio_resid == 0) is explicit, unlike in ffs.

In msdosfs_write(), check for impossibly large final offsets before
checking if the file size rlimit would be exceeded, so that we don't
have an overflow bug in the rlimit check and are consistent with ffs.
We now return EFBIG instead of EFBIG plus a SIGXFSZ signal if the final
offset would be impossibly large but not so large as to cause overflow.
Overflow normally gave the benign behaviour of no signal.

Approved by: re (kensmith) (blanket)

16 years agoDo not call free() while holding vnode interlock.
kib [Tue, 7 Aug 2007 09:04:50 +0000 (09:04 +0000)]
Do not call free() while holding vnode interlock.

Reported and tested by: Peter Holm
Reviewed by: jeff
Approved by: re (kensmith)

16 years agoFix and update the comments about the effect of the read-only flag on writing.
bde [Tue, 7 Aug 2007 05:42:10 +0000 (05:42 +0000)]
Fix and update the comments about the effect of the read-only flag on writing.
They are still too verbose.

Remove nearby unreachable code for handling symlinks.

Approved by: re (kensmith) (blanket)

16 years agoOutput error message to STDERR_FILENO.
davidxu [Tue, 7 Aug 2007 04:50:14 +0000 (04:50 +0000)]
Output error message to STDERR_FILENO.

Approved by: re (bmah)

16 years agoFix some style bugs (don't assume that off_t == int64_t; fix some comments;
bde [Tue, 7 Aug 2007 03:59:49 +0000 (03:59 +0000)]
Fix some style bugs (don't assume that off_t == int64_t; fix some comments;
remove some parentheses; fix some whitespace errors; fix only one case of
a boolean comparison of a non-boolean).

Improve an error message by quoting ".", and by not printing large positive
values as negative ones.

Approved by: re (kensmith) (blanket)

16 years agoFix some style bugs (don't assume that off_t == int64_t; fix some comments;
bde [Tue, 7 Aug 2007 03:43:28 +0000 (03:43 +0000)]
Fix some style bugs (don't assume that off_t == int64_t; fix some comments;
remove some parentheses; fix only a couple of whtespace errors).

Approved by: re (kensmith) (blanket)

16 years agoFix some style bugs (mainly some whitespace errors).
bde [Tue, 7 Aug 2007 03:38:36 +0000 (03:38 +0000)]
Fix some style bugs (mainly some whitespace errors).

Approved by: re (kensmith) (blanket)

16 years agoFix some style bugs (some whitespace errors only).
bde [Tue, 7 Aug 2007 03:22:10 +0000 (03:22 +0000)]
Fix some style bugs (some whitespace errors only).

Approved by: re (kensmith) (blanket)

16 years agoSort includes.
bde [Tue, 7 Aug 2007 02:28:33 +0000 (02:28 +0000)]
Sort includes.

Remove rotted banal comment attached to includes.

Approved by: re (kensmith) (blanket)

16 years agoSort includes.
bde [Tue, 7 Aug 2007 02:27:35 +0000 (02:27 +0000)]
Sort includes.

Remove banal comments attached to includes.

Approved by: re (kensmith) (blanket)

16 years agoForced commit to note that the log message for the previous commit should
bde [Tue, 7 Aug 2007 02:25:56 +0000 (02:25 +0000)]
Forced commit to note that the log message for the previous commit should
have said "Sort" where it said "Remove unused".

Approved by: re (kensmith) (blanket)

16 years agoSort includes.
bde [Tue, 7 Aug 2007 02:20:37 +0000 (02:20 +0000)]
Sort includes.

Remove banal comments before includes.  Remove rotted banal comments attached
to includes.

Approved by: re (kensmith) (blanket)

16 years agoRemove unused include(s).
bde [Tue, 7 Aug 2007 02:11:16 +0000 (02:11 +0000)]
Remove unused include(s).

Remove banal comments before includes.

Approved by: re (kensmith) (blanket)

16 years agoRemove unused include(s).
bde [Tue, 7 Aug 2007 02:08:06 +0000 (02:08 +0000)]
Remove unused include(s).

Approved by: re (kensmith) (blanket)

16 years agoInclude <sys/mutex.h> and its prerequisite <sys/lock.h> instead of
bde [Tue, 7 Aug 2007 01:40:27 +0000 (01:40 +0000)]
Include <sys/mutex.h> and its prerequisite <sys/lock.h> instead of
depending on namespace pollution in <sys/buf.h> and/or <sys/vnode.h>

Approved by: re (kensmith) (blanket)

16 years agoInclude <sys/mutex.h>'s prerequisite <sys/lock.h> instead of depending on
bde [Tue, 7 Aug 2007 01:37:59 +0000 (01:37 +0000)]
Include <sys/mutex.h>'s prerequisite <sys/lock.h> instead of depending on
namespace pollution in <sys/vnode.h>.

Sort the include of <sys/mutex.h> instead of unsorting it after
<sys/vnode.h> and depending on the pollution there.

Approved by: re (kensmith) (blanket)

16 years agoRemove unused include(s).
bde [Tue, 7 Aug 2007 01:07:16 +0000 (01:07 +0000)]
Remove unused include(s).

Approved by: re (kensmith) (blanket)

16 years agoOver the past couple of years, there have been a number of reports relating
csjp [Mon, 6 Aug 2007 22:06:36 +0000 (22:06 +0000)]
Over the past couple of years, there have been a number of reports relating
the use of divert sockets to dead locks.  A number of LORs have been reported
between divert and a number of other network subsystems including: IPSEC, Pfil,
multicast, ipfw and others.  Other dead locks could occur because of recursive
entry into the IP stack.  This change should take care of most if not all of
these issues.

A summary of the changes follow:

- We disallow multicast operations on divert sockets.  It really doesn't make
  semantic sense to allow this, since typically you would set multicast
  parameters on multicast end points.

  NOTE: As a part of this change, we actually dis-allow multicast options on
  any socket that IS a divert socket OR IS NOT a SOCK_RAW or SOCK_DGRAM family

- We check to see if there are any socket options that have been specified on
  the socket, and if there was (which is very un-common and also probably
  doesnt make sense to support) we duplicate the mbuf carrying the options.

- We then drop the INP/INFO locks over the call to ip_output().  It should be
  noted that since we no longer support multicast operations on divert sockets
  and we have duplicated any socket options, we no longer need the reference
  to the pcb to be coherent.

- Finally, we replaced the call to ip_input() to use netisr queuing.  This
  should remove the recursive entry into the IP stack from divert.

By dropping the locks over the call to ip_output() we eliminate all the lock
ordering issues above.  By switching over to netisr on the inbound path,
we can no longer recursively enter the ip_input() code via divert.

I have tested this change by using the following command:

ipfwpcap -r 8000 - | tcpdump -r - -nn -v

This should exercise the input and re-injection (outbound) path, which is
very similar to the work load performed by natd(8).  Additionally, I have
run some ospf daemons which have a heavy reliance on raw sockets and
multicast.

Approved by: re@ (kensmith)
MFC after: 1 month
LOR: 163
LOR: 181
LOR: 202
LOR: 203
Discussed with: julian, andre et al (on freebsd-net)
In collaboration with: bms [1], rwatson [2]

[1] bms helped out with the multicast decisions
[2] rwatson submitted the original netisr patches and came up with some
    of the original ideas on how to combat this issue.

16 years ago- change number assignments for SHA225-512 (match artisync
rrs [Mon, 6 Aug 2007 15:46:46 +0000 (15:46 +0000)]
- change number assignments for SHA225-512 (match artisync
  for bakeoff.. using the next sequential ones)
- In cookie processing 1-2-1, we did not increment the stcb
  refcnt before releasing the tcb lock. We need to do this
  to keep the tcb from being freed by a abort or ?? unlikely
  but worth doing. Also get rid of unneed INP_WLOCK.
- extra receive info included the rcvinfo which killed the
  padding/alignment. We now redefine all the fields properly
  so they both align properly both to 128 bytes.
- A peeled off socket would not close without an error due to
  its misguided idea that sctp_disconnect() was not supported
  on it. This fixes it so it goes through the proper path.
- When an assoc was being deleted after abort (via a timer) a
  small race condition exists where we might take a packet for
  the old assoc (since we are waiting for a cleanup timer). This
  state especially happens in mac. We now add a state in the asoc
  so these can properly handle the packet as OOTB.
Approved by: re@freebsd.org(Ken Smith)

16 years agoRemove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, which
rwatson [Mon, 6 Aug 2007 14:26:03 +0000 (14:26 +0000)]
Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, which
previously conditionally acquired Giant based on debug.mpsafenet.  As that
has now been removed, they are no longer required.  Removing them
significantly simplifies error-handling in the socket layer, eliminated
quite a bit of unwinding of locking in error cases.

While here clean up the now unneeded opt_net.h, which previously was used
for the NET_WITH_GIANT kernel option.  Clean up some related gotos for
consistency.

Reviewed by: bz, csjp
Tested by: kris
Approved by: re (kensmith)

16 years agoClear pending interrupts before we enable external interrupts.
marcel [Mon, 6 Aug 2007 05:15:57 +0000 (05:15 +0000)]
Clear pending interrupts before we enable external interrupts.
Recently the AP in my Merced box seems to have grown a habit
of getting unexpected interrupts, such as redundant wake-ups
and legacy interrupts that require an INTA cycle.

While here, replace DELAY(0) with cpu_spinwait() so that it's
clear what we're doing as well as enable the code to take
advantage of cpu_spinwait() when it gets implemented.

Approved by: re (blanket)

16 years agoKeep interrupts disabled while handling external interrupts.
marcel [Mon, 6 Aug 2007 05:11:01 +0000 (05:11 +0000)]
Keep interrupts disabled while handling external interrupts.
There's no advantage in allowing nested external interrupts.
In fact, it leads to a potential stack overrun.

While here, put the interrupt vector in the trapframe, so as
to compensate for the 36 cycle latency of reading cr.ivr.

Further simplify assembly code by dealing with ASTs from C.

Approved by: re (blanket)

16 years agoConsider a scenario in which one processor, call it Pt, is performing
alc [Sun, 5 Aug 2007 21:04:32 +0000 (21:04 +0000)]
Consider a scenario in which one processor, call it Pt, is performing
vm_object_terminate() on a device-backed object at the same time that
another processor, call it Pa, is performing dev_pager_alloc() on the
same device.  The problem is that vm_pager_object_lookup() should not be
allowed to return a doomed object, i.e., an object with OBJ_DEAD set,
but it does.  In detail, the unfortunate sequence of events is: Pt in
vm_object_terminate() holds the doomed object's lock and sets OBJ_DEAD
on the object.  Pa in dev_pager_alloc() holds dev_pager_sx and calls
vm_pager_object_lookup(), which returns the doomed object.  Next, Pa
calls vm_object_reference(), which requires the doomed object's lock, so
Pa waits for Pt to release the doomed object's lock.  Pt proceeds to the
point in vm_object_terminate() where it releases the doomed object's
lock.  Pa is now able to complete vm_object_reference() because it can
now complete the acquisition of the doomed object's lock.  So, now the
doomed object has a reference count of one!  Pa releases dev_pager_sx
and returns the doomed object from dev_pager_alloc().  Pt now acquires
dev_pager_mtx, removes the doomed object from dev_pager_object_list,
releases dev_pager_mtx, and finally calls uma_zfree with the doomed
object.  However, the doomed object is still in use by Pa.

Repeating my key point, vm_pager_object_lookup() must not return a
doomed object.  Moreover, the test for the object's state, i.e.,
doomed or not, and the increment of the object's reference count
should be carried out atomically.

Reviewed by: kib
Approved by: re (kensmith)
MFC after: 3 weeks

16 years agoIn ia64_set_rr(), don't perform data serialization. This allows
marcel [Sun, 5 Aug 2007 18:19:38 +0000 (18:19 +0000)]
In ia64_set_rr(), don't perform data serialization. This allows
us to do the data serializations once after writing multiple
region registers, as is done in pmap_switch(). All existing
calls to ia64_set_rr() are followed with calls to ia64_srlz_d().

Approved by: re (blanket)

16 years agoImprove error handling in libdisk while parsing the kern.geom.conftxt sysctl.
rink [Sun, 5 Aug 2007 16:55:40 +0000 (16:55 +0000)]
Improve error handling in libdisk while parsing the kern.geom.conftxt sysctl.
Previously, any parse error will result in the calling program exiting with an
unpleasant message. This change will cause libdisk to issue a warning and
ignore lines it cannot parse instead of bluntly terminating the unfortunate
enough program.

This change will allow you to use sysinstall if you have a NTFS parition with
a space in the name (such as 'Win Xp'). In such a case, a line like the
following will appear in the kern.geom.conftxt output:

2 LABEL ntfs/Win Xp 209818635264 512 i 0 o 0

As the fields are space-separated, libdisk would go beserk and exit the program.
This would happen if using FreeBSD 7.0 snapshot images (as GEOM_LABEL is in
the installation kernel as well), thus making it impossible to install FreeBSD
without renaming your NTFS paritions.

Reported by: Dwight Berendse <dwight at berendse dot org>
Nod from: phk
Reviewed by: imp
Approved by: re (bmah), imp (mentor)
MFC after: 1 month

16 years agoThe call to init_file() needs to be moved outside the loop in statd.c,
truckman [Sun, 5 Aug 2007 16:33:06 +0000 (16:33 +0000)]
The call to init_file() needs to be moved outside the loop in statd.c,
otherwise mmap() gets called multiple times, which eventually fails due
to address space exhaustion on i386.

Approved by: re (kensmith)
MFC after: 1 week

16 years agoRename option IPSEC_FILTERGIF to IPSEC_FILTERTUNNEL.
bz [Sun, 5 Aug 2007 16:16:15 +0000 (16:16 +0000)]
Rename option IPSEC_FILTERGIF to IPSEC_FILTERTUNNEL.
Also rename the related functions in a similar way.
There are no functional changes.

For a packet coming in with IPsec tunnel mode, the default is
to only call into the firewall with the "outer" IP header and
payload.

With this option turned on, in addition to the "outer" parts,
the "inner" IP header and payload are passed to the
firewall too when going through ip_input() the second time.

The option was never only related to a gif(4) tunnel within
an IPsec tunnel and thus the name was very misleading.

Discussed at: BSDCan 2007
Best new name suggested by: rwatson
Reviewed by: rwatson
Approved by: re (bmah)

16 years agoSilently fix up the estimated next free cluster number from the fsinfo
bde [Sun, 5 Aug 2007 12:58:34 +0000 (12:58 +0000)]
Silently fix up the estimated next free cluster number from the fsinfo
sector, instead of failing the whole mount if it is garbage.  Fields
in the fsinfo sector are only advisory, so there are better sanity
checks than this, and we already silently fix up the only other advisory
field in the fsinfo (the free cluster count).

This wasn't handled quite right in rev.1.92, 1.117, or in NetBSD.  1.92
also failed the whole mount for the non-garbage magic value 0xffffffff
1.117 fixed this well enough in practice since garbage values shouldn't
occur in practice, but left the error handling larger and more convoluted
than necessary.  Now we handle the magic value as a special case of
fixing up all out of bounds values.

Also fix up the estimated next free cluster number when there is no
fsinfo sector.  We were using 0, but CLUST_FIRST is safer.

Approved by: re (kensmith)

16 years ago- Divorce the IOTSBs, which so far where handled via a global list
marius [Sun, 5 Aug 2007 11:56:44 +0000 (11:56 +0000)]
- Divorce the IOTSBs, which so far where handled via a global list
  instead of per IOMMU, so we no longer need to program all of them
  identically in systems having multiple IOMMUs. This continues the
  rototilling of the nexus(4) done about 5 months ago, which amongst
  others changed nexus(4) and the drivers for host-to-foo bridges
  to provide bus_get_dma_tag methods, allowing to handle DMA tags in
  a hierarchical way and to link them with devices.
  This still doesn't move the silicon bug workarounds for Sabre (and
  in the uncommitted schizo(4) for Tomatillo) bridges into special
  bus_dma_tag_create() and bus_dmamap_sync() methods though, as w/o
  fully newbus'ified bus_dma_tag_create() and bus_dma_tag_destroy()
  this still requires too much hackery, i.e. per-child parent DMA
  tags in the parent driver.
- Let the host-to-foo drivers supply the maximum physical address
  of the IOMMU accompanying the bridges. Previously iommu(4) hard-
  coded an upper limit of 16GB, which actually only applies to the
  IOMMUs of the Hummingbird and Sabre bridges. The Psycho variants
  as well as the U2S in fact can can translate to up to 2TB, i.e.
  translate to 41-bit physical addresses. According to the recently
  available Tomatillo documentation these bridges even translate to
  43-bit physical addresses and hints at the Schizo bridges doing
  43 bits as well.
  This fixes the issue the FreeBSD 6.0 todo list item "Max RAM on
  sparc64" was refering to and pretty much obsoletes the lack of
  support for bounce buffers on sparc64.

Thanks to Nathan Whitehorn for pointing me at the Tomatillo manual.

Approved by: re (kensmith)

16 years agoo In order to reduce bug and code duplication fold handling of NICs
marius [Sun, 5 Aug 2007 11:28:19 +0000 (11:28 +0000)]
o In order to reduce bug and code duplication fold handling of NICs
  requiring DC_TX_ALIGN or DC_TX_COALESCE, which was previously done
  in dc_start_locked(), into dc_encap().
o In dc_encap():
  - If m_defrag() fails just drop the packet like other NIC drivers
    do. This should only happen when there's a mbuf shortage, in which
    case it was possible to end up with an IFQ full of packets which
    couldn't be processed as they couldn't be defragmented as they
    were taking up all the mbufs themselves. This includes adjusting
    dc_start_locked() to not trying to prepend the mbuf (chain) if
    dc_encap() has freed it.
  - Likewise, if bus_dmamap_load_mbuf() fails as dc_dma_map_txbuf()
    failed, free the mbuf possibly allocated by the above call to
    m_defrag() and drop the packet.
o In dc_txeof():
  - Don't clear IFF_DRV_OACTIVE unless there are at least 6 free TX
    descriptors. Further down the road dc_encap() will bail if there
    are only 5 or fewer free TX descriptors, causing dc_start_locked()
    to abort and prepend the dequeued mbuf again so it makes no sense
    to pretend we could process mbufs again when in fact we won't.
    While at it replace this magic 5 with a macro DC_TX_LIST_RSVD.
  - Just always assign idx to sc->dc_cdata.dc_tx_cons; it doesn't
    make much sense to exclude the idx == sc->dc_cdata.dc_tx_cons
    case.
o In dc_dma_map_txbuf() there's no need to set sc->dc_cdata.dc_tx_err
  to error if the latter is != 0, bus_dmamap_load_mbuf() already
  returns the same error value in that case anyway.
o For less overhead, convert to use bus_dmamap_load_mbuf_sg() for
  loading RX buffers.
o Remove some banal and/or outdated comments.

Approved by: re (kensmith)
MFC after: 1 week

16 years agoInitialize the rl_vlanctl field of the descriptors to zero (in order
marius [Sun, 5 Aug 2007 11:20:33 +0000 (11:20 +0000)]
Initialize the rl_vlanctl field of the descriptors to zero (in order
to clear RL_TDESC_VLANCTL_TAG). This fixes sending packets in the
native VLAN when running both tagged and an untagged VLAN over the
same trunk and descriptors are recycled.

Approved by: re (kensmith)
MFC after: 1 week

16 years agoo Iomage -> Iomega.
maxim [Sun, 5 Aug 2007 07:39:30 +0000 (07:39 +0000)]
o Iomage -> Iomega.

PR: docs/115208
Submitted by: John Nielsen
Approved by: re (kensmith)
MFC after: 1 week

16 years agoo round-type -> round-trip.
maxim [Sun, 5 Aug 2007 07:38:09 +0000 (07:38 +0000)]
o round-type -> round-trip.

PR: docs/115082
Submitted by: Jordan Gordeev
Approved by: re (kensmith)
MFC after: 1 week

16 years agoDo not acquire Giant unconditionally around the calls to the cdevsw
kib [Sun, 5 Aug 2007 05:40:52 +0000 (05:40 +0000)]
Do not acquire Giant unconditionally around the calls to the cdevsw
d_mmap methods. prep_cdevsw() already installs the shims that
acquire/drop Giant for the methods of a driver that specified the
D_NEEDGIANT flag.

Reviewed by: alc
Approved by: re (kensmith)

16 years ago- Ensure the path cost does not exceed 65535 in legacy STP mode.
thompsa [Sat, 4 Aug 2007 21:09:04 +0000 (21:09 +0000)]
- Ensure the path cost does not exceed 65535 in legacy STP mode.
- If the path cost is calculated when the link is down, set a pending flag so
  it is calculated again when it comes back up.
- To not use 00:00:00:00:00:00 as the bridge id, all interfaces are scanned and
  the lowest number wins. All zeros is too low.

Approved by: re (rwatson)

16 years agoRemove references to mpsafenet. This option no longer exists.
csjp [Sat, 4 Aug 2007 20:35:42 +0000 (20:35 +0000)]
Remove references to mpsafenet. This option no longer exists.

Approved by: re@ (bmah)

16 years agoReplace "__asm __volatile()" by equivalent support functions from
marcel [Sat, 4 Aug 2007 19:52:10 +0000 (19:52 +0000)]
Replace "__asm __volatile()" by equivalent support functions from
ia64_cpu.h. This improves readability and consistency and aids in
auditing the code.
Add instruction-serialization after writing to cr.pta.

Delay enabling interrupts until after we setup the clocks and after
we program the task priority register.

Approved by: re (blanket)

16 years agoReplace "__asm __volatile()" by equivalent support functions from
marcel [Sat, 4 Aug 2007 19:36:14 +0000 (19:36 +0000)]
Replace "__asm __volatile()" by equivalent support functions from
ia64_cpu.h. This improves readability and consistency and aids in
auditing the code.
Add data-serialization after writing to the region registers and
add instruction-serialization after writing to cr.pta.

Approved by: re (blanket)

16 years agoReplace "__asm __volatile()" by equivalent support functions from
marcel [Sat, 4 Aug 2007 19:33:27 +0000 (19:33 +0000)]
Replace "__asm __volatile()" by equivalent support functions from
ia64_cpu.h. This improves readability and consistency and aids in
auditing the code.
Add data-serialization after writing to cr.tpr.

Approved by: re (blanket)

16 years agoAdd required data-serialization after writing to cr.itm and cr.itv.
marcel [Sat, 4 Aug 2007 19:28:19 +0000 (19:28 +0000)]
Add required data-serialization after writing to cr.itm and cr.itv.

Approved by: re (blanket)

16 years agoAdd ia64_srlz_d() and ia64_srlz_i() functions to aid in serialization.
marcel [Sat, 4 Aug 2007 19:26:42 +0000 (19:26 +0000)]
Add ia64_srlz_d() and ia64_srlz_i() functions to aid in serialization.

Approved by: re (blanket)

16 years agoSet D_NEEDGIANT.
kib [Sat, 4 Aug 2007 17:43:11 +0000 (17:43 +0000)]
Set D_NEEDGIANT.

Approved by: phk
Approved by: re (kensmith)

16 years agoRestore historical more(1) behavior (inhibit ti/te processing) which
deischen [Sat, 4 Aug 2007 13:16:09 +0000 (13:16 +0000)]
Restore historical more(1) behavior (inhibit ti/te processing) which
accidently got broke during the last less(1) import.

Approved by: re(hrs), delphij

16 years ago - Fix one line that erroneously crept in my last commit.
jeff [Sat, 4 Aug 2007 01:21:28 +0000 (01:21 +0000)]
 - Fix one line that erroneously crept in my last commit.

Approved by: re

16 years ago - Share scheduler locks between hyper-threaded cores to protect the
jeff [Fri, 3 Aug 2007 23:38:46 +0000 (23:38 +0000)]
 - Share scheduler locks between hyper-threaded cores to protect the
   tdq_group structure.  Hyper-threaded cores won't really benefit from
   seperate locks anyway.
 - Seperate out the migration case from sched_switch to simplify the main
   switch code.  We only migrate here if called via sched_bind().
 - When preempted place the preempted thread back in the same queue at
   the head.
 - Improve the cpu group and topology infrastructure.

Tested by: many on current@
Approved by: re

16 years ago - Set SW_PREEMPT when we preempt in critical_exit().
jeff [Fri, 3 Aug 2007 23:35:35 +0000 (23:35 +0000)]
 - Set SW_PREEMPT when we preempt in critical_exit().

Approved by: re

16 years agoOops, fix the fix for the i/o size of the fsinfo block. Its log
bde [Fri, 3 Aug 2007 23:13:50 +0000 (23:13 +0000)]
Oops, fix the fix for the i/o size of the fsinfo block.  Its log
message explained why the size is 1 sector, but the code used a
size of 1 cluster.

I/o sizes larger than necessary may cause serious coherency problems
in the buffer cache.  Here I think there were only minor efficiency
problems, since a too-large fsinfo buffer could only get far enough
to overlap buffers for the same vnode (the device vnode), so mappings
are coherent at the page level although not at the buffer level, and
the former is probably enough due to our limited use of the fsinfo
buffer.

Approved by: re (kensmith)

16 years agoo With -x switch do not pay attention at the hardcoded limit of 3 devic...
maxim [Fri, 3 Aug 2007 15:45:55 +0000 (15:45 +0000)]
o With -x switch do not pay attention at the hardcoded limit of 3               devices and dump stats for all devices in the system.  User can still           limit iostat -x by -n switch.

Spotted by: Igor Sysoev
Submitted by: kensmith
Approved by: re (kensmith)
MFC after: 2 weeks

16 years agoAdd regression tests for flopen(3).
des [Fri, 3 Aug 2007 11:29:49 +0000 (11:29 +0000)]
Add regression tests for flopen(3).

Approved by: re (blanket)

16 years agoBack out previous commit until I figure out why my regression test fails.
des [Fri, 3 Aug 2007 09:20:28 +0000 (09:20 +0000)]
Back out previous commit until I figure out why my regression test fails.

Approved by: re (kensmith)

16 years agoUse fcntl(2)-style locks instead of less-portable flock(2)-style locks.
des [Fri, 3 Aug 2007 06:32:45 +0000 (06:32 +0000)]
Use fcntl(2)-style locks instead of less-portable flock(2)-style locks.

Approved by: re (kensmith)

16 years agoMFp4 - Refine locking to eliminate some potential race/panics:
delphij [Fri, 3 Aug 2007 06:24:31 +0000 (06:24 +0000)]
MFp4 - Refine locking to eliminate some potential race/panics:

 - Copy before testing a pointer.  This closes a race window.
 - Use msleep with the node interlock instead of tsleep.
 - Do proper locking around access to tn_vpstate.
 - Assert vnode VOP lock for dir_{atta,de}tach to capture
   inconsistent locking.

Suggested by: kib
Submitted by: delphij
Reviewed by: Howard Su
Approved by: re (tmpfs blanket)

16 years agoNew release notes: if_bridge(4) private ports, wlandebug(8).
bmah [Fri, 3 Aug 2007 02:26:18 +0000 (02:26 +0000)]
New release notes:  if_bridge(4) private ports, wlandebug(8).

Approved by: re (implicitly)

16 years agoMove mp_topology() from apic_init(i386) and apic_setup_local(amd64) to
peter [Thu, 2 Aug 2007 21:17:58 +0000 (21:17 +0000)]
Move mp_topology() from apic_init(i386) and apic_setup_local(amd64) to
cpu_start_mp().  This is after we have read the cpuid registers to
calculate the hyperthreading_cpus value for the sysctl that enables or
disables hyperthread cores.  Change mp_topology() to use that information
rather than trying to do it itself.

This solves the problem of ULE being incorrectly told that dual core
Athlon64 X2 or Operton cpus are hyperthreading cores.  At the very least,
we now have a single piece of code to identify hyperthreading.

Obtained from:  jhb
Approved by:  re (kensmith)

16 years agoAdd myself as delphij's mentee.
loader [Thu, 2 Aug 2007 15:23:01 +0000 (15:23 +0000)]
Add myself as delphij's mentee.

Approved by:    re (bmah), delphij (mentor)

16 years ago1. Move the disable-empty-zone stuff down below the first 25 lines so
dougb [Thu, 2 Aug 2007 09:18:53 +0000 (09:18 +0000)]
1. Move the disable-empty-zone stuff down below the first 25 lines so
that the listen-on stuff floats up to the first "page" of text. This
makes it very obvious what's going on so that someone trying to enable
a server for use on a network can easily see how to do that.

2. Change the default behavior back to using a hint zone for the root.

3. Leave the root slave zone config as a commented out example.

4. Remove the B and F root servers from the example at the request of
their operators.

Requested by: he-who-must-not-be-named [1]
Requested by: many [2]

Approved by: re (rwatson)

16 years agoRemove fast_ipsec.4. Was merged in parts to ipsec.4.
bz [Thu, 2 Aug 2007 08:05:56 +0000 (08:05 +0000)]
Remove fast_ipsec.4. Was merged in parts to ipsec.4.

Approved by:    re (bmah)

16 years agoRemove the last entries to fast_ipsec.
bz [Thu, 2 Aug 2007 08:04:48 +0000 (08:04 +0000)]
Remove the last entries to fast_ipsec.
Merge in parts of the old fast_ipsec.4 man page to ipsec.4 and
start updating ipsec.4 man page.

Reviewed by: brueffer, sam (slightly earlier versions), bmah
Approved by: re (bmah)

16 years agoNew release note: SA-07:06.tcpdump, SA-07:07.bind.
bmah [Thu, 2 Aug 2007 05:19:08 +0000 (05:19 +0000)]
New release note:  SA-07:06.tcpdump, SA-07:07.bind.

Approved by: re (implicitly)

16 years agoAdd the device ID for the VIA CX700 chipset.
kevlo [Thu, 2 Aug 2007 04:29:19 +0000 (04:29 +0000)]
Add the device ID for the VIA CX700 chipset.

Approved by: re (hrs)

16 years agoMFP4(123686): Fixing various ancontrol(8) related panics by dropping locks
avatar [Thu, 2 Aug 2007 02:20:19 +0000 (02:20 +0000)]
MFP4(123686): Fixing various ancontrol(8) related panics by dropping locks
around copyin()/copyout().

Reviewed by: sam, thompsa
Tested by: dhw
Approved by: re (kensmith)

16 years agoWhen generating ports INDEX files from downloaded "describes" data, build
cperciva [Thu, 2 Aug 2007 02:05:23 +0000 (02:05 +0000)]
When generating ports INDEX files from downloaded "describes" data, build
an index for FreeBSD 7.x too.

MFC After: 1 week
Approved by: re (hrs)

16 years agoCall ttyld_close() in nmdmclose() to ensure that nmdm(4)
emax [Wed, 1 Aug 2007 21:38:11 +0000 (21:38 +0000)]
Call ttyld_close() in nmdmclose() to ensure that nmdm(4)
closes line discipline installed onto /dev/nmdmX device.

Reviewed by: julian
Approved by: re (hrs)
MFC after: 3 days

16 years agoAdd 64bit statistic counters to the ng_ppp node.
mav [Wed, 1 Aug 2007 20:49:35 +0000 (20:49 +0000)]
Add 64bit statistic counters to the ng_ppp node.
64bit counters are needed to simplify traffic accounting and
reduce system load at the big PPP concentrators.

Approved by: re (rwatson), glebius (mentor)

16 years agoThis commit was generated by cvs2svn to compensate for changes in r171682,
simon [Wed, 1 Aug 2007 20:40:44 +0000 (20:40 +0000)]
This commit was generated by cvs2svn to compensate for changes in r171682,
which included commits to RCS files with non-trunk default branches.

16 years agoCorrect buffer overflow in tcpdump(1).
simon [Wed, 1 Aug 2007 20:40:44 +0000 (20:40 +0000)]
Correct buffer overflow in tcpdump(1).

Security: FreeBSD-SA-07:06.tcpdump
Security: CVE-2007-3798
Obtained from: tcpdump.org
Approved by: re (security blanket)

16 years agoThis patch improves fine-grained locking for the ng_ppp node.
mav [Wed, 1 Aug 2007 20:38:37 +0000 (20:38 +0000)]
This patch improves fine-grained locking for the ng_ppp node.
Till now node's transmit path was completely unprotected
and so wasn't thread safe in multilink mode. It's receive path was
declared as WRITER as the simpliest protection method but it
reduces performance when compression or encryption enabled.

Approved by: re (rwatson), glebius (mentor)

16 years agodeclare struct tftphdr and embedded union as beeing packed, which is
ticso [Wed, 1 Aug 2007 11:59:09 +0000 (11:59 +0000)]
declare struct tftphdr and embedded union as beeing packed, which is
required for arm.

Tested on: arm, i386, amd64
Approved by: re (rwatson)
MFC after: 1 week

16 years agoFix for PR bin/115033. This corrects a crash when long options
kientzle [Wed, 1 Aug 2007 03:15:35 +0000 (03:15 +0000)]
Fix for PR bin/115033.  This corrects a crash when long options
are specified with the "-W option=arg" syntax and the '=' is omitted.

MFC after: 3 days
Approved by: re (rwatson)

16 years agoAdd a bridge interface flag called PRIVATE where any private port can not
thompsa [Wed, 1 Aug 2007 00:33:52 +0000 (00:33 +0000)]
Add a bridge interface flag called PRIVATE where any private port can not
communicate with another private port.

All unicast/broadcast/multicast layer2 traffic is blocked so it works much the
same way as using firewall rules but scales better and is generally easier as
firewall packages usually do not allow ARP blocking.

An example usage would be having a number of customers on separate vlans
bridged with a server network. All the vlans are marked private, they can all
communicate with the server network unhindered, but can not exchange any
traffic whatsoever with each other.

Approved by: re (rwatson)

16 years agoChange TCPTV_MIN to be independent of HZ. While it was documented to
peter [Tue, 31 Jul 2007 22:11:55 +0000 (22:11 +0000)]
Change TCPTV_MIN to be independent of HZ.  While it was documented to
be in ticks "for algorithm stability" when originally committed, it turns
out that it has a significant impact in timing out connections.  When we
changed HZ from 100 to 1000, this had a big effect on reducing the time
before dropping connections.

To demonstrate, boot with kern.hz=100.  ssh to a box on local ethernet
and establish a reliable round-trip-time (ie: type a few commands).
Then unplug the ethernet and press a key.  Time how long it takes to
drop the connection.

The old behavior (with hz=100) caused the connection to typically drop
between 90 and 110 seconds of getting no response.

Now boot with kern.hz=1000 (default).  The same test causes the ssh session
to drop after just 9-10 seconds.  This is a big deal on a wifi connection.

With kern.hz=1000, change sysctl net.inet.tcp.rexmit_min from 3 to 30.
Note how it behaves the same as when HZ was 100.  Also, note that when
booting with hz=100, net.inet.tcp.rexmit_min *used* to be 30.

This commit changes TCPTV_MIN to be scaled with hz.  rexmit_min should
always be about 30.  If you set hz to Really Slow(TM), there is a safety
feature to prevent a value of 0 being used.

This may be revised in the future, but for the time being, it restores the
old, pre-hz=1000 behavior, which is significantly less annoying.

As a workaround, to avoid rebooting or rebuilding a kernel, you can run
"sysctl net.inet.tcp.rexmit_min=30" and add "net.inet.tcp.rexmit_min=30"
to /etc/sysctl.conf.  This is safe to run from 6.0 onwards.

Approved by:  re (rwatson)
Reviewed by:  andre, silby

16 years agoMake the driver fully MPSAFE. This fixes some serious locking problems
scottl [Tue, 31 Jul 2007 20:16:50 +0000 (20:16 +0000)]
Make the driver fully MPSAFE.  This fixes some serious locking problems
that could cause panics and corruption under moderate load.  Many thanks
to Matt Reimer, Tom McDonald, and the rest of the guys at VPOP.net for
their help in identifying and testing this.

Approved by: re