dragonfly.git
13 years agoHAMMER Utility - Ignore additional failure cases during recover
Matthew Dillon [Wed, 18 Aug 2010 15:10:09 +0000 (08:10 -0700)]
HAMMER Utility - Ignore additional failure cases during recover

* Ignore bad volume specifications in data offsets during a recover
  operation.

Reported-by: "Miro Svetlik" <miro@svetlik.be>
13 years agolibkvm - kvm_get_swapinfo - fix memory leak in last commit
Matthew Dillon [Wed, 18 Aug 2010 00:52:59 +0000 (17:52 -0700)]
libkvm - kvm_get_swapinfo - fix memory leak in last commit

* Fix a memory leak

13 years agolibkvm - Adjust kvm_getswapinfo() to use the new vm.swap_info_array sysctl
Matthew Dillon [Wed, 18 Aug 2010 00:44:10 +0000 (17:44 -0700)]
libkvm - Adjust kvm_getswapinfo() to use the new vm.swap_info_array sysctl

* kvm_getswapinfo() attempts to use the new sysctl and if it fails, or
  if the kvm is operating on a kernel core file, reverts to the namelist.

13 years agokernel - Implement vm.swap_info_array sysctl
Matthew Dillon [Wed, 18 Aug 2010 00:43:02 +0000 (17:43 -0700)]
kernel - Implement vm.swap_info_array sysctl

* Track swap usage on a per-device basis

* Implement the vm.swap_info_array sysctl to retrieve the array.

13 years agokernel - add vm.swap_size sysctl
Matthew Dillon [Tue, 17 Aug 2010 16:56:28 +0000 (09:56 -0700)]
kernel - add vm.swap_size sysctl

* Add vm.swap_size sysctl to complement vm.swap_anon_use and
  vm.swap_cache_use.

Requested-by: Carlos Olmedo Escobar
13 years agoawk: Switch to awk 20100523
Stathis Kamperis [Mon, 16 Aug 2010 17:42:49 +0000 (20:42 +0300)]
awk: Switch to awk 20100523

13 years agoawk: Tweak local patch to apply cleanly to new awk
Stathis Kamperis [Mon, 16 Aug 2010 17:42:24 +0000 (20:42 +0300)]
awk: Tweak local patch to apply cleanly to new awk

13 years agoawk: Remove local patch, it's fixed upstream
Stathis Kamperis [Mon, 16 Aug 2010 17:19:10 +0000 (20:19 +0300)]
awk: Remove local patch, it's fixed upstream

13 years agoawk: Add our README files
Stathis Kamperis [Mon, 16 Aug 2010 17:15:51 +0000 (20:15 +0300)]
awk: Add our README files

13 years agoImport of awk version 20100523
Stathis Kamperis [Mon, 16 Aug 2010 17:12:59 +0000 (20:12 +0300)]
Import of awk version 20100523

13 years agoFix some minor mdoc issues.
Sascha Wildner [Tue, 17 Aug 2010 13:55:50 +0000 (15:55 +0200)]
Fix some minor mdoc issues.

13 years agoMake amdsmb(4) compilable into the kernel and add it to LINT.
Sascha Wildner [Tue, 17 Aug 2010 12:52:50 +0000 (14:52 +0200)]
Make amdsmb(4) compilable into the kernel and add it to LINT.

13 years agoRemove a debugging leftover (thus fixing LINT).
Sascha Wildner [Tue, 17 Aug 2010 10:53:43 +0000 (12:53 +0200)]
Remove a debugging leftover (thus fixing LINT).

CLUSTERDEBUG is a kernel option. So it can't be defined again
unconditionally in the file.

13 years agoRemove some leftovers from the iic upgrade via 'make upgrade'.
Sascha Wildner [Tue, 17 Aug 2010 10:24:15 +0000 (12:24 +0200)]
Remove some leftovers from the iic upgrade via 'make upgrade'.

13 years agoHAMMER Utility - Add catastrophic recovery feature
Matthew Dillon [Tue, 17 Aug 2010 06:49:16 +0000 (23:49 -0700)]
HAMMER Utility - Add catastrophic recovery feature

* hammer -f <devices> recover <empty_target_dir>

* Add a catastrophic recovery feature.  A HAMMER filesystem image is
  scanned (using the -f <blockdevs> specification).  Any buffer which
  looks like a B-Tree node is then sub-scanned for inode, directory, and
  data records and the filesystem is reconstructed in the specified
  target directory.

* The files and directories are initially named after the object id
  and are renamed and moved as directory entries are found to resolve
  the fragmentory information.

* File writes strip trailing 0's (data records are not limited to the
  file EOF), but will properly truncate the file if/when the related
  inode record is found.

* Currently no attempt is made to restore owner, group, file modes,
  softlinks, or hardlinks (only one link will be restored).

TODO: Currently a valid volume header is required, but the only thing
      we actually need from it is the vol_buf_beg field.  This field
      could be guessed or passed in on the command line in a future
      update to the recovery code.

13 years agoHAMMER VFS - Expand vfs.hammer.debug_io capabilities
Matthew Dillon [Tue, 17 Aug 2010 06:18:09 +0000 (23:18 -0700)]
HAMMER VFS - Expand vfs.hammer.debug_io capabilities

* Add debugging capabilities which are able to distinguish IO requests
  which are cached from IO requests which have to go to the device.

* vfs.hammer.debug_io bit 0 (i.e. the value 1) will use the new feature.
  This is for debugging only.

13 years agoHAMMER VFS - Add HAMMER_OFF_BAD
Matthew Dillon [Tue, 17 Aug 2010 06:15:50 +0000 (23:15 -0700)]
HAMMER VFS - Add HAMMER_OFF_BAD

* Add a define for a hammer_off_t representing a bad offset.

13 years agoSync amdpm(4) with FreeBSD (and bring in amdsmb(4)).
Sascha Wildner [Tue, 17 Aug 2010 05:02:07 +0000 (07:02 +0200)]
Sync amdpm(4) with FreeBSD (and bring in amdsmb(4)).

13 years agopowermng: Fix some printf -> kprintf.
Sascha Wildner [Tue, 17 Aug 2010 04:59:44 +0000 (06:59 +0200)]
powermng: Fix some printf -> kprintf.

13 years agoSync alpm(4) with FreeBSD.
Sascha Wildner [Tue, 17 Aug 2010 04:17:06 +0000 (06:17 +0200)]
Sync alpm(4) with FreeBSD.

13 years agoSync zoneinfo database with tzdata2010l from elsie.nci.nih.gov
Sascha Wildner [Tue, 17 Aug 2010 02:36:59 +0000 (04:36 +0200)]
Sync zoneinfo database with tzdata2010l from elsie.nci.nih.gov

africa:         8.27 -> 8.28
asia:           8.60 -> 8.61

* africa: Change Cairo's 2010 reversion to DST from the midnight between
    September 8 and 9 to the midnight between September 9 and 10.

* asia: Change Gaza's 2010 return to standard time to the midnight
    between August 10 and 11.

13 years agoiicbus: Bring us closer to FreeBSD.
Sascha Wildner [Mon, 16 Aug 2010 17:39:23 +0000 (19:39 +0200)]
iicbus: Bring us closer to FreeBSD.

This is work in progress and I commit it so Dave Shao's Summer of Code
project can proceed.

Further commits will follow.

Taken-from: FreeBSD

13 years agoman9/Makefile: Sort alphabetically.
Sascha Wildner [Mon, 16 Aug 2010 09:53:16 +0000 (11:53 +0200)]
man9/Makefile: Sort alphabetically.

13 years agoAdd a dsched(4) manual page.
Sascha Wildner [Mon, 16 Aug 2010 09:45:50 +0000 (11:45 +0200)]
Add a dsched(4) manual page.

dsched(9) will follow.

Submitted-by: alexh
13 years agoAdd a draft mpipe(9) manpage explaining malloc pipelines.
Venkatesh Srinivas [Mon, 16 Aug 2010 06:29:10 +0000 (23:29 -0700)]
Add a draft mpipe(9) manpage explaining malloc pipelines.

13 years agokernel - revamp cluster_read API and improve performance
Matthew Dillon [Mon, 16 Aug 2010 00:20:48 +0000 (17:20 -0700)]
kernel - revamp cluster_read API and improve performance

* Revamp the API to be much less confusing.  Pass a minimum read ahead
  based on the higher level uio length, and a maximum read ahead
  based on the sequential heuristic.  These combine together to determine
  how much read-ahead to do.

  For example if a program is doing random-reads with 1MB read() requests
  the minreq will take precedence, whereas if the program is doing
  sequential-reads of 8K the maxreq will take precedence.

  The sequential heuristic currently maxes out at 128 * 16384 = 2MB.

* Introduce sysctl vfs.max_readahead instead of hardwiring the maximum
  read-ahead.  This defaults to 2MB which is big enough for just about
  anything.  Generally speaking this value should be larger than
  your stripe width.

  Note that currently the sequential heuristic also maxes out at 2MB so
  you cannot go larger than 2MB.

* Also correct bugs that existed in the old cluster_read(), dramatically
  improving performance on striped volumes with large chunk sizes (128K+)
  and a large number of drives (3+).

* No change here but note that HAMMER will currently issue a minimum of
  64K worth of read-ahead when accessing meta-data.

13 years agokernel - fix 64-bit build
Matthew Dillon [Sun, 15 Aug 2010 23:19:19 +0000 (16:19 -0700)]
kernel - fix 64-bit build

* Fix minor cast issue for 64-bit kernel build.

13 years agoHAMMER VFS - Limit queued I/O during flush
Matthew Dillon [Sun, 15 Aug 2010 20:19:00 +0000 (13:19 -0700)]
HAMMER VFS - Limit queued I/O during flush

* Add sysctl vfs.hammer.limit_running_io and preset to a reasonable
  value.

* The flusher was queueing all dirty buffers all at once, sometimes leading
  to 80MB+ worth of I/O.  This blew away dm_crypto (caused it to exceed
  its malloc limit), and also results in generally poor kernel memory
  behavior.

  Limit the amount of in-flight I/O allowed during a flush to ~10MB or so,
  which should be plenty.

13 years agosystat - Add more spacing for the Load
Matthew Dillon [Sun, 15 Aug 2010 19:18:48 +0000 (12:18 -0700)]
systat - Add more spacing for the Load

* Adjust load display so three-digit loads do not crush the display

13 years agokernel - split the pbuf subsystem into two (kva and non-kva)
Matthew Dillon [Sun, 15 Aug 2010 18:57:53 +0000 (11:57 -0700)]
kernel - split the pbuf subsystem into two (kva and non-kva)

Most pbufs do not require kva reservations.  Split the API to provide
pbufs without kva reservations out of a much larger pool of pbufs, fixing
deadlock issues with the DM subsystem.

Note in particular that the hammer reblocker can eat upwards of 5000 pbufs
when operating on multi-layered DM-based storage, which blows away the
256 pbufs normally available with kva reservations that the old API had.

* Getpbuf() / trypbuf() now return pbufs without KVA reservations.

* Add getpbuf_kva() and trypbuf_kva() to get pbufs with KVA reservations.

* Fixes pbuf deadlocks in the low level I/O subsystem, particularly DM
  crypt, stripe, and mirror.

13 years agokernel - dm_crypt - Pre-zero control structures, disable B_HASBOGUS handling
Matthew Dillon [Sun, 15 Aug 2010 15:24:13 +0000 (08:24 -0700)]
kernel - dm_crypt - Pre-zero control structures, disable B_HASBOGUS handling

* Don't take any chances, pre-zero control structures and make sure the
  dmtc is completely initialized.

* Comment out the B_HASBOGUS read-decrypt bogus_page handling code.
  It doesn't work yet and it turns out that it might not even be
  necessary because the decrypter works on 512-byte sub blocks.

13 years agokernel - Add overlapping buffer test to the buffer cache
Matthew Dillon [Sun, 15 Aug 2010 15:20:37 +0000 (08:20 -0700)]
kernel - Add overlapping buffer test to the buffer cache

* Add a test for overlapping buffer in bgetvp().

* Add a sysctl vfs.check_buf_overlap which defaults to enabling the
  check invasively.  Overlapping buffer cache buffers can be deadly.

  0 - disabled
  1 - checked and reported
  2 - checked and panic (invasive) (default)

13 years agoHAMMER VFS - Fix over-enthusiastic cluster read
Matthew Dillon [Sun, 15 Aug 2010 15:14:53 +0000 (08:14 -0700)]
HAMMER VFS - Fix over-enthusiastic cluster read

* The block device I/O was over-enthusiastic in calling cluster_read()
  and could wind up creating the buffers of the wrong size which
  would then overlap the address space later buffer requests for the
  right size.

  This could result in the corruption of large-data (64K) blocks,
  usually causing a hammer reblock to fail with a CRC error but
  not corrupting the actual filesystem on-media.

  Meta data could not usually get corrupted by this unless the
  cluster-read happened to cross a large-block (8MB) boundary.

* Particularly easy to reproduce with the dm_crypt module due to
  crypt overheads.

* Fixed by disallowing read-aheads in the large-data zone (the only
  zone which can contain a mix of 16K and 64K blocks), and ensuring
  that any other cluster_read does not cross a large-block boundary.

13 years agolvm - don't forget to include dlfcn.h
Alex Hornung [Sun, 15 Aug 2010 12:24:24 +0000 (13:24 +0100)]
lvm - don't forget to include dlfcn.h

* dlfcn is needed for some of the functions used in toolcontext.c, so
  include it on DragonFly, too.

Reported-by: Sascha Wildner (swildner@)
13 years agolvm - adjust visibility for devname
Alex Hornung [Sun, 15 Aug 2010 12:20:33 +0000 (13:20 +0100)]
lvm - adjust visibility for devname

* adjust visibility in lib/dragonfly/dev.c to show devname(), avoiding
  truncation of higher 32 bits on x86_64, since otherwise the return
  value defaults to int.

Reported-by: Sascha Wildner (swildner@)
13 years agolinuxulator - Acquire MPLOCK for ksignal
Alex Hornung [Sun, 15 Aug 2010 10:09:26 +0000 (11:09 +0100)]
linuxulator - Acquire MPLOCK for ksignal

* Don't forget to acquire mplock for ksignal, or otherwise we'll get a
  panic (MP_LOCK_HELD: Not held thread foo).

13 years agokernel - dm - Reorganize the crypt code and implement B_HASBOGUS
Matthew Dillon [Sun, 15 Aug 2010 00:51:42 +0000 (17:51 -0700)]
kernel - dm - Reorganize the crypt code and implement B_HASBOGUS

* Implement B_HASBOGUS data copying for read decryption.  When a buffer
  contains bogus pages we may or may not be able to safely decrypt data
  in-place, add some code to deal with it.

* Reorganize the crypt code.  Separate the read and write paths and
  organize the procedures in the same order as the execution stages.
  Also move some of the buffer manipulation around a little to make
  it more clear.

Submitted-by: alexh (B_HASBOGUS handling)
13 years agokernel - dm - Fix panic in dm_target_crypt
Matthew Dillon [Sat, 14 Aug 2010 23:19:17 +0000 (16:19 -0700)]
kernel - dm - Fix panic in dm_target_crypt

* Fix a misordered kfree()

* Minor cleanup

Reported-by: alexh
13 years agocryptsetup - fix buffer overflow
Alex Hornung [Sat, 14 Aug 2010 22:01:47 +0000 (23:01 +0100)]
cryptsetup - fix buffer overflow

* fix a buffer overflow introduced during the porting. Linux originally
  did digest = gcry_md_read(hd, hash_id); memcpy(dst, digest, len);
  I ported that to do EVP_DigestFinal directly into dst, causing
  corruption. Avoid this by writing to some intermediate (large) buffer
  and then using memcpy like Linux does.

13 years agocryptsetup - fix issue with uuid
Alex Hornung [Sat, 14 Aug 2010 20:17:27 +0000 (21:17 +0100)]
cryptsetup - fix issue with uuid

* the whole codepath related to uuid was a bit messy. Nothing should've
  been done if uuid==NULL and the result was passed in as integer, not
  pointer...

13 years agokernel - netif - temporary hack for IFT_ETHER
Matthew Dillon [Sat, 14 Aug 2010 19:10:39 +0000 (12:10 -0700)]
kernel - netif - temporary hack for IFT_ETHER

* Temporarily hack if_alloc() to allocate a struct arpcom instead of a
  struct ifnet when IFT_ETHER is passed in, until we can adjust all the
  drivers to use the ifnet->if_l2com API.

Reported-by: Johannes Hofmann <johannes.hofmann@gmx.de>
13 years agokernel - dm - Add support for BUF_CMD_FLUSH
Matthew Dillon [Sat, 14 Aug 2010 19:04:52 +0000 (12:04 -0700)]
kernel - dm - Add support for BUF_CMD_FLUSH

* Change the nestiobuf_*() code to count the number of sub-bios issued
  instead of counting the resid.  This allows the nestiobuf_*() API to
  be used to BUF_CMD_FLUSH.

* Change the nestiobuf_*() API.  The nestiobuf_start() command is now
  nestiobuf_add().  Add a nestiobuf_init(mbio) and nestiobuf_start(mbio)
  wrapper around the adds.

* Explicitly check for allowed BUF_CMD_* commands in device-mapper.c

* Add a bypass to device-mapper.c to cause certain commands to be sent
  to all tbl's (BUF_CMD_FLUSH).

* Add explicit suppor for BUF_CMD_FLUSH to dm_target_stripe.c

* Change b_resid loading semantics to load upon completion of the
  I/O.

13 years agokernel - flag when bogus_page's are present
Matthew Dillon [Sat, 14 Aug 2010 17:53:43 +0000 (10:53 -0700)]
kernel - flag when bogus_page's are present

* Flag a buffer when bogus pages are present.  Add B_HASBOGUS to b_flags.

  Certain in-place read operations, such as decryption, must allocate a
  copy if the original buffer contains bogus pages.

13 years agokernel - dm - rewrite dm_target_stripe.c to add functionality and fix bugs
Matthew Dillon [Sat, 14 Aug 2010 17:06:21 +0000 (10:06 -0700)]
kernel - dm - rewrite dm_target_stripe.c to add functionality and fix bugs

* The stripe code now allows up to 32 devices, instead of just 2
* The stripe code now properly cleans up partial configurations which
  fail in the device loop.

* Fix improper use of M_NOWAIT
* Fix improper use of malloc pool in *_status functions
* Fix improper use of namespace (atoi -> atoi64)
* Cleanup some M_DM malloc declarations

13 years agokernel - devfs - Fix dangling lock created by recent commit
Matthew Dillon [Sat, 14 Aug 2010 15:45:50 +0000 (08:45 -0700)]
kernel - devfs - Fix dangling lock created by recent commit

* devfs_freep() is not always called with devfs_lock held

Reported-by: alexh
13 years agolibdm/lvm - Fix bugs
Alex Hornung [Sat, 14 Aug 2010 08:37:54 +0000 (09:37 +0100)]
libdm/lvm - Fix bugs

* Allow adding symlinks to lvm's dev-cache by translating the symlink
  for udev/libdevattr.

* Don't include kdev_t.h in libdm since it has the wrong macros for
  MAJOR and MINOR; instead include netbsd's version.

Reported-by: Matt Dillon (dillon@)
13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sat, 14 Aug 2010 01:01:13 +0000 (18:01 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agokernel - kqueue - fix EVFILT_WRITE notification on pipes
Matthew Dillon [Sat, 14 Aug 2010 00:59:47 +0000 (17:59 -0700)]
kernel - kqueue - fix EVFILT_WRITE notification on pipes

* The pipe code was running the wrong kqueue for write buffer
  availability notifications, so things like scp transfers were timing
  out once the write socket filled up when they tried to poll() for
  more space.

Reported-by: swildner
13 years agoFix a printf issue in bthcid(8) (fixes x86_64 buildworld).
Sascha Wildner [Fri, 13 Aug 2010 23:21:42 +0000 (01:21 +0200)]
Fix a printf issue in bthcid(8) (fixes x86_64 buildworld).

13 years agokernel - make POLLHUP conform better to OpenGroup
Matthew Dillon [Fri, 13 Aug 2010 22:06:12 +0000 (15:06 -0700)]
kernel - make POLLHUP conform better to OpenGroup

* The poll() backend now only evaluates EV_EOF for EVFILT_WRITE, and
  generates a POLLHUP which is properly mutually exclusive with
  POLLWRNORM and POLLOUT.

  We do this even for a half-closed (write-side-closed) socket.

* We no longer set POLLHUP for POLLRD* or POLLIN, instead relying on
  the userland doing the read() and checking the 0 result (which
  userland has always done historically).

  EV_EOF for EVFILT_READ cannot be used to set POLLHUP for POLLRD* or
  POLLIN because it could indicate a half-closed connection
  (read-side-closed) where writing is still allowed, which is a more
  common situation on sockets.

  We would have to add another EV_ flag to set POLLHUP for POLLRD* or
  POLLIN to detect the fully disconnected state.  The OpenGroup standard
  does allow POLLHUP to be mixed with POLLRD* or POLLIN but for now we
  just don't set it at all in that case.

  Only a POLLOUT/POLLWRNORM flag request can cause POLLHUP to be set
  for now.

13 years agokernel - More kqueue work
Matthew Dillon [Fri, 13 Aug 2010 21:05:45 +0000 (14:05 -0700)]
kernel - More kqueue work

* Only set EV_EOF in the read filter after all pending data has
  been exhausted.

* This also fixes a bug where the read filter was not setting data
  ready on EOF when data was pending in the buffer.

* Fix bugs in the poll copyout handler.  An EOF condition does not
  prevent other flags from getting set.

13 years agokernel - Some minor swap allocator / blist work
Matthew Dillon [Fri, 13 Aug 2010 21:00:06 +0000 (14:00 -0700)]
kernel - Some minor swap allocator / blist work

* Fix a bug in the 'r' option for the userland compile of the blist code

* Finish converting daddr_t's to swblk_t's in the swap code.

* Move SWAPBLK_* out of vm/vm_page.h (taken from FreeBSD) to reduce
  the number of #includes needed.  Move them to sys/blist.h

Reported-by: Ilya Dryomov <idryomov@gmail.com>
13 years agostress2 - Use statvfs to fix calculations for large filesystems
Matthew Dillon [Fri, 13 Aug 2010 15:50:03 +0000 (08:50 -0700)]
stress2 - Use statvfs to fix calculations for large filesystems

* Use statvfs to avoid available space overflow in calculation.

13 years agolibdevattr - Minimal error checking in devattr_test
Antonio Huete Jimenez [Fri, 13 Aug 2010 11:49:45 +0000 (13:49 +0200)]
libdevattr - Minimal error checking in devattr_test

13 years agolibevent - Remove from tree
Samuel J. Greear [Thu, 12 Aug 2010 15:09:37 +0000 (15:09 +0000)]
libevent - Remove from tree

* There are no longer any in-tree consumers

* Maintenance burden is moved to pkgsrc

13 years agoftp-proxy - Port from libevent to kqueue(2)/kevent(2)
Samuel J. Greear [Fri, 13 Aug 2010 01:06:38 +0000 (01:06 +0000)]
ftp-proxy - Port from libevent to kqueue(2)/kevent(2)

* Was using libevent's bufferevent* API, we let the socket buffers do
  most of the work.

13 years agobthcid - Port from libevent to kqueue(2)/kevent(2)
Samuel J. Greear [Thu, 12 Aug 2010 14:48:31 +0000 (14:48 +0000)]
bthcid - Port from libevent to kqueue(2)/kevent(2)

13 years agokernel - Fix reboot races
Matthew Dillon [Fri, 13 Aug 2010 05:45:25 +0000 (22:45 -0700)]
kernel - Fix reboot races

* Fix a pty revoke race null pointer indirection during reboot

* Fix a deadlock with devfs (introduced by a recent commit) by
  not having devfs_config() do anything if it is called from
  the message core itself.

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 13 Aug 2010 04:50:49 +0000 (21:50 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agokernel - devfs - Fix deadlocks
Matthew Dillon [Fri, 13 Aug 2010 04:49:03 +0000 (21:49 -0700)]
kernel - devfs - Fix deadlocks

* Fix a deadlocks when the core thread attempts to free a node.  The
  devfs lock must be released when obtaining the vnode lock.  Fixes
  issues with ls -la /dev/pts when running stress2{pts}.

* Adjust devfs_config() to not attempt to message the devfs core thread
  if the core thread has terminated (fixes issues with reboot).

13 years agokernel - Add sysref assertions
Matthew Dillon [Fri, 13 Aug 2010 04:48:45 +0000 (21:48 -0700)]
kernel - Add sysref assertions

* Add more checks in the sysref code to detect use-after-free situations.

13 years agoAdjust the docs for the renaming of devfs_clone_bitmap_rst() to _put().
Sascha Wildner [Fri, 13 Aug 2010 04:33:02 +0000 (06:33 +0200)]
Adjust the docs for the renaming of devfs_clone_bitmap_rst() to _put().

13 years agokernel - Add sysref assertions
Matthew Dillon [Fri, 13 Aug 2010 04:11:20 +0000 (21:11 -0700)]
kernel - Add sysref assertions

* Add checks in the sysref code to detect use-after-free situations.

13 years agokernel - More tty and devfs race fixes
Matthew Dillon [Fri, 13 Aug 2010 04:09:13 +0000 (21:09 -0700)]
kernel - More tty and devfs race fixes

* Refactor the unix98 pty code to consolidate termination handling and
  add flags to deal with close() races.

* Rename devfs_clone_bitmap_rst() to devfs_clone_bitmap_put()

* devfs_clone_bitmap_put() now syncs devfs messages before clearing
  the bitmap bit, to ensure that related destroy_dev()s complete
  before the unit number becomes available for a new allocation
  again.

Reported-by: swildner
13 years agoHAMMER VFS - Adjust signedness of a media field for future de-dup
Matthew Dillon [Fri, 13 Aug 2010 02:02:34 +0000 (19:02 -0700)]
HAMMER VFS - Adjust signedness of a media field for future de-dup

* Make bytes_free in hammer_blockmap_layer2 a signed field and remove
  KKASSERT() that disallowed a negative value.

  This field can go negative in a future data de-dup implementation.

13 years agokernel - Fix pty registration, memory leak
Matthew Dillon [Fri, 13 Aug 2010 01:55:20 +0000 (18:55 -0700)]
kernel - Fix pty registration, memory leak

* Properly unregister the pt_ioctl before freeing it.

* Free the pt_ioctl structure after destroying the device, fixing
  a memory leak.

* Fix races in the sysctl_proc which iterates the tty list by using
  a marker.

13 years agokernel - Fix pty clone vnode leak
Matthew Dillon [Fri, 13 Aug 2010 01:20:41 +0000 (18:20 -0700)]
kernel - Fix pty clone vnode leak

* Any cloned devfs device (vn, tap, ptmx primarily) was leaving an extra
  vref on the related vnode, preventing the vnode from being recycled.

  This was due to devfs called vop_stdopen() but forgetting that
  vop_stdopen() will load the file pointer (fp), which devfs was also
  loading.  All devfs really needs to do is to replace fp->f_ops.

Reported-by: swildner
13 years agoAdd DSCHED_FQ to GENERIC.
Venkatesh Srinivas [Fri, 13 Aug 2010 00:12:49 +0000 (17:12 -0700)]
Add DSCHED_FQ to GENERIC.

13 years agokernel - Adjust krate infrastructure
Matthew Dillon [Wed, 11 Aug 2010 20:59:36 +0000 (13:59 -0700)]
kernel - Adjust krate infrastructure

* Move struct krate from sys/time.h to sys/resourcevar.h

* Remove krate from struct uidinfo, it created too much breakage
  in the buildworld.  Declare it as a static instead.

13 years agobuildworld - Fix breakage
Matthew Dillon [Wed, 11 Aug 2010 20:07:29 +0000 (13:07 -0700)]
buildworld - Fix breakage

* More cases where sys/user.h is not included early enough.

Reported-by: swildner
13 years agobuildworld - Fix breakage
Matthew Dillon [Wed, 11 Aug 2010 20:00:29 +0000 (13:00 -0700)]
buildworld - Fix breakage

* Fix some _KERNEL_STRUCTURES breakage.  This isn't a fantastic solution
  but it works.

Reported-by: swildner
13 years agoobjcache.9: Oops, .Vt actually.
Sascha Wildner [Wed, 11 Aug 2010 19:56:01 +0000 (21:56 +0200)]
objcache.9: Oops, .Vt actually.

13 years agoobjcache.9: Use .Ft for a type.
Sascha Wildner [Wed, 11 Aug 2010 19:50:49 +0000 (21:50 +0200)]
objcache.9: Use .Ft for a type.

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Tue, 10 Aug 2010 23:35:00 +0000 (16:35 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agokernel - Add per-user file descriptor limit
Matthew Dillon [Tue, 10 Aug 2010 23:27:27 +0000 (16:27 -0700)]
kernel - Add per-user file descriptor limit

* Add kern.maxfilesperuser and kern.minfilesperproc to complement the
  kern.maxfilesperproc which already exists.  Print a warning on the
  console if a user hits the limit (rate limited).

* Track per-user files via the uidinfo structure.  Each file pointer counts
  as one file.  dup()'d and fork()'d file descriptors do not count.

* Adjust the default user limits to approximately 1/4 the system maximums
  instead of 9/10 the system maximums.  This reduces the maximum descriptors
  per process and the maximum processes per uid.  They can be raised again
  via sysctl.

* Set minfilesperproc to 8 by default.  This is a safety which guarantees
  that a process can always have at least that many open descriptors
  without tripping over kern.maxfilesperuser.

Reported-by: swildner
13 years agolibthread_xu: Convert 0 to NULL for pointer assignment.
Venkatesh Srinivas [Tue, 10 Aug 2010 22:01:01 +0000 (15:01 -0700)]
libthread_xu: Convert 0 to NULL for pointer assignment.

13 years agokernel - Fix lockf panic
Matthew Dillon [Tue, 10 Aug 2010 20:09:10 +0000 (13:09 -0700)]
kernel - Fix lockf panic

* Fix a case where the F_UNLCK call made by closef()/fdrop() could fail
  on a resource limit, preventing the locks from being properly cleared.
  This resulted in an assertion panic at exit1().

* Minor cleanups.

Reported-by: swildner
13 years agoSome cleanup in the pf manual pages.
Sascha Wildner [Tue, 10 Aug 2010 19:22:05 +0000 (21:22 +0200)]
Some cleanup in the pf manual pages.

13 years agokqueue - Fix junk kfree() in doselect()
Matthew Dillon [Tue, 10 Aug 2010 16:58:39 +0000 (09:58 -0700)]
kqueue - Fix junk kfree() in doselect()

* Fix uninitialized fields which could cause kfree() to be called on
  junk data when a copyin error occurs.

* Minor cleanups.

Reported-by: swildner
13 years agoRemove old ftp-proxy per 'make upgrade'.
Sascha Wildner [Tue, 10 Aug 2010 10:12:52 +0000 (12:12 +0200)]
Remove old ftp-proxy per 'make upgrade'.

13 years agopf(4): Remove a ', 1' that had no effect (OpenBSD dev too tired, I guess).
Sascha Wildner [Tue, 10 Aug 2010 03:20:49 +0000 (05:20 +0200)]
pf(4): Remove a ', 1' that had no effect (OpenBSD dev too tired, I guess).

13 years agoaicasm: Correct logic bug in the undefined register bit access detection code.
Sascha Wildner [Tue, 10 Aug 2010 01:45:18 +0000 (03:45 +0200)]
aicasm: Correct logic bug in the undefined register bit access detection code.

Quoting FreeBSD's commit msg:

The code in question verifies that all register write operations only change
bits that are defined (in the register definition file) for that effected
register.  The bug effectively disabled this checking.

o Fix the check by testing the opcode against all supported read ("and" based)
  operands.

o Add missing bit definitions to the aic7xxx and aic79xx register definition
  files so that the warning (treated as a fatal error) does not spuriously
  fire.

Taken-from: FreeBSD

[While I'm here, also add a missing free() and raise WARNS to 6.]

13 years agoEliminate XIG server workaround in fp_mmap; just an artifact of copying from kern_mmap.
Venkatesh Srinivas [Tue, 10 Aug 2010 00:47:49 +0000 (17:47 -0700)]
Eliminate XIG server workaround in fp_mmap; just an artifact of copying from kern_mmap.

13 years agoDocument sysctls vm.fast_fault, vm.dreadful_invltlb, lwkt.preempt_hit/_miss,
Venkatesh Srinivas [Tue, 10 Aug 2010 00:12:05 +0000 (17:12 -0700)]
Document sysctls vm.fast_fault, vm.dreadful_invltlb, lwkt.preempt_hit/_miss,
vm.swap_idle_threshold1/2.

13 years agoVM - Enable idlezero by default.
Venkatesh Srinivas [Mon, 9 Aug 2010 23:55:01 +0000 (16:55 -0700)]
VM - Enable idlezero by default.

13 years agopf.conf.5: Minor adjustments
Thomas Nikolajsen [Mon, 9 Aug 2010 22:58:03 +0000 (00:58 +0200)]
pf.conf.5: Minor adjustments

 * delete duplicate/extra lines
 * interface group not supperted on our ifconfig(8)
 * syntax adjustments

13 years agoUndo part of the last change until I understand why it broke buildkernel.
Sascha Wildner [Mon, 9 Aug 2010 20:38:39 +0000 (22:38 +0200)]
Undo part of the last change until I understand why it broke buildkernel.

13 years agoFix some mis-usage of && and || in the kernel.
Sascha Wildner [Mon, 9 Aug 2010 20:28:26 +0000 (22:28 +0200)]
Fix some mis-usage of && and || in the kernel.

13 years agosound(4): Fix typos: illeagal -> illegal
Sascha Wildner [Mon, 9 Aug 2010 20:22:45 +0000 (22:22 +0200)]
sound(4): Fix typos: illeagal -> illegal

13 years agowlan(4): Replace GNU old-style field designators with proper C.
Sascha Wildner [Mon, 9 Aug 2010 18:58:11 +0000 (20:58 +0200)]
wlan(4): Replace GNU old-style field designators with proper C.

This GCC extension has been considered obsolete since 1993.

13 years agokernel - Move KNOTE() out of interrupt path
Samuel J. Greear [Mon, 9 Aug 2010 18:00:33 +0000 (18:00 +0000)]
kernel - Move KNOTE() out of interrupt path

13 years agopf: Fix if_pfsync to compile
Jan Lentfer [Mon, 9 Aug 2010 14:02:09 +0000 (16:02 +0200)]
pf: Fix if_pfsync to compile

if_pfsync has to be enabled in the
kernel config file.
It passed the last update unattended.
This patch let's it compile, but function
is untested, also tdb functioniality
has been removed.

13 years agopf(4): Add missing file to sys/conf/files for building pf into the kernel.
Sascha Wildner [Mon, 9 Aug 2010 08:04:48 +0000 (10:04 +0200)]
pf(4): Add missing file to sys/conf/files for building pf into the kernel.

13 years agopfctl(8): Fix some little printf() issues on x86_64 (fixes buildworld).
Sascha Wildner [Sun, 8 Aug 2010 21:24:30 +0000 (23:24 +0200)]
pfctl(8): Fix some little printf() issues on x86_64 (fixes buildworld).

13 years ago.gitignore: Add *.bak, *.core, *.old and .depend.
Sascha Wildner [Sun, 8 Aug 2010 20:39:12 +0000 (22:39 +0200)]
.gitignore: Add *.bak, *.core, *.old and .depend.

13 years ago.gitignore: Sort alphabetically.
Sascha Wildner [Sun, 8 Aug 2010 20:38:18 +0000 (22:38 +0200)]
.gitignore: Sort alphabetically.

13 years agoftp-proxy(8): Remove leftover .depend.
Sascha Wildner [Sun, 8 Aug 2010 20:29:36 +0000 (22:29 +0200)]
ftp-proxy(8): Remove leftover .depend.

13 years agoftp-proxy: Update to OpenBSD 4.1
Jan Lentfer [Sun, 8 Aug 2010 16:47:04 +0000 (18:47 +0200)]
ftp-proxy: Update to OpenBSD 4.1

ftp-proxy has been moved from libexec/ to usr.sbin/

13 years agopflogd: Update to OpenBSD 4.1
Jan Lentfer [Sun, 8 Aug 2010 16:43:17 +0000 (18:43 +0200)]
pflogd: Update to OpenBSD 4.1

13 years agokernel - Fix kqueue panic on signal event knote
Matthew Dillon [Sun, 8 Aug 2010 19:43:04 +0000 (12:43 -0700)]
kernel - Fix kqueue panic on signal event knote

* sig_filtops filters on a process, not a file descriptor.  Remove
  the FILTEROP_ISFD flag.

  This should fix a panic when the kqueue is closed while the signal
  event is still active.

Reported-by: Jan Lentfer <Jan.Lentfer@web.de>