dragonfly.git
14 years agoHAMMER VFS - REDO implementation base code part 3/many (addendum)
Matthew Dillon [Tue, 12 Jan 2010 20:04:21 +0000 (12:04 -0800)]
HAMMER VFS - REDO implementation base code part 3/many (addendum)

* Add missing B_VFSFLAG1 to sys/buf.h

14 years agoHAMMER VFS - REDO implementation base code part 3/many
Matthew Dillon [Tue, 12 Jan 2010 04:46:08 +0000 (20:46 -0800)]
HAMMER VFS - REDO implementation base code part 3/many

* Track the oldest potentially uncommitted UNDO/REDO FIFO offset
  on an inode-by-inode basis and use a red-black tree to find
  the aggregate oldest offset.

* If REDOs are present generate a REDO SYNC entry in the UNDO/REDO FIFO
  within the recovery span which indicates to the recovery code how
  far out of the span it must go to process REDOs.

* Fix a bug in hammer_generate_redo() where the REDO would not be
  generated if the data length was 0 (SYNC records use a data length
  of 0 as a degenerate case).

* Print the REDO SYNC entries on the console if bit 2 is set in
  vfs.hammer.debug_io (0x04).

* NOTE: The recovery code does not yet process REDOs.

14 years agoHAMMER VFS - REDO implementation base code part 2/many
Matthew Dillon [Tue, 12 Jan 2010 00:09:51 +0000 (16:09 -0800)]
HAMMER VFS - REDO implementation base code part 2/many

* Move hammer_generate_redo() to its own source file, hammer_redo.c

* Fix bug in the REDO generation.  The tail type was not set the same
  as the head type and caused recoveries to fail.

* Flesh out the REDO sequencing by adding REDO_TERM_* records during the
  meta-data flush, allowing REDO_WRITEs and REDO_TRUNCs to be matched
  against REDO_TERM_WRITEs and REDO_TERM_TRUNCs.

* Interlock the writing of the root volume in the flusher.  Frontend
  code modifies the root volume when generating REDO records and
  can collide with the flusher.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 11 Jan 2010 23:53:32 +0000 (15:53 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agouchcom: Fix panic when accessing a ucom device based on uchcom
Jan Lentfer [Mon, 11 Jan 2010 19:20:07 +0000 (20:20 +0100)]
uchcom: Fix panic when accessing a ucom device based on uchcom

The panic was due to uchcom_param arg being always NULL,
since ucom->sc_parent wasn't initialized properly.
All other usb serial drivers also seem to do it this way.

14 years agoFix kernel build without INET6.
Sascha Wildner [Mon, 11 Jan 2010 15:56:27 +0000 (16:56 +0100)]
Fix kernel build without INET6.

With the addition of -Werror, some minor issues crept up.

The only issue left is that building with 'options SCTP' and without
'options INET6' is broken still (and was before -Werror), since our
SCTP code doesn't #ifdef out enough. But as our SCTP support is quite
old and has never been updated (and I don't plan to do so), I'll leave
it at that.

Reported-by: Johannes Hofmann <johannes.hofmann@gmx.de>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1646>

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 11 Jan 2010 00:19:56 +0000 (16:19 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoHAMMER utility - Fix bug in hammer cleanup which causes the utility to exit
Matthew Dillon [Mon, 11 Jan 2010 00:17:47 +0000 (16:17 -0800)]
HAMMER utility - Fix bug in hammer cleanup which causes the utility to exit

* Remove debugging code which exit()ed when unable to delete a snapshot
  softlink.  This caused 'hammer cleanup' to potentially not process all
  available HAMMER filesystems, amoung other things.

* Rework the snapshot deletion code to skip any snapshots that cannot be
  deleted.

14 years agoHAMMER utility - Fix bug in hammer cleanup which causes the utility to exit
Matthew Dillon [Mon, 11 Jan 2010 00:17:47 +0000 (16:17 -0800)]
HAMMER utility - Fix bug in hammer cleanup which causes the utility to exit

* Remove debugging code which exit()ed when unable to delete a snapshot
  softlink.  This caused 'hammer cleanup' to potentially not process all
  available HAMMER filesystems, amoung other things.

* Rework the snapshot deletion code to skip any snapshots that cannot be
  deleted.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 11 Jan 2010 00:17:39 +0000 (16:17 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 11 Jan 2010 00:15:45 +0000 (16:15 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoHAMMER VFS - Add workaround to HAMMERIOC_GET_SNAPSHOT for bad conversions
Matthew Dillon [Mon, 11 Jan 2010 00:02:58 +0000 (16:02 -0800)]
HAMMER VFS - Add workaround to HAMMERIOC_GET_SNAPSHOT for bad conversions

* When hammer cleanup converts to a hammer v3 snapshot a bad record
  can sometimes be created.  This record is not harmful in anyway.

* However when listing available snapshots correct the tid field in the
  bad record so it can be deleted.

14 years agoHAMMER VFS - Add workaround to HAMMERIOC_GET_SNAPSHOT for bad conversions
Matthew Dillon [Mon, 11 Jan 2010 00:02:58 +0000 (16:02 -0800)]
HAMMER VFS - Add workaround to HAMMERIOC_GET_SNAPSHOT for bad conversions

* When hammer cleanup converts to a hammer v3 snapshot a bad record
  can sometimes be created.  This record is not harmful in anyway.

* However when listing available snapshots correct the tid field in the
  bad record so it can be deleted.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 11 Jan 2010 00:02:16 +0000 (16:02 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agonrelease: fsck the root filesystem on our USB images.
Sascha Wildner [Sun, 10 Jan 2010 19:07:51 +0000 (20:07 +0100)]
nrelease: fsck the root filesystem on our USB images.

/ is mounted r/w for USB images, hence we need to fsck to prevent
accidental foot shooting in case some doesn't shutdown cleanly.

Reported-by: Emmanuel De Paepe <emmanuel_depaepe@yahoo.com>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1637>

14 years agoChange Makefiles for OpenSSH to more closely match the distro.
Peter Avalos [Sun, 10 Jan 2010 05:46:44 +0000 (05:46 +0000)]
Change Makefiles for OpenSSH to more closely match the distro.

This makes it slightly easier for updates.
This also fixes buildworld.

14 years agoMerge branch 'vendor/OPENSSH'
Peter Avalos [Sun, 10 Jan 2010 05:15:44 +0000 (05:15 +0000)]
Merge branch 'vendor/OPENSSH'

14 years agoAdd some more missing files from OpenBSD upgrades.
Peter Avalos [Sun, 10 Jan 2010 03:48:12 +0000 (03:48 +0000)]
Add some more missing files from OpenBSD upgrades.

14 years agoHAMMER VFS - REDO implementation base code part 1/many
Matthew Dillon [Sun, 10 Jan 2010 04:03:06 +0000 (20:03 -0800)]
HAMMER VFS - REDO implementation base code part 1/many

* Implement basic REDO record writing and fsync heuristic in order to
  test operation and performance.  Note that the recovery code is not
  implemented as of this commit and additional REDO records will probably
  have to be written to manage the span.

  There was no easy way to place all REDOs in a single UNDO/REDO FIFO span
  because the span is not known until the inode's meta-data is actually
  flushed.  We can control the flush to ensure that all required REDOs
  are present in the UNDO/REDO FIFO.  So what we will likely do is track
  the span with additional REDO records.

* Redo vfs.hammmer.fsync_mode:
0 REDO disabled, synchronous fsync semantics (default)
1 REDO disabled, asynchronous fsync semantics
2 REDO enabled, synchronous  (uses disk sync command)
3 REDO enabled, asynchronous (no disk sync command)
4 fsync is ignored

* Refactor hammer_flusher_flush_undos()

* Default operation is to disable the new features as they are not
  finished yet.

14 years agoMerge branch 'vendor/OPENSSH'
Peter Avalos [Sun, 10 Jan 2010 03:21:34 +0000 (03:21 +0000)]
Merge branch 'vendor/OPENSSH'

14 years agoAdd a EVP wrapper for SHA256.
Peter Avalos [Sun, 10 Jan 2010 03:15:55 +0000 (03:15 +0000)]
Add a EVP wrapper for SHA256.

This got skipped on one of our OpenSSH upgrades a few years ago.

14 years agoHAMMER VFS - Add debugging for write I/O
Matthew Dillon [Sun, 10 Jan 2010 01:37:51 +0000 (17:37 -0800)]
HAMMER VFS - Add debugging for write I/O

* vfs.hammer.debug_io=2 will kprintf() each write I/O

14 years agoHAMMER VFS - REDO/fsync precursor work
Matthew Dillon [Sun, 10 Jan 2010 01:03:23 +0000 (17:03 -0800)]
HAMMER VFS - REDO/fsync precursor work

* Adjust hammer_fifo_redo structure (not yet used), add a mtime
  field so the mtime can be restored from the REDO records.

* Move the undo buffer flush code into its own procedure,
  hammer_flusher_flush_undos().

* Implement hammer_generate_redo() to generate file write operation
  REDOs.

* Implement sysctls statistics and limits for redo, vfs.hammer.limit_redo
  and vfs.hammer.stats_redo.

14 years agotelldir()'s argument is not supposed to be const.
Sascha Wildner [Sun, 25 Oct 2009 16:26:38 +0000 (17:26 +0100)]
telldir()'s argument is not supposed to be const.

14 years agogames: Massive style(9) cleanup commit. Reduces differences to NetBSD.
Sascha Wildner [Sat, 9 Jan 2010 23:32:31 +0000 (00:32 +0100)]
games: Massive style(9) cleanup commit. Reduces differences to NetBSD.

Submitted-by: Ulrich Spoerlein <uqs@spoerlein.net>
14 years agoMerge branch 'vendor/OPENSSH'
Peter Avalos [Sat, 9 Jan 2010 22:17:04 +0000 (12:17 -1000)]
Merge branch 'vendor/OPENSSH'

14 years agoUpgrade to OpenSSH-5.3p1.
Peter Avalos [Sat, 9 Jan 2010 22:06:31 +0000 (12:06 -1000)]
Upgrade to OpenSSH-5.3p1.

General Bugfixes:

 * Do not limit home directory paths to 256 characters. bz#1615
 * Several minor documentation and correctness fixes.

Portable OpenSSH Bugfixes:

 * Move the deletion of PAM credentials on logout to after the
   session close. bz#1534
 * Accept ENOSYS as a fallback error when attempting
   atomic rename(). bz#1535
 * Fix detection of krb5-config. bz#1639
 * Fix test for server-assigned remote forwarding port for
   non-root users. bz#1578

14 years agonice(3): Return EPERM if increment is negative.
Stathis Kamperis [Fri, 8 Jan 2010 18:04:44 +0000 (20:04 +0200)]
nice(3): Return EPERM if increment is negative.

Mandated by POSIX.

14 years agomqueues: Garbage collect dead function prototype.
Stathis Kamperis [Thu, 7 Jan 2010 17:11:42 +0000 (19:11 +0200)]
mqueues: Garbage collect dead function prototype.

14 years agogdtoa - Allocate more entries on freelist to better handle large fields.
Antonio Huete Jimenez [Wed, 6 Jan 2010 23:12:59 +0000 (00:12 +0100)]
gdtoa - Allocate more entries on freelist to better handle large fields.

http://www.securityfocus.com/bid/35510

Taken-from: NetBSD
Reported-by: Johannes Hofmann <Johannes.Hofmann@gmx.de>
14 years agokernel - poll - Fix MP races
Matthew Dillon [Wed, 6 Jan 2010 03:28:12 +0000 (19:28 -0800)]
kernel - poll - Fix MP races

* Some of the poll code had been taken out from under the MP lock too
  early, creating races.  Put it back under the MP lock until the whole
  mess can be rewritten using kqueue.

Reported-by: Rumko
14 years agodebug - Add kmapinfo to dump the kernel_map
Matthew Dillon [Tue, 5 Jan 2010 22:29:02 +0000 (14:29 -0800)]
debug - Add kmapinfo to dump the kernel_map

* kmapinfo is a program to dump the kernel_map, giving us an idea with
  regards to how much KVM is being used.  Also works on core dumps.

14 years agoFix a panic during snd_uaudio(4) attach.
Sascha Wildner [Tue, 5 Jan 2010 21:18:23 +0000 (22:18 +0100)]
Fix a panic during snd_uaudio(4) attach.

If mixer_ioctl() is called without process context, don't call
vchanvolume().

In-discussion-with: corecode

14 years agoHAMMER VFS - Fix volume ref count leak in fhtovp code.
Matthew Dillon [Tue, 5 Jan 2010 21:01:43 +0000 (13:01 -0800)]
HAMMER VFS - Fix volume ref count leak in fhtovp code.

* The transaction is left dangling open if the inode could not be found
  in a fhtovp operation, leaking refs on the root volume.  Fix by properly
  closing the transaction.

Reported-by: Jan Lentfer <Jan.Lentfer@web.de>
14 years agoHAMMER VFS - Fix serious bug when downgrading (and later upgrading) a PFS
Matthew Dillon [Tue, 5 Jan 2010 19:36:56 +0000 (11:36 -0800)]
HAMMER VFS - Fix serious bug when downgrading (and later upgrading) a PFS

* When downgrading a PFS master to a slave the sync-end-tid (in the
  pfs-status) is not updated.  This will cause the data to become
  inaccessible.

  Then, when upgrading back to a master the original stale sync-end-tid
  is used to rollback the PFS, effectively destroying its contents.

* We now properly update sync-end-tid when downgrading a PFS.  This
  makes the data accessible in slave mode and prevents the rollback
  when re-upgrading the PFS from destroying any of the master's original
  data.

* Why is a rollback used at all when upgrading you ask?  When a PFS is
  operating as a slave mirroring operations can be interrupted, leaving
  a lot of partially updated records.  Since sync-end-tid is not updated
  until the mirroring operation completes (when in slave mode), these
  partially mirrored records are not visible.

  However, if the slave is upgraded to a master any records from
  incomplete mirroring operations must be destroyed.  Hence the rollback
  during an upgrade is a necessary feature under normal operation.

Reported-by: Thomas Nikolajsen
14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Tue, 5 Jan 2010 02:35:13 +0000 (18:35 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agonetwork - VR driver - increase RX ring descriptors
Matthew Dillon [Tue, 5 Jan 2010 00:40:36 +0000 (16:40 -0800)]
network - VR driver - increase RX ring descriptors

* Increase the number of RX descriptors from 64 to 256 to reduce
  occurrences of RX FIFO overflows, particularly on EPIA systems
  which tend to have horrible main-memory bandwidth.

Reported-by: Jan Lentfer <Jan.Lentfer@web.de>
14 years agoUnbreak LINT (tick() -> ustick()).
Sascha Wildner [Mon, 4 Jan 2010 08:34:00 +0000 (09:34 +0100)]
Unbreak LINT (tick() -> ustick()).

14 years agotesting
Sascha Wildner [Sun, 3 Jan 2010 22:37:36 +0000 (23:37 +0100)]
testing

14 years agovfs_conf.c: Fix a warning and remove 'nowerror'.
Sascha Wildner [Sun, 3 Jan 2010 14:43:05 +0000 (15:43 +0100)]
vfs_conf.c: Fix a warning and remove 'nowerror'.

14 years agoUnbreak buildworld.
Sascha Wildner [Sun, 3 Jan 2010 13:25:32 +0000 (14:25 +0100)]
Unbreak buildworld.

The inclusion of <sys/eventvar.h> in <sys/proc.h> in commit
a591f597ce2a2a0d1c8edc23e0445acfbd8a0852 broke some things
in userland.

<kinfo.h> defines _KERNEL_STRUCTURES. If, however, some file included
before <kinfo.h> has code under _KERNEL_STRUCTURES that is needed by
files which come _after_ _KERNEL_STRUCTURES is defined by <kinfo.h>,
we break.

In netstat(1), the solution is to remove the inclusion of <sys/protosw.h>
(which comes in again via <net/netmsg.h> later after <kinfo.h> is
included) in route.c.

In sockstat(1), in lieu of a better solution, we just define
_KERNEL_STRUCTURES early for now.

Reported-by: lentferj
14 years agokernel - kqueue - fix bug in marker handling
Matthew Dillon [Sun, 3 Jan 2010 06:00:30 +0000 (22:00 -0800)]
kernel - kqueue - fix bug in marker handling

* Fix a double-remove in the list marker used by kevent()

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 3 Jan 2010 05:02:02 +0000 (21:02 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agokernel - poll/select - temporary fix for stalls
Matthew Dillon [Sun, 3 Jan 2010 04:54:57 +0000 (20:54 -0800)]
kernel - poll/select - temporary fix for stalls

* Switch around a conditional to test LWP_SELECT first before attempting
  to make the process runnable.  This seems to fix the race causing
  reported stalls.

14 years agokernel - poll/select - temporary fix for stalls
Matthew Dillon [Sun, 3 Jan 2010 04:54:57 +0000 (20:54 -0800)]
kernel - poll/select - temporary fix for stalls

* Switch around a conditional to test LWP_SELECT first before attempting
  to make the process runnable.  This seems to fix the race causing
  reported stalls.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 3 Jan 2010 03:41:06 +0000 (19:41 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agokernel - kqueue - refactor kqueue_scan(), rename tick to ustick
Matthew Dillon [Sun, 3 Jan 2010 03:40:15 +0000 (19:40 -0800)]
kernel - kqueue - refactor kqueue_scan(), rename tick to ustick

* Refactor kqueue_scan() so it can be called stand-alone.

* Rename tick to ustick (microseconds per tick), and add nstick
  (nanoseconds per tick).

14 years agoiso639: Sync with Library of Congress list.
Sascha Wildner [Sun, 3 Jan 2010 03:01:00 +0000 (04:01 +0100)]
iso639: Sync with Library of Congress list.

14 years agobsd-family-tree: Sync with FreeBSD (FreeBSD 8.0 and OpenBSD 4.6).
Sascha Wildner [Sun, 3 Jan 2010 03:00:23 +0000 (04:00 +0100)]
bsd-family-tree: Sync with FreeBSD (FreeBSD 8.0 and OpenBSD 4.6).

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 3 Jan 2010 02:54:07 +0000 (18:54 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agokernel - kqueue - major refactoring
Matthew Dillon [Sun, 3 Jan 2010 00:50:49 +0000 (16:50 -0800)]
kernel - kqueue - major refactoring

* Move filedesc->fd_knhashmask/kn_knhash to kqueue->kq_knhashmask/kq_knhash.

* Remove filedesc->fd_knlistsize/fd_knlist, replace with a per file pointer
  list.

* Partition the kqueue code such that independent kqueues can be created
  without being associated with a file pointer or descriptor.

14 years agokprintf(9): Add 'h' and 'hh' modifiers (ACPI debug output needs 'h').
Sascha Wildner [Sat, 2 Jan 2010 22:39:04 +0000 (23:39 +0100)]
kprintf(9): Add 'h' and 'hh' modifiers (ACPI debug output needs 'h').

Taken-from: FreeBSD

14 years agoopenssl - enable cryptodev support.
Jan Lentfer [Sat, 2 Jan 2010 22:25:37 +0000 (23:25 +0100)]
openssl - enable cryptodev support.

14 years agokernel - kqueue - move kq_kev out of struct kqueue
Matthew Dillon [Sat, 2 Jan 2010 21:59:47 +0000 (13:59 -0800)]
kernel - kqueue - move kq_kev out of struct kqueue

* Move kqueue->kq_kev from the kqueue structure to the stack.

14 years agokernel - pmap (i386) - fix bugs in gd_GDMAP1 and gd_GDADDR1 initialization
Matthew Dillon [Sat, 2 Jan 2010 02:07:40 +0000 (18:07 -0800)]
kernel - pmap (i386) - fix bugs in gd_GDMAP1 and gd_GDADDR1 initialization

* I was using the wrong index variable to initialize the per-cpu
  gd_GDMAP1 and gd_GDADDR1 fields.  This caused the cpu mask for
  the alt page table mapping to not work properly.

14 years agoAdd some missing ACPI source files to 'files' (for LINT).
Sascha Wildner [Sat, 2 Jan 2010 01:41:31 +0000 (02:41 +0100)]
Add some missing ACPI source files to 'files' (for LINT).

14 years agoacpi(4): Fix some x86_64 warnings.
Sascha Wildner [Sat, 2 Jan 2010 00:47:21 +0000 (01:47 +0100)]
acpi(4): Fix some x86_64 warnings.

14 years agorealpath(1): Fix style(9) violation from previous.
Stathis Kamperis [Fri, 1 Jan 2010 23:36:34 +0000 (01:36 +0200)]
realpath(1): Fix style(9) violation from previous.

Sorry for the noise.

14 years agoEnable the machdep.disable_rtc_set sysctl on x86_64.
Sascha Wildner [Fri, 1 Jan 2010 21:54:02 +0000 (22:54 +0100)]
Enable the machdep.disable_rtc_set sysctl on x86_64.

This makes adjkerntz(8) work for me (instead of giving an error because
the sysctl couldn't be found).

14 years agorealpath(1): Return ENOENT if filename is empty string.
Stathis Kamperis [Fri, 1 Jan 2010 13:55:34 +0000 (15:55 +0200)]
realpath(1): Return ENOENT if filename is empty string.

Mandated by POSIX.

Linux, NetBSD and OpenSolaris do the same, so we are on
the safe side.

Shortly-discussed-with: aggelos@

14 years agokernel - adjust vnode reclamation
Matthew Dillon [Fri, 1 Jan 2010 03:25:25 +0000 (19:25 -0800)]
kernel - adjust vnode reclamation

* Do a pre-check for auxillary refs and do not reclaim a vnode through
  standard recyclement if auxillary refs are present.

  Recyclement can still occur under other circumstances.  Auxillary
  refs nominally just prevent the vnode from being completely destroyed
  or reused.

  This is a bit experimental.

14 years agokernel - namecache - fix deadlock
Matthew Dillon [Fri, 1 Jan 2010 03:08:48 +0000 (19:08 -0800)]
kernel - namecache - fix deadlock

* cache_drop() can be called in numerous situations where unrelated
  vnode or namecache locks are held, particularly in the
  allocfreevnode() path when it calls cache_inval_vp_nonblock().

* If cache_drop() is transitioning a nc_refs from 1 to 0 it will call
  cache_zap() to free the (now untracked) ncp.  Adjust cache_zap() to
  leave the namecache entry alone if a lock on ncp->nc_parent
  cannot be acquired, instead of blocking (and potentially deadlocking).

* Add _cache_cleandefered() (part of cache_hysteresis()) to handle
  any buildup.  It is expensive but the race occurs at a low rate
  under moderate load so it should hardly ever have to be run.

14 years agomd.4: Adjust SYNOPSIS a bit.
Sascha Wildner [Fri, 1 Jan 2010 03:03:51 +0000 (04:03 +0100)]
md.4: Adjust SYNOPSIS a bit.

14 years agodevelopment.7: Remove blank line.
Sascha Wildner [Tue, 29 Dec 2009 22:33:43 +0000 (23:33 +0100)]
development.7: Remove blank line.

14 years agokernel - pmap - more invltlb stuff
Matthew Dillon [Fri, 1 Jan 2010 02:52:55 +0000 (18:52 -0800)]
kernel - pmap - more invltlb stuff

* Make sure pmap->pm_cache is cleared when a pmap gets reused,
  fixing an issue where the pmap subsystem wasn't properly
  invltlb'ing the recycled pmap due to stale cpu cache bits.

* Add sysctl vm.dreadful_invltlb (default to off) as a debugging aid.
  Turning this on disables pmap->pm_cache and does an unconditional
  invltlb on every pmap operation.

14 years agoBump copyright years. Happy new year!
Sascha Wildner [Fri, 1 Jan 2010 02:08:07 +0000 (03:08 +0100)]
Bump copyright years. Happy new year!

14 years agorealpath(1): Return EINVAL if filename is NULL pointer.
Stathis Kamperis [Thu, 31 Dec 2009 18:52:21 +0000 (20:52 +0200)]
realpath(1): Return EINVAL if filename is NULL pointer.

Mandated by POSIX.

14 years agoIn ACPI land, 0K is -273.2 degrees Celsius (instead of -273.15).
Sascha Wildner [Thu, 31 Dec 2009 18:14:19 +0000 (19:14 +0100)]
In ACPI land, 0K is -273.2 degrees Celsius (instead of -273.15).

Reported-by: Constantine Murenin <C++@Cns.SU>
14 years agoSync zoneinfo database with tzdata2009u from elsie.
Sascha Wildner [Thu, 31 Dec 2009 17:57:31 +0000 (18:57 +0100)]
Sync zoneinfo database with tzdata2009u from elsie.

asia:           8.48 -> 8.50

Bangladesh will go back to Standard Time on December 31, 2009.

14 years agokernel - pmap - add additional logic for cpu_invltlb()
Matthew Dillon [Thu, 31 Dec 2009 16:28:05 +0000 (08:28 -0800)]
kernel - pmap - add additional logic for cpu_invltlb()

* Cached pmaps still require a cpu_invltlb() call if another cpu
  modifies the pmap.

14 years agovinum(8) - Fix error when compiling with -DVINUMDEBUG
Antonio Huete Jimenez [Thu, 31 Dec 2009 01:48:36 +0000 (02:48 +0100)]
vinum(8) - Fix error when compiling with -DVINUMDEBUG

Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1062>

14 years agokernel - pmap (i386) - Refactor the foreign pmap mapping
Matthew Dillon [Wed, 30 Dec 2009 19:38:39 +0000 (11:38 -0800)]
kernel - pmap (i386) - Refactor the foreign pmap mapping

* Remove the global alternative pmap and related hacks.  Leave
  the PTD entry reserved because I really do not want to
  change the location of MPPTDI (The PDE via which the
  globaldata array is mapped).

* Reserve SMP_MAXCPU (16) PTDs in the kernel page table for
  per-cpu page table maps.  This eats about 64MB of KVM
  (not 64M of physical memory).

* Adjust get_ptbase() in platform/pc32/i386/pmap.c to use the
  per-cpu map.  This greatly simplifies the tracking required
  to determine when a cpu_invltlb() call is required.

  get_ptbase() is now MPSAFE but the rest of the pmap system
  is not, yet.  This is a big step though.

* Note that because these are PTD mappings and not PTE mappings,
  each process pmap gets its own set, and because processes
  may be threaded the new get_ptbase() still WILL NOT safely
  survive a thread switch.

  On the otherhand, for vkernels, this inherent (process pmap x NCPU)
  pagetable mapping cache should work quite efficiently.  The
  vkernel threads running on different physical cpus will get their
  own page table map cache ptd.

14 years agokernel - pmap (mainly i386) - fix TLB race and other issues
Matthew Dillon [Wed, 30 Dec 2009 17:10:18 +0000 (09:10 -0800)]
kernel - pmap (mainly i386) - fix TLB race and other issues

* Temporary fix for a TLB race.  Due to threading a process pmap
  may be mapped to multiple cpus.  The APTmap is built into the
  per-process pmap and used for temporary page table mappings.

  The i386 pmap code was only invalidating the TLB if the APTmap
  had to be updated, but did not consider the possibility that
  it would be accessed from a different cpu than the one it was
  originally installed in.

  Add a simple global cpumask to avoid the degenerate case.
  This is a bit of overkill.  A followup commit will move
  APTmap into the globaldata structure as a more permanent
  fix.

  The vkernel and x86_64 pmap code do not have this issue.  The
  vkernel pmap code already uses a per-globaldata pmap and
  the x86_64 pmap code uses the direct phys map.

* Add a ton of debugging code articulated with PMAP_DEBUG in
  case I ever have to do this again.  Default disabled.

* Fix a few minor issues in the pmap code.

  (1) The pv in pmap_remove_entry() is not optional.

  (2) Add a few minor missing pmap->pm_generation increments.

  (3) Add a missing critical section.

  (4) Remove an unused #define.

* Zalloc code.  No specific bugs but make sure the ZONE_INTERRUPT
  code acquires the MP lock when/if it needs to expand the mapping.

Reported-by: YONETANI Tomokazu <y0netan1@crater.dragonflybsd.org>
14 years agokernel - Fix improper vgone() in procfs and races in truss
Matthew Dillon [Tue, 29 Dec 2009 23:50:39 +0000 (15:50 -0800)]
kernel - Fix improper vgone() in procfs and races in truss

* procfs was trying to destroy the vnodes associated with exiting pids,
  ripping them out from under active users.  This is no longer legal.

  Instead flag it for the exiting pid so further operations fail.

* procfs's stopevents handling for process tracing was not MPSAFE
  and raced against MPSAFE system call entry points.  This led to
  numerous situations where gdb or truss would get stuck, or where
  the process getting traced would get stuck.

  Make the whole mess MPSAFE by protecting the tests against proc->p_spin.

* Note that the platform trap case is optimized to only acquire p_spin
  once it has been determined that a stopevent might be pending.

Reported-by: Antonio Huete Jimenez <tuxillo@quantumachine.net>
14 years agokernel - fix fifofs kqueue broken on the 25th
Matthew Dillon [Tue, 29 Dec 2009 19:52:59 +0000 (11:52 -0800)]
kernel - fix fifofs kqueue broken on the 25th

* A misnamed field caused kqueue ops to fail on filesystem fifos.

Reported-by: Jan Lentfer, Rumko
14 years agoatc - Fix bug related to delayed command and altitude change
Matthias Schmidt [Sun, 20 Dec 2009 09:05:20 +0000 (10:05 +0100)]
atc - Fix bug related to delayed command and altitude change

When playing atc, if a plane has a delayed turn command, and you issue
an altitude command that would send the plane to the same altitude to
which it is already going, the delay is disabled and the plane turns
immediately.

Fix is from OpenBSD (PR 3448).

Discussed-with: swildner@
Provided-by: 26c3
14 years agomd(4) - Several fixes to make the module loading/unloading work properly.
Antonio Huete Jimenez [Tue, 29 Dec 2009 17:31:35 +0000 (18:31 +0100)]
md(4) - Several fixes to make the module loading/unloading work properly.

Previously, md(4) crashed the system. It produced inconsistencies due
it wasn't registered as a module, thus allowing to be kldloaded even
when it was compiled in on kernel.

Reported-by  : Sascha Wildner and many people
Lots-of-help : Alex Hornung
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue174>

14 years agoinstaller: Fix the manual configuration of lnc(4) in VMware.
Sascha Wildner [Mon, 28 Dec 2009 20:51:17 +0000 (21:51 +0100)]
installer: Fix the manual configuration of lnc(4) in VMware.

7daaee58e8b828a4951bb466c19b066381826d2c fixed the DHCP case but not the
manual configuration case. Apply a similar fix there.

While here, move the DHCP fix a bit up, just to look similar in both
cases.

However, the exact issue hasn't been found yet. We don't know why string
is junk in VMware before these fixes, as nothing before the old location
of the asprintf() seems to modify it.

In-discussion-with: matthias

14 years agokernel - MPSAFE stabilization
Matthew Dillon [Mon, 28 Dec 2009 17:15:25 +0000 (09:15 -0800)]
kernel - MPSAFE stabilization

* Fix for 'panic: sysref_activate: bad count 00000002'.  Mistakenly
  assumed the lockmgr lock was sufficient protection but forgot it
  might be acquired LK_SHARED.  Extend v_spinlock protection to fix
  the problem.

14 years agokernel - fine-grained namecache and partial vnode MPSAFE work
Matthew Dillon [Mon, 28 Dec 2009 06:36:07 +0000 (22:36 -0800)]
kernel - fine-grained namecache and partial vnode MPSAFE work

Namecache subsystem

* All vnode->v_flag modifications now use vsetflags() and vclrflags().
  Because some flags are set and cleared by vhold()/vdrop() which
  do not require any locks to be held, all modifications must use atomic
  ops.

* Clean up and revamp the namecache MPSAFE work.  Namecache operations now
  use a fine-grained MPSAFE locking model which loosely follows these
  rules:

  - lock ordering is child to parent.  e.g. lock file, then lock parent
    directory.  This allows resolver recursions up the parent directory
    chain.

  - Downward-traversing namecache invalidations and path lookups will
    unlock the parent (but leave it referenced) before attempting to
    lock the child.

  - Namecache hash table lookups utilize a per-bucket spinlock.

  - vnode locks may be acquired while holding namecache locks but not
    vise-versa.  VNodes are not destroyed until all namecache references
    go away, but can enter reclamation.  Namecache lookups detect the case
    and re-resolve to overcome the race.  Namecache entries are not
    destroyed while referenced.

* Remove vfs_token, the namecache MPSAFE model is now totally fine-grained.

* Revamp namecache locking primitves (cache_lock/cache_unlock and
  friends).  Use atomic ops and nc_exlocks instead of nc_locktd and
  build-in a request flag.  This solves busy/tsleep races between lock
  holder and lock requester.

* Revamp namecache parent/child linkages.  Instead of using vfs_token to
  lock such operations we simply lock both child and parent namecache
  entries.  Hash table operations are also fully integrated with the
  parent/child linking operations.

* The vnode->v_namecache list is locked via vnode->v_spinlock, which
  is actually vnode->v_lock.lk_spinlock.

* Revamp cache_vref() and cache_vget().  The passed namecache entry must
  be referenced and locked.  Internals are simplified.

* Fix a deadlock by moving the call to _cache_hysteresis() to a
  place where the current thread otherwise does not hold any locked
  ncp's.

* Revamp nlookup() to follow the new namecache locking rules.

* Fix a number of places, e.g. in vfs/nfs/nfs_subs.c, where ncp->nc_parent
  or ncp->nc_vp was being accessed with an unlocked ncp.  nc_parent
  and nc_vp accesses are only valid if the ncp is locked.

* Add the vfs.cache_mpsafe sysctl, which defaults to 0.  This may be set
  to 1 to enable MPSAFE namecache operations for [l,f]stat() and open()
  system calls (for the moment).

VFS/VNODE subsystem

* Use a global spinlock for now called vfs_spin to manage vnode_free_list.
  Use vnode->v_spinlock (and vfs_spin) to manage vhold/vdrop ops and
  to interlock v_auxrefs tests against vnode terminations.

* Integrate per-mount mnt_token and (for now) the MP lock into VOP_*()
  and VFS_*() operations.  This allows the MP lock to be shifted further
  inward from the system calls, but we don't do it quite yet.

* HAMMER: VOP_GETATTR, VOP_READ, and VOP_INACTIVE are now MPSAFE.  The
  corresponding sysctls have been removed.

* FIFOFS: Needed some MPSAFE work in order to allow HAMMER to make things
  MPSAFE above, since HAMMER forwards vops for in-filesystem fifos to
  fifofs.

* Add some debugging kprintf()s when certain MP races are averted, for
  testing only.

MISC

* Add some assertions to the VM system.

* Document existing and newly MPSAFE code.

14 years agokgdb - Fix kernel trapframe backtraces for i386
Matthew Dillon [Mon, 28 Dec 2009 02:19:59 +0000 (18:19 -0800)]
kgdb - Fix kernel trapframe backtraces for i386

* A recent gdb update removed our stack frame sniffer hooks,
  add them back in for i386.

* I got trapframe to work properly for i386.  I dunno about
  interrupt frames.

14 years agoInstall mandoc_char.7 because mandoc.1 references it.
Sascha Wildner [Sun, 27 Dec 2009 21:21:21 +0000 (21:21 +0000)]
Install mandoc_char.7 because mandoc.1 references it.

14 years agodevelopment.7: Adjust targets.
Sascha Wildner [Sun, 27 Dec 2009 20:44:17 +0000 (20:44 +0000)]
development.7: Adjust targets.

14 years agohammer volume - Serialize volume operations
Michael Neumann [Sun, 27 Dec 2009 18:28:21 +0000 (19:28 +0100)]
hammer volume - Serialize volume operations

Only one hammer volume-add or hammer volume-del operation
is allowed at the same time per mount.

While for volume-add operations it is not strictly needed, it is
absolutely required for the reblocking phase of the volume-del
operation.

14 years agokernel - Correct bug in cache_fullpath()
Matthew Dillon [Sun, 27 Dec 2009 16:40:19 +0000 (08:40 -0800)]
kernel - Correct bug in cache_fullpath()

* cache_copy() needs to check for a NULL ncp

Reported-by: Stathis Kamperis
14 years agokernel - fix improper VOP_*() calls on dead vnode
Matthew Dillon [Sun, 27 Dec 2009 09:06:48 +0000 (01:06 -0800)]
kernel - fix improper VOP_*() calls on dead vnode

* Certain degenerate cases were trying to make dead vnodes
  inactive.  Fixes vp->v_mount a panic.

* It is possible that more such cases will leak out of the woodwork.

Reported-by: Stathis Kamperis
14 years agokernel - Add per-mount token to replace mplock.
Matthew Dillon [Sun, 27 Dec 2009 02:12:56 +0000 (18:12 -0800)]
kernel - Add per-mount token to replace mplock.

* Fix issues with dupfdopen() not being MPSAFE.

* Implement a dummy mount structure for devfs-synthesized vnodes prior
  to the root mount.

* Wrap all VFS_*() calls, including vfs_init() and vfs_uninit(), to
  acquire the per-mount token if not flagged as being MPSAFE.

* Wrap all VOP_*() calls to acquire the per-mount token if not flagged
  as being MPSAFE.

* Move VOP_READ/VOP_WRITE MPSAFE flags to the mount structure.

* Make fifoops MPSAFE (so HAMMER can flag read & write as being
  MPSAFE generally).

* The VFS code currently also acquires the MP lock when not MPSAFE
  (there are things called by VFSes which are not yet MPSAFE), except
  for read() and write().

14 years agovesa(4): Remove some old prototypes.
Sascha Wildner [Wed, 23 Dec 2009 06:36:04 +0000 (07:36 +0100)]
vesa(4): Remove some old prototypes.

14 years agomptable(1): Only suggest to try -grope when -grope wasn't used.
Sascha Wildner [Thu, 24 Dec 2009 21:52:52 +0000 (21:52 +0000)]
mptable(1): Only suggest to try -grope when -grope wasn't used.

14 years agonrelease: Adjust a little for x86_64.
Sascha Wildner [Thu, 24 Dec 2009 21:00:16 +0000 (21:00 +0000)]
nrelease: Adjust a little for x86_64.

14 years agox86_64: Fix a warning.
Sascha Wildner [Thu, 24 Dec 2009 02:07:06 +0000 (02:07 +0000)]
x86_64: Fix a warning.

14 years agoDecrement prisoncount on error
Michael Neumann [Wed, 23 Dec 2009 11:41:21 +0000 (12:41 +0100)]
Decrement prisoncount on error

14 years agosignal.h - Rename 'union sigval' members to fit requirements in SuSv2 and POSIX.
Antonio Huete Jimenez [Mon, 21 Dec 2009 22:27:20 +0000 (23:27 +0100)]
signal.h - Rename 'union sigval' members to fit requirements in SuSv2 and POSIX.

Also leave the old members there to keep compatibility.

Taken-from: FreeBSD

14 years agoacpi_thermal.4: Revert a bit (temperatures are still in 10ths of Kelvin).
Sascha Wildner [Tue, 22 Dec 2009 22:42:56 +0000 (23:42 +0100)]
acpi_thermal.4: Revert a bit (temperatures are still in 10ths of Kelvin).

14 years agoFix some x86_64 warnings in the kernel (and remove nowerror).
Sascha Wildner [Tue, 22 Dec 2009 16:06:37 +0000 (17:06 +0100)]
Fix some x86_64 warnings in the kernel (and remove nowerror).

14 years agohammer(8): Add -X to usage().
Sascha Wildner [Tue, 22 Dec 2009 13:55:53 +0000 (14:55 +0100)]
hammer(8): Add -X to usage().

Submitted-by: Dylan Reinhold <dylan@ocnetworking.com>
14 years agoacpi_hp.4 & mandoc.1: mdoc fluff
Sascha Wildner [Tue, 22 Dec 2009 13:41:24 +0000 (14:41 +0100)]
acpi_hp.4 & mandoc.1: mdoc fluff

14 years agoaio: Make sysconf() report correct value.
Stathis Kamperis [Mon, 21 Dec 2009 20:42:39 +0000 (22:42 +0200)]
aio: Make sysconf() report correct value.

Issue 6 says that _POSIX_ASYNCHRONOUS_IO shall be defined equal to
-1, 0, or 200112L. But sysconf() shall report either -1 or 200112L.

We provide headers, data types and functions for the AIO interface,
but not any actual implementation. This means that the symbol
_POSIX_ASYNCHRONOUS_IO shall be 0 (it is already) and sysconf()
shall return -1 (it didn't until now).

14 years agoSync zoneinfo database with tz{code,data}2009t from elsie.
Sascha Wildner [Mon, 21 Dec 2009 18:40:48 +0000 (19:40 +0100)]
Sync zoneinfo database with tz{code,data}2009t from elsie.

Theory:         8.3  -> 8.4
asia:           8.44 -> 8.48
europe:         8.24 -> 8.25
zone.tab:       8.29 -> 8.31

Theory      "Calendrical Calculations" updated (thanks to Steve Ward).
asia        Hong Kong comments corrected; Xinjiang comments added.
europe      Russian region comments updated (thanks to Oscar van Vlijmen)
zone.tab    version change only

14 years agokernel - Fix atomic ops for x86_64 kernel build
Matthew Dillon [Mon, 21 Dec 2009 18:19:28 +0000 (10:19 -0800)]
kernel - Fix atomic ops for x86_64 kernel build

* atomic*_ptr functions were not casting arguments to long, resulting
  in compile-time errors.