dragonfly.git
12 years agokernel: Fix building with USERCONFIG but without VISUAL_USERCONFIG.
Sascha Wildner [Sat, 7 Apr 2012 11:15:38 +0000 (13:15 +0200)]
kernel: Fix building with USERCONFIG but without VISUAL_USERCONFIG.

Reported-by: v_2e on users@
12 years agokernel/ufs: Fix compilation without INVARIANTS.
Sascha Wildner [Thu, 5 Apr 2012 17:10:51 +0000 (19:10 +0200)]
kernel/ufs: Fix compilation without INVARIANTS.

12 years agokernel -- ffs: Do not dereference NULL inodes in ffs_sync_scan1.
Venkatesh Srinivas [Fri, 30 Mar 2012 06:33:08 +0000 (23:33 -0700)]
kernel -- ffs: Do not dereference NULL inodes in ffs_sync_scan1.

ffs_sync_scan1 is a fast callback from vmntvnodescan; it is not called
with vnodes locked. It is possible for an ffs_reclaim to have reclaimed
the vnode in question, NULL-ing out ip, without having removed the vnode
from the per-mount list. If we see a NULL inode, return failure from the
fast callback.

12 years agokernel -- FFS: Take softdep lock in softdep_disk_io_initiation.
Venkatesh Srinivas [Mon, 2 Apr 2012 17:02:25 +0000 (10:02 -0700)]
kernel -- FFS: Take softdep lock in softdep_disk_io_initiation.

softdep_disk_io_initiation was using the mplock rather than the softdep
lock to protect the softdep work queue and items on it. Take the softdep
lock and allow it to be taken recursively, so that io_start bioops can
call into other parts of softdep. Prevents softdep completion callback
from racing softdep_disk_io_initiation, remaining panics of 2291.

Eventually the MPLOCK in the bio_ops callback can go away, but that will
require more testing.

Closes-bug: 2291

12 years agokernel -- ffs: Replace softupdates critical section locks with lockmgr.
Venkatesh Srinivas [Wed, 28 Mar 2012 18:09:15 +0000 (11:09 -0700)]
kernel -- ffs: Replace softupdates critical section locks  with lockmgr.

ffs softupdates was using a combination of critical sections and the mplock
to construct its acquire_lock/free_lock/interlocked_sleep primitives.

The softupdates I/O completion callback had a few points where it could block,
causing it to lose the mplock and any critical sections it held. When it did
so, front-end softupdates code would try to grab the lock but panic on seeing
the I/O completion callback in progress. This was not a problem in older
systems, as splx() would prevent the I/O callback from starting while
softdep code was executing.

This patch converts to using hard locks (lockmgr), which are held even while
a thread is blocked.

getdirtybuf(), locking a dirty buffer via BUF_LOCK, was changed to not
deadlock against the I/O completion path; specifically it drops the softdep
lock when its non-blocking attempt to lock a dirty buffer fails. One caller
of getdirtybuf() also required changes to retry locking buffers.

Closes-bug: 2291
Partially-from: FreeBSD r140709
Reported-by: tuxillo, marino, Rumko, vsrinivas
Discussed-with: dillon

12 years agoSync zoneinfo database with tzdata2012c from munnari.oz.au
Sascha Wildner [Mon, 2 Apr 2012 08:21:42 +0000 (10:21 +0200)]
Sync zoneinfo database with tzdata2012c from munnari.oz.au

africa:         8.33 -> 8.35
asia:           8.70 -> 8.73
northamerica:   8.53 -> 8.54

* africa: Morocco 2012 DST from last Sunday in April through last
    Sunday in September.

* asia: Change start of DST in Syria to last Friday in March in
    2012 and (as a guess) forward. Starts and (guessed) ends of
    DST in West Bank and Gaza for 2012. Also add a missing HTML
    directive at the top of the file.

* northamerica: Start and end of DST in Haiti in 2012 according
    to US rules.

12 years agokernel - MFC missing removal of bremfree() call
Matthew Dillon [Sun, 1 Apr 2012 01:18:01 +0000 (18:18 -0700)]
kernel - MFC missing removal of bremfree() call

* buf_daemon*() -> flushbufqueues() had an improper bremfree().

Reported-by: tuxillo
12 years agopcn(4): Add missing braces.
Sascha Wildner [Sat, 31 Mar 2012 02:10:59 +0000 (04:10 +0200)]
pcn(4): Add missing braces.

12 years agolgue(4): Add missing braces and fix indentation.
Sascha Wildner [Sat, 31 Mar 2012 01:46:53 +0000 (03:46 +0200)]
lgue(4): Add missing braces and fix indentation.

It was returning too early in some cases.

While here, add an error message.

12 years agohptiop(4): Add missing braces.
Sascha Wildner [Sat, 31 Mar 2012 01:26:52 +0000 (03:26 +0200)]
hptiop(4): Add missing braces.

12 years agortld: Add a special case in do_dlsym() for TLS stored symbols.
Sascha Wildner [Fri, 2 Mar 2012 09:15:56 +0000 (10:15 +0100)]
rtld: Add a special case in do_dlsym() for TLS stored symbols.

Submitted-by: Markus Pfeiffer <markus.pfeiffer@morphism.de>
Conflicts:

libexec/rtld-elf/rtld.c

12 years agorwhod(8): Prevent clobbering the neighboring field by a wrong cast.
Sascha Wildner [Fri, 30 Mar 2012 16:36:50 +0000 (18:36 +0200)]
rwhod(8): Prevent clobbering the neighboring field by a wrong cast.

The time stamps in the rwhod(8) network datagram and, based on that,
/var/rwho/whod.* spool files are typed as 32bit int and cannot accept
a 64bit time_t.

The old code clobbered the first bytes of the adjacent "hostname"
field, yielding empty hostnames in local rwho(1) and ruptime(1) output.
(Outgoing datagrams to other hosts were not affected.)

Re-code to let the compiler do the proper coercion (well, until 2038).

Submitted-by: Martin Neitzel
Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/2339>

12 years agokernel - Cluster fixes + Enable clustering for HAMMER1
Matthew Dillon [Thu, 22 Mar 2012 23:45:55 +0000 (16:45 -0700)]
kernel - Cluster fixes + Enable clustering for HAMMER1

* Add cluster_awrite(), which replaces vfs_bio_awrite() and has the same
  basic semantics as bawrite().

* Remove vfs_bio_awrite(), which had an odd API that required the buffer
  to be locked but not removed from its queues.

* Make cluster operations work on disk device buffers as well as on
  regular files.

* Add a blkflags argument to getcacheblk(), allowing GETBLK_NOWAIT to
  be passed to it.

* Enhance cluster_wbuild() to support cluster_awrite() by having it take
  an optional bp to incorporate into the cluster.  The caller disposes of
  the bp by calling bawrite() if the cluster_wbuild() code could not use it.

* Certain adjustments to cluster_write() and related code in checking against
  the file EOF to not break when variable block sizes are used.

* Fix a bug in calls made to buf_checkwrite().  The caller is required to
  initiate the I/O if the function returns good (0).  HAMMER1 uses this
  save side effects and blows up if the I/O is then not initiated.

* Enable clustering in HAMMER1 for both data and meta-data.

12 years agokernel - Fix improper BUF_UNLOCK() with spinlock held
Matthew Dillon [Wed, 28 Mar 2012 02:10:14 +0000 (19:10 -0700)]
kernel - Fix improper BUF_UNLOCK() with spinlock held

* Fix improper BUF_UNLOCK()s in the buf daemon threads.  Use a
  marker and rearrange the code to release the spinlock before
  executing BUF_UNLOCK().

12 years agokernel - Improve NFS server error responses when an inode goes away
Matthew Dillon [Fri, 23 Mar 2012 20:38:29 +0000 (13:38 -0700)]
kernel - Improve NFS server error responses when an inode goes away

* When an inode goes away and FHTOVP fails return ESTALE instead of
  what the VFS returned.

* Greatly improves the re-acquisition of files on NFS clients which have
  been ripped out by the server or other clients.

12 years agokernel - Fix improper unlock/relock sequence in HAMMER
Matthew Dillon [Fri, 23 Mar 2012 20:36:27 +0000 (13:36 -0700)]
kernel - Fix improper unlock/relock sequence in HAMMER

* VOP_FSYNC() can be called during a vnode inactivation or reclaim.
  In this case the vnode lock absolutely cannot be released or it
  can create a window of opportunity for another thread that results
  in a panic.

* Fixes a NFS server crash when multiple clients are trying to
  delete/create/write the same file at the same time.

12 years agokernel - Fix bug in SILI, remove debugging in AHCI
Matthew Dillon [Fri, 23 Mar 2012 16:06:57 +0000 (09:06 -0700)]
kernel - Fix bug in SILI, remove debugging in AHCI

* Fix the same unlock/lock sequence bug in the SILI driver that was
  fixed in the AHCI driver.

* Remove a flag that was being added to the service set in AHCI for
  debugging purposes.

12 years agokernel - Fix another AHCI bug
Matthew Dillon [Fri, 23 Mar 2012 08:47:48 +0000 (01:47 -0700)]
kernel - Fix another AHCI bug

* Remove the unlock/lock sequences around the xpt_done() calls.  These
  temporary unlocks create a gap which can allow another interrupt to
  squeeze in and interfere with the interrupt thread that is already
  running, resulting in corruption.

  This bug occurs under very heavy loads, and typically required multiple
  concurrent ops to a SSD to trigger.

* Add additional assertions to catch issues and reorder one of the
  chiploads.

* This is a bit non-optimal, be on the lookout for deadlocks in case it
  turns out that holding the lock is a bad idea.

12 years agokernel - Fix mount refs interactions and umount races
Matthew Dillon [Fri, 23 Mar 2012 04:37:25 +0000 (21:37 -0700)]
kernel - Fix mount refs interactions and umount races

* It is possible for a umount to race other operations on active mount
  point, causing one or the other to deadlock.

* vfs_busy()/vfs_unbusy() now incr/decr mp->mnt_refs.

* cache_findmount() now increments mp->mnt_refs, and add a new API
  function cache_dropmount() which decrements it.

12 years agokernel - Fix three AHCI bugs
Matthew Dillon [Fri, 23 Mar 2012 04:31:31 +0000 (21:31 -0700)]
kernel - Fix three AHCI bugs

* This fixes spurious timeouts which occur on SMP boxes with faster devices
  (such as SSDs or more recent hard drives)

* The global interrupt status register appears to be latched on some parts
  rather than wire-or.  Clearing it after signaling the port threads or
  processing the interrupt can cause interrupts to be lost.

* In cases where it is actually wire-or we may get a double-interrupt,
  but stability is more important here.

* Fix the port signaling code.  The mask was being cleared with the
  port interlock released.  It has to be cleared when the interlock is
  held.

* Reorder the per-port interrupt status register clearing code in two
  places to execute before processing the operation rather than after,
  which may fix another source of lost interrupts.

12 years agokernel - Add workaround for errata #721 on AMD cpus (found by Matt Dillon)
Matthew Dillon [Fri, 23 Mar 2012 22:49:54 +0000 (15:49 -0700)]
kernel - Add workaround for errata #721 on AMD cpus (found by Matt Dillon)

* Official reference for errata 721:

    http://support.amd.com/us/Processor_TechDocs/41322_10h_Rev_Gd.pdf

* This is the cpu bug found by Matthew Dillon, present on all K10 cores
  (so far).  AMD has indicated that the bug is not present on Bulldozer
  cpus.

* The MSR workaround is now reported and programmed during kernel boot.

* No discernable difference in performance was detected running GCC
  with and without the MSR adjustment.

* Verified to have fixed our test case w/GCC.  It no longer seg-faults.

12 years agolibc - Do not allow a stuck syslogd to screw up the entire system
Matthew Dillon [Sat, 24 Mar 2012 00:33:51 +0000 (17:33 -0700)]
libc - Do not allow a stuck syslogd to screw up the entire system

* If syslogd gets stuck the socket buffer will still full forever.
  Only try writing a limited number of times before giving up.

12 years agokernel: msdosfs -- Use -1 rather than 32-bit 0xffffffff in mount().
Venkatesh Srinivas [Mon, 26 Mar 2012 15:59:02 +0000 (08:59 -0700)]
kernel: msdosfs -- Use -1 rather than 32-bit 0xffffffff in mount().

Corrects bug mounting 8GB msdosfs filesystem on x86-64.

Submitted-by: G. Isenmann
12 years agotcp/sack: Prevent invalid SACK option from being processed
Sepherosa Ziehau [Mon, 26 Mar 2012 03:36:53 +0000 (11:36 +0800)]
tcp/sack: Prevent invalid SACK option from being processed

If the received SACK blocks contain one invalid SACK block,
discard the whole SACK blocks.

12 years agompt(4): Fix an issue that caused the driver to attach to mfi(4) cards. v3.0.2
Sascha Wildner [Tue, 20 Mar 2012 20:19:25 +0000 (21:19 +0100)]
mpt(4): Fix an issue that caused the driver to attach to mfi(4) cards.

FreeBSD's commit message (r232411) explains it:

Fix a problem that was causing the mpt(4) driver to attach to MegaRAID
cards that should be handled by the mfi(4) driver.

The root of the problem is that the mpt(4) driver was masking off the
bottom bit of the PCI device ID when deciding which cards to attach to.

It appears that a number of the mpt(4) Fibre Channel cards had a LAN
variant whose PCI device ID was just one bit off from the FC card's device
ID.  The FC cards were even and the LAN cards were odd.

The problem was that this pattern wasn't carried over on the SAS and
parallel SCSI mpt(4) cards.  Luckily the SAS and parallel SCSI PCI device
IDs were either even numbers, or they would get masked to a supported
adjacent PCI device ID, and everything worked well.

Now LSI is using some of the odd-numbered PCI device IDs between the 3Gb
SAS device IDs for their new MegaRAID cards.  This is causing the mpt(4)
driver to attach to the RAID cards instead of the mfi(4) driver.

The solution is to stop masking off the bottom bit of the device ID, and
explicitly list the PCI device IDs of all supported cards.

This change should be a no-op for mpt(4) hardware.  The only intended
functional change is that for the 929X, the is_fc variable gets set.  It
wasn't being set previously, but needs to be because the 929X is a Fibre
Channel card.

12 years agoboot - Fix overflow in CD I/O code
Matthew Dillon [Fri, 16 Mar 2012 00:36:02 +0000 (17:36 -0700)]
boot - Fix overflow in CD I/O code

* Fix an overflow in cdb2devb():
from ((bno) * ISO_DEFAULT_BLOCK_SIZE / DEV_BSIZE)
to   ((bno) * (ISO_DEFAULT_BLOCK_SIZE / DEV_BSIZE))

* Adjust several fields from signed -> unsigned

12 years agoioapic: By default, disable I/O APIC if we are booting on a virtual machine
Sepherosa Ziehau [Wed, 14 Mar 2012 03:18:44 +0000 (11:18 +0800)]
ioapic: By default, disable I/O APIC if we are booting on a virtual machine

I/O APIC causes too much trouble on virtual machines; simply disable
I/O APIC for virtual machines by default.

You could always explicitly enable I/O APIC on virtual machines by
setting tunable hw.ioapic_enable to 1

Thank swildner@ for hint on virtual machine detection method.

Reported-by: many
12 years agospacialreg: Add CPUID2_VMM according to AMD's CPUID specification
Sepherosa Ziehau [Wed, 14 Mar 2012 03:18:00 +0000 (11:18 +0800)]
spacialreg: Add CPUID2_VMM according to AMD's CPUID specification

12 years agoMerged thread-specific cleanup patch from FreeBSD.
Aycan iRiCAN [Tue, 13 Mar 2012 20:48:27 +0000 (22:48 +0200)]
Merged thread-specific cleanup patch from FreeBSD.

  See: http://lists.freebsd.org/pipermail/freebsd-threads/2009-June/004563.html

12 years agorc.conf.5: Fix the wlan setup example.
Sascha Wildner [Sun, 11 Mar 2012 18:05:08 +0000 (19:05 +0100)]
rc.conf.5: Fix the wlan setup example.

Submitted-by: Johannes Hofmann <johannes.hofmann@gmx.de>
Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/2330>

12 years ago<sys/cdefs.h>: For C++, unhide our interfaces via __{BEGIN,END}_DECLS.
Sascha Wildner [Sun, 11 Mar 2012 12:50:29 +0000 (13:50 +0100)]
<sys/cdefs.h>: For C++, unhide our interfaces via __{BEGIN,END}_DECLS.

This follows up on a previous (pthread specific) commit by alexh
(e7322b09faff75b1298e9bfe444633425d173536) that used a per-proto
macro. Revert this commit, too. In principle, we do it like NetBSD
now.

See http://gcc.gnu.org/wiki/Visibility in the GCC wiki for details
on the issue.

This solution was suggested by Martin Husemann in a thread about
xulrunner building issues:

http://mail-index.netbsd.org/tech-pkg/2012/03/11/msg008680.html

Reported-and-tested-by: marino and others
12 years agosvc_vc_create(3): Initialize xprt with NULL.
Sascha Wildner [Sat, 10 Mar 2012 08:27:36 +0000 (09:27 +0100)]
svc_vc_create(3): Initialize xprt with NULL.

In the (corner-)case of being out of memory, this prevents free() to be
called on an uninitialized xprt below the cleanup_svc_vc_create: label.

12 years agokernel: fixup accidental whitespace shift in vm_fault_copy_entry commit
Chris Turner [Fri, 9 Mar 2012 21:31:19 +0000 (21:31 +0000)]
kernel: fixup accidental whitespace shift in vm_fault_copy_entry commit

was resulting in cherry-pick conflicts in MFC branch

12 years agokernel: reorganize new holds in vm_fault_copy_entry
Chris Turner [Fri, 9 Mar 2012 20:57:42 +0000 (20:57 +0000)]
kernel: reorganize new holds in vm_fault_copy_entry

Move holds outside of the pagecopy loop to reduce locking overhead.

Suggested-by: dillon
12 years agokernel: add missing holds/drops to vm_fault_copy_entry
Chris Turner [Fri, 9 Mar 2012 20:34:46 +0000 (20:34 +0000)]
kernel: add missing holds/drops to vm_fault_copy_entry

Add missing holds/drops to vm_fault_copy_entry that were triggering
assertions in vm_page_alloc/vm_page_lookup when when a process
holding locked memory is forked.

Fixes: https://bugs.dragonflybsd.org/issues/2320
Reviewed-by: vsrinavas
X-Nahmean-Status: word

12 years agosetnetpath(3): Fix a double free().
Sascha Wildner [Fri, 9 Mar 2012 17:29:51 +0000 (18:29 +0100)]
setnetpath(3): Fix a double free().

np_sessionp is free()'d after the failed: label.

12 years agoHAMMER VFS: Conditionalize debug message
Matthew Dillon [Fri, 9 Mar 2012 06:04:10 +0000 (22:04 -0800)]
HAMMER VFS: Conditionalize debug message

* Conditionalize an annoying debug kprintf on hammer_debug_inode.

12 years agokernel: Add a few forgotten crit_exit()s and fix a wrong crit_enter().
Sascha Wildner [Wed, 7 Mar 2012 18:19:33 +0000 (19:19 +0100)]
kernel: Add a few forgotten crit_exit()s and fix a wrong crit_enter().

12 years agoInstaller: one more place where inform() called without a format string
YONETANI Tomokazu [Wed, 7 Mar 2012 15:01:15 +0000 (00:01 +0900)]
Installer: one more place where inform() called without a format string

Noticed-by: swildner@
12 years agoInstaller: fix a (possible) crash in show_ifconfig()
YONETANI Tomokazu [Wed, 7 Mar 2012 15:01:15 +0000 (00:01 +0900)]
Installer: fix a (possible) crash in show_ifconfig()

inform() expects a printf-like format string as the second argument,
so you should always supply one instead of a random string by itself.

DragonFly-bug: <http://bugs.dragonflybsd.org/issues/1596>

12 years agoncurses: Fix an almost 7 year old typo in the profiling libtinfo's name.
Sascha Wildner [Mon, 5 Mar 2012 10:49:27 +0000 (11:49 +0100)]
ncurses: Fix an almost 7 year old typo in the profiling libtinfo's name.

It was introduced in c4c23d9061b6eb2a3456620a48b84583b00fe0ce.

12 years agogcc44: Remove a wrong define for the profiled math library's name.
Sascha Wildner [Mon, 5 Mar 2012 10:04:30 +0000 (11:04 +0100)]
gcc44: Remove a wrong define for the profiled math library's name.

This caused compiling with -pg to fail for C++:

zoot# c++ -pg -o t t.c
/usr/libexec/binutils222/elf/ld.bfd: cannot find -lm_p

Our libraries for profiling don't have different names than the normal
ones. They just are in a different directory (/usr/lib/profile), which
is cared for.

Reported-by: Pierre Abbat <phma@phma.optus.nu>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/2325>

12 years agoSync zoneinfo database with tzdata2012b from munnari.oz.au
Sascha Wildner [Fri, 2 Mar 2012 09:25:53 +0000 (10:25 +0100)]
Sync zoneinfo database with tzdata2012b from munnari.oz.au

northamerica:   8.52 -> 8.53

* northamerica: Summer time in Cuba has been delayed 3 weeks (now
    starts April 1 rather than March 11). Since Mar 11 (the old
    start date, as listed in 2012a) is just a little over a week
    away, this change is urgent.

Also bump zone.tab's version for a fix that was not in 2012a but
which I already added.

12 years agoSync zoneinfo database with tzdata2012a from munnari.oz.au
Sascha Wildner [Thu, 1 Mar 2012 14:41:05 +0000 (15:41 +0100)]
Sync zoneinfo database with tzdata2012a from munnari.oz.au

antarctica:     8.9  -> 8.10
asia:           8.69 -> 8.70
australasia:    8.29 -> 8.30
europe:         8.40 -> 8.41
leapseconds:    8.11 -> 8.13
northamerica:   8.51 -> 8.52
README:         8.3  -> 8.4
southamerica:   8.52 -> 8.53
zone.tab:       8.52 -> 8.54

* antarctica: Current best known timezone info for various Antarctic
    bases for the winter of 2012.

* asia: Armenia has abolished summer time.

* australasia: Tokelau copied Samoa and swapped sides of the
    International Date Line last December (affects current timestams).

* europe: Updated URL for UK timezone history.

* leapseconds: Bulletin C43 incorporated (a leap Second will occur
    2012-06-30 at 23:59:60 UTC). Bulletin C42 was also incorporated
    (but never released) - it said nothing very interesting (no leap
    second 2011-12-31).

* northamerica: New zone America/Creston created for an area in
    British Columbia that was previously (and apparently incorrectly)
    considered identical to Dawson Creek. Also, some corrections to
    1918 summer time end dates in several Canadian zones.

* README: Updated to reflect the current home of the mailing list and
    files.

* southamerica: Chile has extended Summer time in the 2011/2 summer.
    Future years (2013->) are assumed revert to "normal" for now. The
    Falkland Islands now have it permanently (continuing the 2011
    experiment). This "permanently" is a guess, it apparently is
    certain for 2012 (as certain as these things ever are) and
    considered likely into the future.

* zone.tab: New America/Creston zone added, and a typo in the entry
    for Europe/Samara corrected.

12 years agolibthread_xu/libc_r: Improve the check for EINVAL in sem_* functions.
Sascha Wildner [Tue, 28 Feb 2012 22:44:29 +0000 (23:44 +0100)]
libthread_xu/libc_r: Improve the check for EINVAL in sem_* functions.

Before referencing *sem->... in the check, do not just test if sem is
NULL but also if *sem is NULL.

Reported-by: Max Herrgard <herrgard@gmail.com>
12 years agouguru(4): Fix a panic when detaching (e.g., on kldunload).
Sascha Wildner [Mon, 27 Feb 2012 19:52:26 +0000 (20:52 +0100)]
uguru(4): Fix a panic when detaching (e.g., on kldunload).

Reported-by: Max Herrgard <herrgard@gmail.com>
12 years agox86_64 getmemsize: Recover 0x100000 bytes v3.0.1
John Marino [Sun, 19 Feb 2012 15:26:19 +0000 (16:26 +0100)]
x86_64 getmemsize: Recover 0x100000 bytes

When binutils 2.20 was brought in, the x86_64 kernel built with it loaded
at 0x200000 instead of 0x100000 as it was previously.  The getmemsize()
function was never updated with the new address so the physical memory
between 0x100000 and 0x200000 has been lost since then.

The hardcoded value has been updated.  In the future, it may be a good
idea to replace with a variable as FreeBSD has done.

12 years agoMerge remote branch 'crater/DragonFly_RELEASE_3_0' into rel3_0
Thomas Nikolajsen [Sat, 18 Feb 2012 10:50:49 +0000 (11:50 +0100)]
Merge remote branch 'crater/DragonFly_RELEASE_3_0' into rel3_0

12 years agotmpfs.5: Add note that DragonFly NFS client needs to disable ReaddirPlus
Thomas Nikolajsen [Sat, 18 Feb 2012 10:37:22 +0000 (11:37 +0100)]
tmpfs.5: Add note that DragonFly NFS client needs to disable ReaddirPlus

12 years agoVFS accounting: optimize vop_write() performance
François Tigeot [Sat, 18 Feb 2012 09:36:06 +0000 (10:36 +0100)]
VFS accounting: optimize vop_write() performance

* Avoid a mount list scan if accounting is globally disabled

12 years agotmpfs: Support NFS export of tmpfs filesystems.
Venkatesh Srinivas [Tue, 31 Jan 2012 05:15:24 +0000 (00:15 -0500)]
tmpfs: Support NFS export of tmpfs filesystems.

* Implement vop_mountctl and MOUNTCTL_SET_EXPORT interfaces to allow mountd
  to export a tmpfs filesystem.

* Implement vfs_checkexp to allow NFS to function.

Closes: Bug 2277

12 years agoVFS accounting: check if nullfs mp* really exist
Francois Tigeot [Fri, 17 Feb 2012 22:58:58 +0000 (23:58 +0100)]
VFS accounting: check if nullfs mp* really exist

* Nullfs are a clever hack, they forget their mp after mount and let the
  non-nullfs underlying mount point do all the work

* Nevertheless, we need to get the real struct mount associated to a mount
  point to count the space used by PFSes. We cache it in the vnode.

* But since the vnode we use really belongs to the lowest underlying
  mount point, the upper-level mp may already have been freed.

* We need to first check if it still valid; a new function,
  mountlist_exists() now exists for that purpose.

* Should fix issue #2266

12 years agohier.7: Add back a .Bl that was removed with the binutils 2.20 removal.
Sascha Wildner [Fri, 17 Feb 2012 22:05:03 +0000 (23:05 +0100)]
hier.7: Add back a .Bl that was removed with the binutils 2.20 removal.

12 years agokernel: mfs -- Fix unmount panic for MFS filesystems.
Venkatesh Srinivas [Thu, 16 Feb 2012 15:53:22 +0000 (07:53 -0800)]
kernel: mfs -- Fix unmount panic for MFS filesystems.

mfs_start() is active for the life of an MFS mount, handling copyin/out
requests. It is directed to exit when an MFS filesystem is unmounted.
The VFS accounting code and VFS MPLOCK code assumed that the mountpoint
structure was stable on return of mfs_start, which was not the case.

To work around that, don't call acinit if the vfs_start vfsop returns
EMOUNTEXIT, a kernel-specific pseudo-errno. Also allow marking vfs_start
MPSAFE and mark mfs vfs_start MPSAFE, to avoid accessing a per-mount
token field. A future commit will rework MFS's locking so that critical
sections are not used to protect the MFS bioq.

This is a hack for MFS; future work should either rework the filesystem
or replace it outright with tmpfs.

Closes: Bug 2276

12 years agoisp(4): Fix wrong sizeof().
Sascha Wildner [Thu, 16 Feb 2012 14:48:27 +0000 (15:48 +0100)]
isp(4): Fix wrong sizeof().

12 years agokernel/pci: Implement the PCIOCATTACHED ioctl.
Sascha Wildner [Tue, 14 Feb 2012 22:18:33 +0000 (23:18 +0100)]
kernel/pci: Implement the PCIOCATTACHED ioctl.

This fixes pciconf -a

Taken-from: FreeBSD

12 years agoobjformat - Duplicate NELEM() macro
Samuel J. Greear [Sun, 12 Feb 2012 18:24:26 +0000 (11:24 -0700)]
objformat - Duplicate NELEM() macro

* Fix buildworld on DragonFly hosts built before Dec 18, 2010 (2.9).

* NELEM() macro was added to sys/param.h on Dec 18, 2010 and objformat was
  made to use it on May 20, 2011. This broke upgrades for machines running a
  DragonFly version built prior to Dec 18, 2010 since objformat is built with
  the hosts headers as part of the cross tools stage.

12 years agomps(4): Add module version.
Sascha Wildner [Wed, 8 Feb 2012 20:40:35 +0000 (21:40 +0100)]
mps(4): Add module version.

12 years agomps(4): Mark a function __printflike() and fix a resulting warning.
Sascha Wildner [Wed, 8 Feb 2012 11:01:20 +0000 (12:01 +0100)]
mps(4): Mark a function __printflike() and fix a resulting warning.

12 years agomps(4): Remove some useless casts.
Sascha Wildner [Tue, 7 Feb 2012 10:53:42 +0000 (11:53 +0100)]
mps(4): Remove some useless casts.

I've inserted them by mistake because I had not realized that the
wrong typedefs for U32 and S32 were the real issue.

12 years agomps: Hold lock for the shutdown event handler
Sepherosa Ziehau [Tue, 7 Feb 2012 09:36:19 +0000 (17:36 +0800)]
mps: Hold lock for the shutdown event handler

12 years agomps: If we don't have enough space for a sge and chain, don't claim we can
Sepherosa Ziehau [Tue, 7 Feb 2012 09:35:20 +0000 (17:35 +0800)]
mps: If we don't have enough space for a sge and chain, don't claim we can

12 years agomps: Use WAITOK to allocate critical data struct on attach path
Sepherosa Ziehau [Tue, 7 Feb 2012 09:17:55 +0000 (17:17 +0800)]
mps: Use WAITOK to allocate critical data struct on attach path

12 years agomps: Properly define U32 and S32
Sepherosa Ziehau [Tue, 7 Feb 2012 09:15:45 +0000 (17:15 +0800)]
mps: Properly define U32 and S32

12 years agomps.4: Document how we disable MSI and comment out MSI-X documentation.
Sascha Wildner [Tue, 7 Feb 2012 08:50:08 +0000 (09:50 +0100)]
mps.4: Document how we disable MSI and comment out MSI-X documentation.

12 years agomps(4): Sync with FreeBSD.
Sascha Wildner [Tue, 7 Feb 2012 08:42:32 +0000 (09:42 +0100)]
mps(4): Sync with FreeBSD.

This a still in progress port of the new, LSI-supported version of the
mps(4) driver from FreeBSD.

Some of the changes are (from FreeBSD's commit msg):

- Integrated RAID (IR) support.
- Support for WarpDrive controllers.
- Support for SCSI protection information (EEDP).
- Support for TLR (Transport Level Retries), needed for tape drives.
- Improved error recovery code.
- ioctl interface compatible with LSI utilities.

This commit also moves the driver from sys/dev/disk to sys/dev/raid.

It still fails attaching at this stage. Work on it will continue in
master.

12 years agokernel - Adjust tmpfs to use the new PG_NEED_COMMIT flag
Matthew Dillon [Wed, 1 Feb 2012 04:46:01 +0000 (20:46 -0800)]
kernel - Adjust tmpfs to use the new PG_NEED_COMMIT flag

* Adjust tmpfs to use vm_page_need_commit() instead of redirtying VM
  pages in its strategy code.

* The new mechanism also allows the pageout daemon to act more naturally
  when flushing clean pages with PG_NEED_COMMIT set.

* May fix some tmpfs corruption issues

Reported-by: tuxillo
12 years agokernel - Add vm_page_need_commit() and vm_page_clear_commit()
Matthew Dillon [Wed, 1 Feb 2012 04:41:57 +0000 (20:41 -0800)]
kernel - Add vm_page_need_commit() and vm_page_clear_commit()

* Add vm_page_need_commit() and vm_page_clear_commit().  This controls the
  PG_NEED_COMMIT flag on individual VM pages.

  When set a clean VM page cannot be reused and is still subject to
  flushing by the pageout daemon.

* Refactor buwrite() to use the new mechanism instead of dirtying the
  pages underlying the buffer.

* This allows the normal page and buffer flushing mechanism to operate
  even in situations where the VM page is also the nominal backing store
  for the data (as in tmpfs).

* Will be used by tmpfs.

12 years agokernel - Improve pageout daemon & memory pressure detection w/tmpfs
Matthew Dillon [Wed, 1 Feb 2012 04:52:46 +0000 (20:52 -0800)]
kernel - Improve pageout daemon & memory pressure detection w/tmpfs

* PG_NEED_COMMIT pages are unwired from the buffer cache they are now
  unconditionally placed on the active queue, even if 'activate' is not
  set.

* This results in non-freeable tmpfs pages remaining in the active queue
  most of the time.  They will be cycled into the inactive queue and flushed
  out if swap is present as per normal pageout daemon operation,

  When swap is not present or is full, these pages are reactivated
  unconditionally.

12 years agokernel - Fix incorrect assertion during udp auto-binding
Matthew Dillon [Tue, 31 Jan 2012 22:18:36 +0000 (14:18 -0800)]
kernel - Fix incorrect assertion during udp auto-binding

* When sendto() is used and the UDP socket is not bound the binding
  operation is done by the netisr thread and causes an assertion due
  to not being a process.

* The assertion is incorrect, remove it.  This only occured when lport has
  not been assigned and the cred check is only needed when it has.

Reported-by: Pierre Abbat
12 years agokern - Skip rlimit check when caller is a kernel thread.
Antonio Huete Jimenez [Mon, 30 Jan 2012 13:29:56 +0000 (14:29 +0100)]
kern - Skip rlimit check when caller is a kernel thread.

Pointed-out-by: vsrinivas
12 years agokernel -- linprocfs: linprocfs_allocvp should return a locked vnode.
Venkatesh Srinivas [Sun, 5 Feb 2012 15:04:57 +0000 (10:04 -0500)]
kernel -- linprocfs: linprocfs_allocvp should return a locked vnode.

Fixes a panic where VFS_ROOT returned an unlocked vnode and led to
a lockmgr panic from vput in the namecache.

Reported-by: phma
Bug: 2298

12 years agosh: Test EXIT trap with multiple statements in it
Peter Avalos [Sun, 5 Feb 2012 20:43:12 +0000 (12:43 -0800)]
sh: Test EXIT trap with multiple statements in it

Obtained-from:  FreeBSD 230211
(cherry picked from commit 9ad23e0abe8de4dd2c554c0c21ff7bcce910d66b)

12 years agosh: Add testcases that should not be broken by future optimizations.
Peter Avalos [Sun, 5 Feb 2012 20:38:57 +0000 (12:38 -0800)]
sh: Add testcases that should not be broken by future optimizations.

Obtained-from:  FreeBSD 230121
(cherry picked from commit 0ca7d8dd5520d00c3d26305fe17ef73651d93cca)

12 years agosh: Avoid possible echo options in a testcase.
Peter Avalos [Sun, 5 Feb 2012 20:36:00 +0000 (12:36 -0800)]
sh: Avoid possible echo options in a testcase.

Obtained-from:  FreeBSD 229742
(cherry picked from commit 2fdf52317ffd855dbe1690c83bc3d83718a0f992)

12 years agosh: Fix swapped INTON/INTOFF.
Peter Avalos [Sun, 5 Feb 2012 20:26:01 +0000 (12:26 -0800)]
sh: Fix swapped INTON/INTOFF.

A possible consequence of this bug was a memory leak if SIGINT arrived
during a 'set' command (listing variables).

Obtained-from:  FreeBSD 231001
(cherry picked from commit 97e1125af7205a348d9c853f7f73b42dd4a76d26)

12 years agosh: Use vfork in a few common cases.
Peter Avalos [Sun, 5 Feb 2012 20:21:25 +0000 (12:21 -0800)]
sh: Use vfork in a few common cases.

This uses vfork() for simple commands and command substitutions containing a
single simple command, invoking an external program under certain conditions
(no redirections or variable assignments, non-interactive shell, no job
control). These restrictions limit the amount of code executed in a vforked
child.

There is a large speedup (for example 35%) in microbenchmarks. The
difference in buildkernel is smaller (for example 0.5%) but still
statistically significant. See
http://lists.freebsd.org/pipermail/freebsd-hackers/2012-January/037581.html
for some numbers.

The use of vfork() can be disabled by setting a variable named
SH_DISABLE_VFORK.

Obtained-from:  FreeBSD 230998
(cherry picked from commit 3fb5edd5046fcd04f359351f47e70ad37816977a)

12 years agosh: Fix $? in the first command of a 'for'.
Peter Avalos [Sun, 5 Feb 2012 20:12:44 +0000 (12:12 -0800)]
sh: Fix $? in the first command of a 'for'.

In the first command of a 'for', $? should be the exit status of the last
pipeline (command substitution in the word list or command before 'for'),
not always 0.

Obtained-from:  FreeBSD 230463
(cherry picked from commit 723ecb596978d3ed4d37a449ce636a35c743ec80)

12 years agosh: Remove "kill" example function, which is superseded by the kill
Peter Avalos [Sun, 5 Feb 2012 20:10:27 +0000 (12:10 -0800)]
sh: Remove "kill" example function, which is superseded by the kill
builtin

Obtained-from:  FreeBSD 230437
(cherry picked from commit 123973d7ccb9bf681d124de73d64c3d7eb73e7fa)

12 years agosh: Fix execution of multiple statements in a trap when evalskip is set
Peter Avalos [Sun, 5 Feb 2012 20:07:56 +0000 (12:07 -0800)]
sh: Fix execution of multiple statements in a trap when evalskip is set

Before this fix, only the first statement of the trap was executed if
evalskip was set. This is for example the case when:
    o  "-e" is set for this shell
    o  a trap is set on EXIT
    o  a function returns 1 and causes the script to abort

Obtained-from:  FreeBSD 230212
(cherry picked from commit a1cf61ab1fd76b3e90e17fc4bc03767015deb2e1)

12 years agosh: Fix some bugs with exit status from case containing ;&.
Peter Avalos [Sun, 5 Feb 2012 20:04:53 +0000 (12:04 -0800)]
sh: Fix some bugs with exit status from case containing ;&.

Also, rework evalcase() to not evaluate any tree. Instead, return the
NCLISTFALLTHRU node and handle it in evaltree().

Fixed bugs:

* If a ;& list with non-zero exit status is followed by an empty ;; or final
  list, the exit status of the case command should be equal to the exit
  status of the ;& list, not 0.

* An empty ;& case should not reset $?.

Obtained-from:  FreeBSD 230161
(cherry picked from commit b88d2fafe2e2a6d776e70cb6d6cca1533087b699)

12 years agosh: Fix two bugs with case and exit status:
Peter Avalos [Sun, 5 Feb 2012 20:02:44 +0000 (12:02 -0800)]
sh: Fix two bugs with case and exit status:

* If no pattern is matched, POSIX says the exit status shall be 0 (even if
  there are command substitutions).
* If a pattern is matched and there are no command substitutions, the first
  command should see the $? from before the case command, not always 0.

Obtained-from:  FreeBSD 230154
(cherry picked from commit c79cd3b3a40bbcea12f869fee83c021fc6c8bf90)

12 years agosh: Change input buffer size from 1023 to 1024.
Peter Avalos [Sun, 5 Feb 2012 20:00:29 +0000 (12:00 -0800)]
sh: Change input buffer size from 1023 to 1024.

Apparently this improves performance on slower platforms.

Obtained-from:  FreeBSD 230118
(cherry picked from commit 43cdc26c9fc6fb1e385f2d3238bcb96c3e5ea221)

12 years agosh: Fix out of bounds array access when trap is used with an invalid
Peter Avalos [Sun, 5 Feb 2012 19:52:44 +0000 (11:52 -0800)]
sh: Fix out of bounds array access when trap is used with an invalid
signal.

Obtained-from:  FreeBSD 230117
(cherry picked from commit 5748538799e46b68d37b9a51172a8c47607ebdb4)

12 years agosh: Properly show "Not a directory" error in cd builtin.
Peter Avalos [Sun, 5 Feb 2012 19:44:29 +0000 (11:44 -0800)]
sh: Properly show "Not a directory" error in cd builtin.

The errno message display added in 72cbf4010 did not take attempting to
cd to a non-directory or something that cannot be stat()ed into account.

Obtained-from:  FreeBSD 230095
(cherry picked from commit 2b271b9bd2c4b4c7b94e1d246aebde69a6e37819)

12 years agosh: Make various functions static.
Peter Avalos [Sun, 5 Feb 2012 19:42:22 +0000 (11:42 -0800)]
sh: Make various functions static.

Obtained-from:  FreeBSD 229220
(cherry picked from commit b6bd99f63ba9b8eeb9dcfd0f5b11ea363199cd9a)

12 years agosh: Remove unused function scopyn().
Peter Avalos [Sun, 5 Feb 2012 19:30:56 +0000 (11:30 -0800)]
sh: Remove unused function scopyn().

Obtained-from: FreeBSD 229219
(cherry picked from commit 632067f1fe927fb0869e88c9a9711d90f0e7dd60)

12 years agosh: Make patmatch() non-recursive.
Peter Avalos [Sun, 5 Feb 2012 19:28:08 +0000 (11:28 -0800)]
sh: Make patmatch() non-recursive.

Obtained-from:  FreeBSD 229201
(cherry picked from commit ea8fa3ef2fcd3c09935f42b16a7afaae189eec5d)

12 years agosh: Allow quoting ^ and ] in bracket expressions.
Peter Avalos [Sun, 5 Feb 2012 19:23:10 +0000 (11:23 -0800)]
sh: Allow quoting ^ and ] in bracket expressions.

Obtained-from:  FreeBSD 228943
(cherry picked from commit 4353aa4e29e275869dd6e6c5af76ad724bc2e213)

12 years agosh: Use dirent.d_type in pathname generation.
Peter Avalos [Sun, 5 Feb 2012 19:20:09 +0000 (11:20 -0800)]
sh: Use dirent.d_type in pathname generation.

This improves performance for globs where a slash or another component
follows a component with metacharacters by eliminating unnecessary
attempts to open directories that are not.

Obtained-from:  FreeBSD 228942
(cherry picked from commit c601174268e0ea6cad93a733cecb3a07b2c503a6)

12 years agosh: Cache de->d_namlen in a local variable.
Peter Avalos [Sun, 5 Feb 2012 19:16:08 +0000 (11:16 -0800)]
sh: Cache de->d_namlen in a local variable.

Obtained-from:  FreeBSD 228941
(cherry picked from commit 867f2c406941a0de5691b6e550dbaea0262a3429)

12 years agosh: Don't force special builtins non-special in optimized command subst.
Peter Avalos [Sun, 5 Feb 2012 19:11:06 +0000 (11:11 -0800)]
sh: Don't force special builtins non-special in optimized command subst.

This is not necessary: errors are already caught in evalbackcmd() and
forcelocal handles changes to variables.

Obtained-from:  FreeBSD 228937
(cherry picked from commit d303b442299ef4e2fd081023559b4a89656d1ebf)

12 years agoSupport exception handling on statically-linked binaries
John Marino [Sun, 5 Feb 2012 16:21:27 +0000 (17:21 +0100)]
Support exception handling on statically-linked binaries

The real-time dynamic linker handles exceptions on dynamically-linked
binaries through the dl_iterate_phdr function.  The RTLD isn't invoked
on statically-built executables so thrown exceptions weren't getting
handled.  There was a dummy dl_iterate_phdr function in libc with a
weak symbol that gets looked at when the rtld version isn't present.
This function was populated and gets called when the statically-linked
executable throws an exception.

It requires the GNU_EH_FRAME program header to be present.  The base
gcc 4.4 spec file was modified to emit this header for statically-built
binaries in addition to the dynamically lined ones.

12 years agocdefs: Rework and augment visibility attributes
John Marino [Sun, 5 Feb 2012 16:14:25 +0000 (17:14 +0100)]
cdefs: Rework and augment visibility attributes

One macro based on GCC visibility functions was already defined,
__exported.  However, it was marked as available for all GCC versions
when it fact it was introduced with gcc 4.0.

There was no macro for hidden visibility attributes, so the macros
__dso_hidden and __dso_public were borrowed from NetBSD.  __dso_public
is an alias for __exported.  The definition for all three macros were
made on the condition that the gcc version used is 4.0 or later.

12 years agovkernel - Fix semi-random SIGILL crashes under heavy network loads
Matthew Dillon [Thu, 2 Feb 2012 23:17:44 +0000 (15:17 -0800)]
vkernel - Fix semi-random SIGILL crashes under heavy network loads

* SIGIO was being installed with SA_NODEFER, resulting in situations
  under heavy network loads where multiple SIGIOs could stack and cause
  a stack overflow.  This often resulted in the sendsig code in the kernel
  generating a SIGILL to the process after being unable to push a new
  signal context.

* Removing SA_NODEFER appears to solve the problem.

Reported-by: tuxillo
12 years agokernel - Fix lockmgr lock mismatch panics when iwn used without wlan
Matthew Dillon [Thu, 2 Feb 2012 03:43:26 +0000 (19:43 -0800)]
kernel - Fix lockmgr lock mismatch panics when iwn used without wlan

* If if_iwn is ifconfig'd without going through wlan the wlan_serializer
  is not held during the firmware load stage, resulting in a panic.
  Acquire the serializer for this case.

* Note: iwn worked fine with wlan, but this fixes an annoying panic when
  people try to mess with it without wlan.

Reported-by: fxr (irc)
12 years agokernel - Add missing DRM_LOCK()
Matthew Dillon [Wed, 1 Feb 2012 21:40:19 +0000 (13:40 -0800)]
kernel - Add missing DRM_LOCK()

* Add missing DRM_LOCK() in the i915 X11 ioctl path

Reported-by: Pierre Abbat
Dump-by: Magliano Andrea
12 years agocrypto.ko: Add a missing file.
Sascha Wildner [Tue, 31 Jan 2012 10:17:27 +0000 (11:17 +0100)]
crypto.ko: Add a missing file.

Submitted-by: CosmicDJ
12 years agolibc: correct copyright notice in makecontext.c
Markus Pfeiffer [Fri, 27 Jan 2012 21:59:06 +0000 (21:59 +0000)]
libc: correct copyright notice in makecontext.c

12 years agoMerge branch 'DragonFly_RELEASE_3_0' of ssh://crater.dragonflybsd.org/repository...
Venkatesh Srinivas [Mon, 30 Jan 2012 12:15:03 +0000 (04:15 -0800)]
Merge branch 'DragonFly_RELEASE_3_0' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into rel3_0