dragonfly.git
14 years agolibmd - Improve performance when doing a MD5 of a file via read().
Matthew Dillon [Thu, 21 Jan 2010 19:59:08 +0000 (11:59 -0800)]
libmd - Improve performance when doing a MD5 of a file via read().

* The code was using BUFSIZ, which is (ick) 1024 bytes.  Increase the
  file buffer to 8192 bytes.

14 years agokernel - Add burst reads back into swap_pager
Matthew Dillon [Thu, 21 Jan 2010 19:55:14 +0000 (11:55 -0800)]
kernel - Add burst reads back into swap_pager

* Burst reading from swap was disabled due to recent VM pager changes
  which changes vm_pager_getpages() from specifying multiple-pages to
  specifying just one-page.

* Add burst reading back into pretty much the only pager left (other
  then devfs_pager and phys_pager which are special cases) which
  doesn't use the buffer cache.

* The code may still be a bit unstable so it is diabled by default.
  Add a new sysctl vm.swap_burst_read (defaults to off) which can
  be used to enable burst reading from swap.

14 years agokernel - Add VM_ALLOC_QUICK feature to vm_page_alloc()
Matthew Dillon [Thu, 21 Jan 2010 19:40:29 +0000 (11:40 -0800)]
kernel - Add VM_ALLOC_QUICK feature to vm_page_alloc()

* This feature allocates a page like VM_ALLOC_NORMAL, retaining the same
  free queue limits, but is not allowed to dig into the cache queue.

* Will be used by the new swap_pager_getpage() code.

14 years agokernel - reduces kern.maxvnodes on machines with less memory
Matthew Dillon [Thu, 21 Jan 2010 19:38:43 +0000 (11:38 -0800)]
kernel - reduces kern.maxvnodes on machines with less memory

* Increase the divisor a bit to compensate for the fact that HAMMER
  eats significantly more kernel memory than UFS on a per-vnode basis.
  This is to prevent the VM system from allocating all available memory
  for required kernel structures on machines with small amounts of memory,
  such as 128M, on vkernels, and on virtual machines configured with
  fairly low amounts of memory.

14 years agokernel - ufs, ext2fs getpages/putpages cleanup
Matthew Dillon [Wed, 20 Jan 2010 16:02:22 +0000 (08:02 -0800)]
kernel - ufs, ext2fs getpages/putpages cleanup

* Completely remove the original ffs_getpages/ffs_putpages code and
  remove the vfs.ffs.getpages_uses_bufcache sysctl.  UFS/FFS now
  unconditionally use vop_stdgetpages and vop_stdputpages.

* ext2fs already unconditionally calls vnode_pager_generic_getpages().
  Remove the shim and adjust ext2fs's .vop_getpages to point directly
  to vop_stdgetpages().

14 years agokernel - Fix bug in recent defered-zap namecache code.
Matthew Dillon [Wed, 20 Jan 2010 16:00:07 +0000 (08:00 -0800)]
kernel - Fix bug in recent defered-zap namecache code.

* The NCF_DEFEREDZAP code could get into a degenerate situation
  where every name lookup ate tons of system cpu.  Reset the
  numdefered variable after cleaning defered-zap entries to fix.

14 years agosyscalls.master: List all auto-generated files.
Sascha Wildner [Wed, 20 Jan 2010 02:26:28 +0000 (03:26 +0100)]
syscalls.master: List all auto-generated files.

14 years agokernel - Add new bufcache/VM consolidated API, fsx fixes for NFS
Matthew Dillon [Tue, 19 Jan 2010 22:45:46 +0000 (14:45 -0800)]
kernel - Add new bufcache/VM consolidated API, fsx fixes for NFS

* Add kern/vfs_vm.c with a new API for vtruncbuf() and vnode_pager_setsize()
  called nvtruncbuf(), nvextendbuf(), and nvnode_pager_setsize().  This
  API solves numerous problems with data coherency between the VM and
  buffer cache subsystems.

  Generally speaking what this API does is allow the VM pages backing the
  buffer straddling EOF in a file to remain valid instead of invalidating
  them.  Take NFS for example with 32K buffers and, say, a 16385 byte
  file.  The NFS buffer cache buffer is backed by 8 x 4K VM pages but
  the actual file only requires 5 x 4K pages.  This API keeps all 8 VM
  pages valid.

  This API also handles zeroing out portions of the buffer after truncation
  and zero-extending portions of the buffer after a file extension.

  NFS has been migrated to the new API.  HAMMER will soon follow.  UFS and
  EXT2FS are harder due to their far more complex buffer cache sizing
  operations (due to their fragment vs full-sized block handling).

* Remodel the NFS client to use the new API.  This allows NFS to consolidate
  all truncation and extension operations into nfs_meta_setsize(), including
  all code which previously had to deal with special buffer cache / VM
  cases related to truncation and extension.

* Fix a bug in kern/vfs_bio.c where NFS buffers requiring the clearing
  of B_NEEDCOMMIT failed to also clear B_CLUSTEROK, leading to occassional
  attempts by NFS to issue RPCs larger than the NFS I/O block size (resulting
  in a panic).

* NFS now uses vop_stdgetpages() and vop_stdputpages().  The NFS-specific
  nfs_getpages() and nfs_putpages() has been removed.  Remove a vinvalbuf()
  in the nfs_bioread() code on remote-directory modification which was
  deadlocking getpages.  This needs more work.

* Simplify the local-vs-remote modification tests in NFS.  This needs more
  work.  What was happening, generally, was that the larger number of
  RPCs inflight allowed by the NFS client was creating too much confusion
  in the attribute feedback in the RPC replies, causing the NFS client to
  lose track of the file's actual size during heavy modifying operations
  (aka fsx tests).

14 years agosched_rr_get_interval(2): Use copyout(9) for the interval argument.
Sascha Wildner [Tue, 19 Jan 2010 04:38:26 +0000 (05:38 +0100)]
sched_rr_get_interval(2): Use copyout(9) for the interval argument.

This fixes a panic discovered when NULL was passed as interval.

14 years agokernel - Fix vkernel_trap
Matthew Dillon [Mon, 18 Jan 2010 20:05:17 +0000 (12:05 -0800)]
kernel - Fix vkernel_trap

* vkernel_trap restores the trapframe for the original vkernel call to
  vmspace_ctl(), but only the syscall trap code was actually setting
  up the frame for a syscall-return.

  The other calls to vkernel_trap() (signal, page-fault, other traps)
  were not properly adjusting the frame for a syscall-return and it
  is only pure luck that it didn't bite us until now.

* Add a per-platform cpu_vkernel_trap() which does the syscall-return
  fixup at the end.

Reported-by: Antonio Huete Jimenez <tuxillo@quantumachine.net>
14 years agokernel - Fix pager bug in vm_fault and UFS and have UFS use vop_stdgetpages
Matthew Dillon [Mon, 18 Jan 2010 17:57:51 +0000 (09:57 -0800)]
kernel - Fix pager bug in vm_fault and UFS and have UFS use vop_stdgetpages

* UFS must call vtruncbuf() before b*write()ing the buffer related to
  a shortened file's truncation point.  vtruncbuf() can invalidate pages
  which are part of the buffer cache buffer.  The b*write() revalidates
  those pages.  If we fail to revalidate the pages we can end up with a
  buffer containing invalid pages with B_CACHE set.

* UFS was using its own getpages code in certain cases.  Adjust it to
  use vop_stdgetpages() in all cases by default.

  vop_stdgetpages() uses UIO_NOCOPY VOP_READ()s to fill in missing data
  and to perform read-ahead operations.  It should properly deal with
  partially valid and partially dirty pages as well as deal with file
  holes.

* vm_fault can pass a valid page to the readrest: code if PG_RAM is set.
  We cannot free this page if the underlying vnode contains a hole at
  that location.  Call vm_pager_get_page() unconditionally.

  This fixes fsx failures for both NFS and UFS (when UFS is using
  vop_stdgetpages()).

14 years agoSync zoneinfo database with tzdata2010a from elsie.
Sascha Wildner [Mon, 18 Jan 2010 13:57:44 +0000 (14:57 +0100)]
Sync zoneinfo database with tzdata2010a from elsie.

asia:           8.50 -> 8.51

* Revert 2009 start of DST in Dhaka (Bangladesh) to correct date.

* Make Dhaka fields consistent with others.

14 years agoRaise WARNS in secure/ as high as possible and fix some resulting warnings.
Sascha Wildner [Mon, 18 Jan 2010 09:01:43 +0000 (10:01 +0100)]
Raise WARNS in secure/ as high as possible and fix some resulting warnings.

14 years agosyscall.9: Fix pathname.
Sascha Wildner [Mon, 18 Jan 2010 07:53:02 +0000 (08:53 +0100)]
syscall.9: Fix pathname.

14 years agoSome manual page cleanup.
Sascha Wildner [Mon, 18 Jan 2010 06:24:36 +0000 (07:24 +0100)]
Some manual page cleanup.

In *.9 manual pages, change references to files in /usr/src to be
relative to /usr/src.

14 years agoSome devfs(5) related cleanup.
Sascha Wildner [Mon, 18 Jan 2010 05:55:16 +0000 (06:55 +0100)]
Some devfs(5) related cleanup.

* Remove references to MAKEDEV from some manual pages.

* Remove sys/conf/majors file.

14 years agokernel - Finish implementing PG_RAM / pipelined mmap operation
Matthew Dillon [Mon, 18 Jan 2010 01:53:47 +0000 (17:53 -0800)]
kernel - Finish implementing PG_RAM / pipelined mmap operation

* Finish implementing the PG_RAM read-ahead mark code.  This code
  allows the VM system to generate pipelining faults when reading a
  memory mapped file sequentially.

  This allows programs which scan files via mmap() to max-out the I/O system,
  similar to read().  Before this change programs using mmap() could not get
  better then ~70-80% disk utilization for sequential I/O.

  This commit passes the sequential access flag through to the VOP_GETPAGES
  code which then adjusts the sequential access heuristic in the ioflags
  accordingly.

14 years agokernel - simplify vm pager ops, add pre-faulting for zero-fill pages.
Matthew Dillon [Mon, 18 Jan 2010 01:27:50 +0000 (17:27 -0800)]
kernel - simplify vm pager ops, add pre-faulting for zero-fill pages.

* Remove the behind and ahead arguments to struct pagerops->pgo_getpages,
  and pagerops->pgo_haspage.

  Adjust pgo_getpages() to pgo_getpage(), change *_pager_getpages() to
  *_pager_getpage(), etc.  Add a sequential access flag to the call.

  The VM system is no longer responsible for dealing with read-ahead on
  pager ops.  The individual pagers are now responsible.

  The vnode pager now specifies the sequential access heuristic based on
  the hint passed to it.  HAMMER uses this hint to issue readaheads via
  the buffer cache.

* Move, rename, and consolidate pmap_prefault().  Remove this function
  from all platform sources and place it in vm/vm_fault.c.  Add a
  simple platform-specific pmap_prefault_ok() function to test particular
  virtual addresses.

* The new prefault code is called vm_prefault().  Enhance the code to
  also prefault and make writable (when it can) zero-fill pages.

  The new zero-fill prefault feature improves buildworld times by
  over 5% by greatly reducing the number of VM faults taken during
  normal program operation.  This particularly helps larger applications
  and concurrent applications in SMP systems.

  The code is conditionalized such that small applications (which do not
  benefit much from prefaulting zero-fill) still run about as fast as
  they did before.

* Fix an issue in vm_fault() where the vm_map was being unlocked before
  the prefault code was called when it really needs to be unlocked
  after the prefault code is called.

14 years agokernel - add spinlock to syscons console write path
Matthew Dillon [Mon, 18 Jan 2010 01:23:53 +0000 (17:23 -0800)]
kernel - add spinlock to syscons console write path

* Add a spinlock in the console write path which is shared with
  general console writes (CONS_LOCK is only used for kernel console
  writes).

* Fixes MP races between kprintf() and general console writes which
  can cause sc->videoio_in_progress to get out of sync, causing
  vga consoles to stop generating output.

14 years agovmstat - Allow sub-second intervals to be specified.
Matthew Dillon [Sun, 17 Jan 2010 21:34:28 +0000 (13:34 -0800)]
vmstat - Allow sub-second intervals to be specified.

* Allows e.g. vmstat 0.1 or even vmstat 1.5.

* Note that fields which are printed in per-second format are still
  printed in per-second format.  Sub-second rates may cause reduced
  reliability for these fields.

14 years agokernel - do not wire user pages in sysctl
Matthew Dillon [Sun, 17 Jan 2010 21:32:18 +0000 (13:32 -0800)]
kernel - do not wire user pages in sysctl

* sysctl processes have not assumed that user pages would be wired
  for a long time.

* This also prevents sysctl from causing VM faults on the user memory
  after returning due to wiring changes.

  For example 'vmstat 1' no longer produces faults in the flt column
  generated by vmstat itself on every iteration.

14 years agoBIND: enable DNSSEC support for named and related tools by default.
Jan Lentfer [Sun, 17 Jan 2010 13:21:39 +0000 (14:21 +0100)]
BIND: enable DNSSEC support for named and related tools by default.

* This adds -DOPENSSL and -lcrypto to effected Makefiles

* This patch also introduces NO_BIND_DNSSEC for make.conf
  to disable build of DNSSEC with BIND.

14 years agomqueues: Reduce diffs with NetBSD.
Stathis Kamperis [Sun, 17 Jan 2010 06:44:05 +0000 (08:44 +0200)]
mqueues: Reduce diffs with NetBSD.

No functional change.

14 years agomqueues: Fix deadlock situation.
Stathis Kamperis [Sat, 16 Jan 2010 21:18:37 +0000 (23:18 +0200)]
mqueues: Fix deadlock situation.

tsleep() doesn't release the per-mqueue exclusive lockmgr lock before sleeping.
We need lksleep() instead.

Reported-by: swildner@
14 years agokernel - improve panic message on syscall MP mismatch
Matthew Dillon [Sat, 16 Jan 2010 20:46:50 +0000 (12:46 -0800)]
kernel - improve panic message on syscall MP mismatch

* Print the callp pointer so we can more easily discern which system
  call has MP mismatches when the system asserts.

14 years agokernel - fix MP lock mismatch in sys_lwp_rtprio()
Matthew Dillon [Sat, 16 Jan 2010 20:42:04 +0000 (12:42 -0800)]
kernel - fix MP lock mismatch in sys_lwp_rtprio()

* sys_lwp_rtprio() was returning in certain cases without releasing
  the MP lock.

Reported-by: Sascha Wildner <swildner@crater.dragonflybsd.org>
14 years agoAdd the HPN patch for OpenSSH.
Peter Avalos [Sat, 16 Jan 2010 06:09:49 +0000 (20:09 -1000)]
Add the HPN patch for OpenSSH.

This provides dynamic windows and the ability to switch to a NONE
encryption cipher after authentication.

This does not include the multi-threaded AES-CTR cipher due to
unresolved problems causing it to hang.

For more details: http://www.psc.edu/networking/projects/hpn-ssh/

Requested-by: Michael Neumann <mneumann@ntecs.de>
14 years agoopenssh/auth2.c: Add a missing include (canohost.h).
Sascha Wildner [Sat, 16 Jan 2010 09:34:09 +0000 (10:34 +0100)]
openssh/auth2.c: Add a missing include (canohost.h).

canohost.h has the prototypes for get_canonical_hostname() and
get_remote_ipaddr(), which are used in auth2.c and which both return
const char * (64 bits on x86_64). Without the prototypes, int is
assumed (32 bits).

This caused sshd(8) to crash on x86_64 (i386 isn't affected due to the
char pointer and int having the same width there).

Dragonfly-bug:  <http://bugs.dragonflybsd.org/issue1649>
Pointed-out-by: dillon
14 years agosys_linux_socketcall(): Add missing return() (fixes LINT).
Sascha Wildner [Sat, 16 Jan 2010 02:32:26 +0000 (03:32 +0100)]
sys_linux_socketcall(): Add missing return() (fixes LINT).

14 years agokernel - fix sctp build (LINT)
Matthew Dillon [Sat, 16 Jan 2010 01:57:55 +0000 (17:57 -0800)]
kernel - fix sctp build (LINT)

* malloc_init() needs a pre-initialized ks_magic

* Remove unused variables.

Reported-by: Peter Avalos <pavalos@theshell.com>
14 years agokernel - add UP version for spin_trylock_wr()
Matthew Dillon [Sat, 16 Jan 2010 01:50:13 +0000 (17:50 -0800)]
kernel - add UP version for spin_trylock_wr()

* UP version is a degenerate case, used by kern_lock.o

Reported-by: Antonio Huete Jimenez <tuxillo@crater.dragonflybsd.org>
14 years agoHAMMER VFS - Fix umount panic related to volume flush
Matthew Dillon [Fri, 15 Jan 2010 23:20:41 +0000 (15:20 -0800)]
HAMMER VFS - Fix umount panic related to volume flush

* A volume undergoing I/O as-of the time of a umount can recurse within
  hammer_io_release() due to improper ref-count handling.

* Properly reference and flus hthe volume during umount instead of
  trying to call hammer_io_release() directly.

Reported-by: Jan Lentfer <Jan.Lentfer@web.de>
14 years agokmalloc(9) - Document M_INTWAIT flag.
Antonio Huete Jimenez [Fri, 15 Jan 2010 23:10:03 +0000 (00:10 +0100)]
kmalloc(9) - Document M_INTWAIT flag.

Dragonfly-bug: <http://bugs.dragonflybsd.org/issue925>
Reported-by: Michael Neumann <mneumann@ntecs.de>
Submitted-by: Matthew Dillon <dillon@apollo.backplane.com>
14 years agomqueues: Partially sync with NetBSD.
Stathis Kamperis [Fri, 15 Jan 2010 20:14:26 +0000 (22:14 +0200)]
mqueues: Partially sync with NetBSD.

This fixes the following critical issues:
* An invalid signal number passed to mq_notify() could crash the kernel
  upon the signal delivery.
* mq_send() to a full queue could crash the kernel due to NULL pointer
  dereference in timeout calculation.
* Likewise for mq_receive() from an empty queue.

Thanks to swildner@ for bringing this into my attention.

14 years agokernel - linux emulation - fix linux socketcall MP mismatch
Matthew Dillon [Fri, 15 Jan 2010 19:19:29 +0000 (11:19 -0800)]
kernel - linux emulation - fix linux socketcall MP mismatch

* Fix get_mplock()/rel_mplock() mismatch

Reported-by: Rumko
14 years agokernel - Replace zalloc zones with kmalloc for PCBs
Matthew Dillon [Fri, 15 Jan 2010 19:09:19 +0000 (11:09 -0800)]
kernel - Replace zalloc zones with kmalloc for PCBs

* Use kmalloc to allocate PCBs instead of zalloc.  This removes over
  100MB of KVA reservation, particularly from inp_tcp.

* Solves an issue with maxfiles where too much KVA was being reserved
  by the network for PCBs.

* Replace all SCTP zalloc zones with kmalloc.

Reported-bu: Rumko, Peter Avalos <pavalos@theshell.com>

14 years agohammer - A small set of adjustments to the info directive.
Antonio Huete Jimenez [Fri, 15 Jan 2010 12:27:57 +0000 (13:27 +0100)]
hammer - A small set of adjustments to the info directive.

* Rename some field's name.
* Add percent to space details.
* Fix line lenght to match style(9) and other minor changes.

14 years agohammer.8 - Adjust info section to match current hammer(8) output.
Antonio Huete Jimenez [Fri, 15 Jan 2010 10:48:21 +0000 (11:48 +0100)]
hammer.8 - Adjust info section to match current hammer(8) output.

Submitted-by: Sascha Wildner <saw@online.de>
14 years agokernel - Fix not-quite-nonblocking VX lock in allocfreevnode()
Matthew Dillon [Fri, 15 Jan 2010 05:51:45 +0000 (21:51 -0800)]
kernel - Fix not-quite-nonblocking VX lock in allocfreevnode()

* Introduce LK_NOSPINWAIT to tell lockmgr() to not even spin on the
  spinlock if it can't get it immediately.

* There is a lock order reversal between vfs_spin and vp->v_spinlock
  where vx_lock_nonblock() can deadlock in allocfreevnode().  Normally
  I'd vhold() the vnode but the freelist code is rather fragile and I
  don't want to have to vdrop() later on.  So instead use LK_NOSPINWAIT
  to avoid the situation.

* This is a hack.

14 years agoHAMMER Utility - enhance show-undo
Matthew Dillon [Fri, 15 Jan 2010 04:06:31 +0000 (20:06 -0800)]
HAMMER Utility - enhance show-undo

* Print more of the REDO headers in show-undo now that they have been
  revamped.

14 years agoHAMMER VFS - hammer_inode / vp races
Matthew Dillon [Fri, 15 Jan 2010 04:01:54 +0000 (20:01 -0800)]
HAMMER VFS - hammer_inode / vp races

* The hammer_inode must be locked when clearing the vp during a reclaim
  to interlock with a concurrent reclaim.

* hammer_get_vnode() must hold the vp while holding the hammer_inode locked
  to prevent destruction when racing against drops or reclaims.

* Remove the HAMMER_INODE_VHELD flag.  Backend truncations and the
  last inode release should acquire the vnode properly now in
  hammer_inode_unloadable_check().

14 years agokernel - Fix mislocated __vbusy()
Matthew Dillon [Fri, 15 Jan 2010 04:00:23 +0000 (20:00 -0800)]
kernel - Fix mislocated __vbusy()

* __vbusy(vp) must be called while the vfs_spin lock is held and
  atomic with the acquisition of a vnode from the freelist.

* Document the hell out of vfs_lock.c

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

14 years agokernel - Increase default kern.maxfiles from (maxproc * 2) to (maxproc * 16).
Matthew Dillon [Fri, 15 Jan 2010 03:55:29 +0000 (19:55 -0800)]
kernel - Increase default kern.maxfiles from (maxproc * 2) to (maxproc * 16).

* Increases maxfiles from approximately ~12K to around ~100K on
  systems with moderate amounts of memory.

Reported-by: Peter Avalos <pavalos@theshell.com>
14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 15 Jan 2010 03:45:18 +0000 (19:45 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agokernel - Improve VM fault performance for sequential access
Matthew Dillon [Fri, 15 Jan 2010 03:40:14 +0000 (19:40 -0800)]
kernel - Improve VM fault performance for sequential access

* VM fault I/O pipelining was not working properly.

* Temporarily fix pipelining by introducing PG_RAM, A read-ahead mark
  for vm_page_t, and adjust vm_fault to pass VM pages through to
  getpages calls if PG_RAM is set, even if they are fully valid.

* Remove code in vnode_pager_generic_getpages() which shortcutted
  the operation when the requested page was fully valid.  This
  prevented read-aheads from being issued.

* A more permanent solution is in the works (basically getting rid of
  the whole VM read-ahead/read-behind array entirely, just passing
  a single page through to vnode_pager_generic_getpages(), and
  letting the filesystem handle the read-ahead in a more efficient
  fashion.

Reported-by: "Mikhail T." <mi+thun@aldan.algebra.com>
14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 15 Jan 2010 03:43:38 +0000 (19:43 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agokernel - Improve VM fault performance for sequential access
Matthew Dillon [Fri, 15 Jan 2010 03:40:14 +0000 (19:40 -0800)]
kernel - Improve VM fault performance for sequential access

* VM fault I/O pipelining was not working properly.

* Temporarily fix pipelining by introducing PG_RAM, A read-ahead mark
  for vm_page_t, and adjust vm_fault to pass VM pages through to
  getpages calls if PG_RAM is set, even if they are fully valid.

* Remove code in vnode_pager_generic_getpages() which shortcutted
  the operation when the requested page was fully valid.  This
  prevented read-aheads from being issued.

* A more permanent solution is in the works (basically getting rid of
  the whole VM read-ahead/read-behind array entirely, just passing
  a single page through to vnode_pager_generic_getpages(), and
  letting the filesystem handle the read-ahead in a more efficient
  fashion.

Reported-by: "Mikhail T." <mi+thun@aldan.algebra.com>
14 years agomqueues: Remove duplicate code.
Stathis Kamperis [Thu, 14 Jan 2010 21:27:24 +0000 (23:27 +0200)]
mqueues: Remove duplicate code.

A note that missed from my previous commit:
In issue 6, mq_timed{send, receive}() were optionally expected to return
EINVAL upon an invalid timeout request, if the calling process|thread would
have blocked.
In issue 7 this is now mandatory.

Original-bug-reported-by: swildner@
14 years agomqueues: Return EINVAL upon invalid timeout request.
Stathis Kamperis [Thu, 14 Jan 2010 20:06:03 +0000 (22:06 +0200)]
mqueues: Return EINVAL upon invalid timeout request.

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

14 years agolibrt: Add missing MLINKS.
Sascha Wildner [Thu, 14 Jan 2010 05:21:20 +0000 (06:21 +0100)]
librt: Add missing MLINKS.

14 years agokernel - fifofs - Fix missing token releases
Matthew Dillon [Wed, 13 Jan 2010 18:58:50 +0000 (10:58 -0800)]
kernel - fifofs - Fix missing token releases

* Forgot to release the vfs_token in several places.

Reported-by: Johannes Hofmann <johannes.hofmann@gmx.de>
14 years agokernel - fifofs - Fix missing token releases
Matthew Dillon [Wed, 13 Jan 2010 18:58:50 +0000 (10:58 -0800)]
kernel - fifofs - Fix missing token releases

* Forgot to release the vfs_token in several places.

Reported-by: Johannes Hofmann <johannes.hofmann@gmx.de>
14 years agoHAMMER VFS - REDO implementation base code part 4/many
Matthew Dillon [Wed, 13 Jan 2010 00:01:00 +0000 (16:01 -0800)]
HAMMER VFS - REDO implementation base code part 4/many

* Wait for BIOs to finish before issuing the media sync.  Previously we
  were issuing the media sync concurrently which worked only because
  the operation was serialized by the disk driver.

  This change has no effect on performance.

* For fsync mode 3 wait for BIOs to finish so the data is guaranteed
  to at least be in the drive cache.

* Collapse hammer_io_wait_firm() into hammer_io_wait_all()

* Pipeline hammer_io_wait_all().  Instead of waiting for the running_io
  count to hit 0, which can cause us to wait longer then necessary when
  multiple entities are dirtying buffers, we now place all running I/Os
  on a list along with a dummy entry for the waiter.  When the dummy entry
  becomes the head of the list the waiter returns.

  This way new I/O's initiated during the wait do not contribute to
  the wait.

  In particular this will improve fsync() operations which can flush the
  UNDO/REDO FIFO in parallel with a full meta-data flush.

14 years agoHAMMER VFS - REDO implementation base code part 3/many (addendum2)
Matthew Dillon [Tue, 12 Jan 2010 22:55:41 +0000 (14:55 -0800)]
HAMMER VFS - REDO implementation base code part 3/many (addendum2)

* I/O interlock required when flushing UNDOs because REDOs can now
  be entered without holding the sync_lock.

* We have to cache the UNDO/REDO FIFO's next index before flushing
  in case additional entries are created while we are finishing up
  the flush.

Reported-by: Jan Lentfer <lentferj@crater.dragonflybsd.org>
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.