dragonfly.git
18 months agoSync zoneinfo database with tzdata2013c from ftp://ftp.iana.org/tz/releases DragonFly_RELEASE_3_2
Sascha Wildner [Mon, 22 Apr 2013 18:08:50 +0000 (20:08 +0200)]
Sync zoneinfo database with tzdata2013c from ftp://ftp.iana.org/tz/releases

* antarctica/australasia/zone.tab: Fix times of habitation for Macquarie
    to agree with the Tasmania Parks & Wildlife Service history, which
    indicates that permanent habitation was 1899-1919 and 1948 on. It is
    politically part of Australia, not Antarctica. (Thanks to Tobias
    Conradi.) Also, sort Macquarie more consistently with other parts of
    Australia. (Thanks to Tim Parenti.)

* asia: Palestine observed DST starting March 29, 2013. (Thanks to
    Steffen Thorsen.)  From 2013 on, Gaza and Hebron both observe DST,
    with the predicted rules being the last Thursday in March at 24:00
    to the first Friday on or after September 21 at 01:00. Also, fix
    some historical data for Palestine to agree with that of
    timeanddate.com.

* southamerica: Assume that the recent change to Paraguay's DST rules is
    permanent, by moving the end of DST to the 4th Sunday in March every
    year. (Thanks to Carlos Raul Perasso.)

18 months agokernel/checkpoint: Fix wrong sizeof (p_sigacts is a pointer).
Sascha Wildner [Tue, 16 Apr 2013 17:13:19 +0000 (19:13 +0200)]
kernel/checkpoint: Fix wrong sizeof (p_sigacts is a pointer).

18 months agoMakefile_upgrade.inc: Fix typo.
Sascha Wildner [Wed, 10 Apr 2013 16:12:08 +0000 (18:12 +0200)]
Makefile_upgrade.inc: Fix typo.

18 months agolock(1): Use %jd for printing intmax_t.
Sascha Wildner [Sat, 30 Mar 2013 12:20:58 +0000 (13:20 +0100)]
lock(1): Use %jd for printing intmax_t.

18 months agolock(1): Do not require 'options COMPAT_43' in the kernel config.
Sascha Wildner [Fri, 29 Mar 2013 10:02:49 +0000 (11:02 +0100)]
lock(1): Do not require 'options COMPAT_43' in the kernel config.

We commented out COMPAT_43 in our configs some time ago, which broke
lock(1) that needed TIOCGETP and TIOCSETP ioctls which are only
available with COMPAT_43.

This commit converts lock(1) to use tcgetattr(3) and tcsetattr(3),
along with some minor cleanups.

Reported-by: noway on #dragonflybsd
Submitted-by: Joris Giovannangeli <joris@giovannangeli.fr>
Taken-from:   FreeBSD

18 months agolibc - MFC dmalloc -> nmalloc for 3.2-REL x86-64
Matthew Dillon [Thu, 28 Mar 2013 06:04:40 +0000 (23:04 -0700)]
libc - MFC dmalloc -> nmalloc for 3.2-REL x86-64

* MFC dmalloc -> nmalloc for 3.2-REL x86-64

* We should be using nmalloc here anyway.  This also conveniently fixes
  a mutual initialization dependency between pthreads and dmalloc
  (adjusting the constructor priority doesn't help).

Reported-by: Sven Gaerner <sgaerner@gmx.net>
19 months agonatacontrol(8): Add commands to tweak power/acoustic management features.
Sascha Wildner [Sat, 23 Mar 2013 19:21:29 +0000 (20:21 +0100)]
natacontrol(8): Add commands to tweak power/acoustic management features.

Sometimes disks designed to operate in low power mode by default
constantly spin up/down during operation which leads to reduced
performance.

This commit adds the 'feature' command to natacontrol(8) which
can be used to tweak the 'advanced power management' and 'automatic
acoustic management' features. Their current setting could already
be viewed before this commit using the 'natacontrol cap' command.

I'd like this to be possible with camcontrol(8) too for CAM attached
disks, but afaict these are ATA specific features so I guess we'd
have to integrate ATA into CAM too before that is possible.

Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/2531>
Reported-by: Maurizio Lombardi <m.lombardi85@gmail.com>
Taken-from:    FreeBSD PR 81692
Tested-by: Maurizio Lombardi <m.lombardi85@gmail.com>
19 months agolibthread_xu: Remove unnecessary calls to _thr_check_init()
Markus Pfeiffer [Tue, 19 Mar 2013 18:57:36 +0000 (18:57 +0000)]
libthread_xu: Remove unnecessary calls to _thr_check_init()

With the previous commit it becomes unnecessary to check whether
libpthread has been initialised. This gets rid of some checks in
hot codepaths.

19 months agolibc/libthread_xu - Fix segfault caused by libpthread used before initialised
Markus Pfeiffer [Mon, 18 Mar 2013 21:46:24 +0000 (21:46 +0000)]
libc/libthread_xu - Fix segfault caused by libpthread used before initialised

If a binary has libpthread as dependency and is linked against libintl,
or any other library that uses pthread locking primitives from libc
without depending on libpthread itself it can happen that functions
from libpthread are called before libpthread's constructor has been
called. This leads to a segfault.

This fix adds a weak symbold to libc, namely _pthread_init_early,
which is called from a libc constructor function and therefore makes
sure that libpthread is initialised early enough.

Thanks to Simon Schubert, Angelos Oikonomopoulos, and Sascha Wildner
for the support in debugging this.

19 months agokernel/mfi: Move the dereference of 'sc' below the NULL check.
Sascha Wildner [Fri, 22 Mar 2013 21:54:08 +0000 (22:54 +0100)]
kernel/mfi: Move the dereference of 'sc' below the NULL check.

19 months agoSync zoneinfo database with tzdata2013b from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Thu, 14 Mar 2013 17:10:19 +0000 (18:10 +0100)]
Sync zoneinfo database with tzdata2013b from ftp://ftp.iana.org/tz/releases

* africa: Morocco does not observe DST during Ramadan; try to predict
    Ramadan in Morocco as best we can. (Thanks to Erik Homoet for the
    heads-up.)

* northamerica: Haiti uses US daylight-saving rules this year, and
    presumably future years. This changes recent time stamps. (Thanks
    to Steffen Thorsen.)

* southamerica: Paraguay will end DST on March 24 this year. For now,
    assume it's just this year. (Thanks to Steffen Thorsen.)

19 months agovarsym.1: Use EXIT STATUS.
Sascha Wildner [Fri, 1 Mar 2013 08:14:51 +0000 (09:14 +0100)]
varsym.1: Use EXIT STATUS.

19 months agoRevert "ddb.4 - Mention recently added 'show tokens' command."
Sascha Wildner [Sat, 9 Mar 2013 11:43:21 +0000 (12:43 +0100)]
Revert "ddb.4 - Mention recently added 'show tokens' command."

This reverts commit 7aac63ea42ea33f28ccf859ff4f76584cda81a01.

Damn, I meant to cherry-pick a different commit.

19 months agoddb.4 - Mention recently added 'show tokens' command.
Antonio Huete Jimenez [Fri, 8 Mar 2013 13:32:12 +0000 (14:32 +0100)]
ddb.4 - Mention recently added 'show tokens' command.

19 months agoSync zoneinfo database with tzdata2013a from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Thu, 7 Mar 2013 02:04:19 +0000 (03:04 +0100)]
Sync zoneinfo database with tzdata2013a from ftp://ftp.iana.org/tz/releases

* antarctica & southamerica: Chile's 2013 rules, and we guess rules for
    2014 and later, will be the same as 2012, namely Apr Sun>=23 03:00 UTC
    to Sep Sun>=2 04:00 UTC. (Thanks to Steffen Thorsen and Robert Elz.)

* europe: New "Asia/Khandyga" and "Asia/Ust-Nera" and "Europe/Busingen"
    zones. Also, improve the commentary about which districts observe
    what times in Russia. (Thanks to Tobias Conradi, Oscar van Vlijmen
    and Arthur David Olson.)

* various files: Many changes affecting historical time stamps before
    1940. These were deduced from: Milne J. Civil time. Geogr J. 1899
    Feb;13(2):173-94 <http://www.jstor.org/stable/1774359>.

19 months agovarsym(1) - Fix return codes.
Antonio Huete Jimenez [Thu, 28 Feb 2013 23:29:59 +0000 (00:29 +0100)]
varsym(1) - Fix return codes.

* varsym was always returning 0 (success) which was incorrect.
* Return codes are now as indicated in the man page.

Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/2517>
Reported-by: Dmitry Razumovsky
19 months agolibc/regex: Fix setting the maximum of the range.
Sascha Wildner [Fri, 1 Mar 2013 21:59:55 +0000 (22:59 +0100)]
libc/regex: Fix setting the maximum of the range.

19 months agokernel/ic: Fix allocation of the output buffer.
Sascha Wildner [Fri, 1 Mar 2013 21:04:51 +0000 (22:04 +0100)]
kernel/ic: Fix allocation of the output buffer.

19 months agondis(4): Fix a wrong assignment.
Sascha Wildner [Fri, 1 Mar 2013 20:50:43 +0000 (21:50 +0100)]
ndis(4): Fix a wrong assignment.

19 months agomfi(4): Fix a wrong assignment.
Sascha Wildner [Fri, 1 Mar 2013 20:29:27 +0000 (21:29 +0100)]
mfi(4): Fix a wrong assignment.

19 months agokernel/u4b: sc is NULL here, so don't dereference it.
Sascha Wildner [Thu, 28 Feb 2013 18:35:23 +0000 (19:35 +0100)]
kernel/u4b: sc is NULL here, so don't dereference it.

19 months agokernel - Fix incorrectly ordered lwkt_reltoken() call in pageout daemon
Matthew Dillon [Thu, 28 Feb 2013 17:01:04 +0000 (09:01 -0800)]
kernel - Fix incorrectly ordered lwkt_reltoken() call in pageout daemon

* The pageout daemon was incorrectly swapping the top two VM objects
  in order to drop the prior object in a specific case where the 'new'
  object being rotated into is NULL.

19 months agoisp(4): Remove a duplicate xpt_alloc_ccb() that was causing leakage.
Sascha Wildner [Tue, 26 Feb 2013 21:50:25 +0000 (22:50 +0100)]
isp(4): Remove a duplicate xpt_alloc_ccb() that was causing leakage.

Confirmed-by: mjacob@
19 months agoccd(4): Fix operator precedence.
Sascha Wildner [Sun, 24 Feb 2013 15:39:24 +0000 (16:39 +0100)]
ccd(4): Fix operator precedence.

20 months agoaltq/hfsc: Fix wrong malloc size
Sepherosa Ziehau [Fri, 22 Feb 2013 07:16:36 +0000 (15:16 +0800)]
altq/hfsc: Fix wrong malloc size

Reported-by: pavalos@
20 months agomake upgrade: Remove another manpage (an MLINK) which has changed name.
Sascha Wildner [Mon, 11 Feb 2013 11:19:49 +0000 (12:19 +0100)]
make upgrade: Remove another manpage (an MLINK) which has changed name.

20 months agocsu: Fix .eh_frame_hdr errors seen on i386
John Marino [Mon, 18 Feb 2013 00:15:59 +0000 (01:15 +0100)]
csu: Fix .eh_frame_hdr errors seen on i386

The libcsu object files should have been generated with
-fno-asynchronous-unwind-tables.  The crtbegin*, crtend* objects,
specific to a compiler, were generated with this flag on both platforms
as seen in the vendor build.  This commit builds libcsu with the same
cflags on both platforms, and it allows the error frame header to get
built successfully.

This has been seen on i386 for a while, and later bug #2511 hit upon
it outside of the world build.

20 months agobsd.cpu.gcc47.mk: Add default cpu extensions
John Marino [Sat, 16 Feb 2013 12:48:47 +0000 (13:48 +0100)]
bsd.cpu.gcc47.mk: Add default cpu extensions

For the normal case, a standard MACHINE_CPU is supposed to be defined, but
that wasn't happening.  Copy code from bsd.cpu.gcc44.mk to fix dports
looking at MACHINE_CPU variable value.

20 months agobridge: Disable TSO on member interface
Sepherosa Ziehau [Wed, 13 Feb 2013 05:44:54 +0000 (13:44 +0800)]
bridge: Disable TSO on member interface

Report-by: dillon@
20 months agoUpdate files for OpenSSL-1.0.1e import.
Peter Avalos [Wed, 13 Feb 2013 17:25:31 +0000 (09:25 -0800)]
Update files for OpenSSL-1.0.1e import.

20 months agoMerge branch 'vendor/OPENSSL' into DragonFly_RELEASE_3_2
Peter Avalos [Wed, 13 Feb 2013 17:27:11 +0000 (09:27 -0800)]
Merge branch 'vendor/OPENSSL' into DragonFly_RELEASE_3_2

20 months agoImport OpenSSL-1.0.1e.
Peter Avalos [Wed, 13 Feb 2013 17:15:43 +0000 (09:15 -0800)]
Import OpenSSL-1.0.1e.

o Corrected fix for CVE-2013-0169.

20 months agoUpdate files for OpenSSL-1.0.1d import.
Peter Avalos [Sun, 10 Feb 2013 10:04:14 +0000 (02:04 -0800)]
Update files for OpenSSL-1.0.1d import.

20 months agoMerge branch 'vendor/OPENSSL' into DragonFly_RELEASE_3_2
Peter Avalos [Sun, 10 Feb 2013 11:10:16 +0000 (03:10 -0800)]
Merge branch 'vendor/OPENSSL' into DragonFly_RELEASE_3_2

20 months agoImport OpenSSL-1.0.1d.
Peter Avalos [Sun, 10 Feb 2013 09:23:52 +0000 (01:23 -0800)]
Import OpenSSL-1.0.1d.

      o Fix renegotiation in TLS 1.1, 1.2 by using the correct TLS version.
      o Fix OCSP bad key DoS attack CVE-2013-0166
      o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169
      o Fix for TLS AESNI record handling flaw CVE-2012-2686

20 months agogames/atc: Fix a logic bug.
Sascha Wildner [Thu, 7 Feb 2013 19:05:52 +0000 (20:05 +0100)]
games/atc: Fix a logic bug.

The original logic should have really been:

if ((l < 'a' && l > 'z') || (l < 'A' && l > 'Z'))

But using islower()/isupper() is simpler and more readable.

Taken-from: NetBSD

20 months agokernel -- ffs: Softdep lock fix (lk unheld in process_worklist_item)
Venkatesh Srinivas [Wed, 30 Jan 2013 18:21:10 +0000 (10:21 -0800)]
kernel -- ffs: Softdep lock fix (lk unheld in process_worklist_item)

In process_worklist_item, from newdirrem/request_cleanup, the softdep
lock was not held before removing workitems. Make newdirrem take the
softdep lock around request_cleanup.

Reported-by: swildner@
Bug: 2501

20 months agoUnbreak world (gcc47 plugin)
John Marino [Sat, 2 Feb 2013 22:35:27 +0000 (23:35 +0100)]
Unbreak world (gcc47 plugin)

The installincludes target is run before "depend" target, so gtype.state
hasn't been created by the time "installincludes" is executed in stage 4.
Luckily there is a similar functionality for FILES that is executed at
the install phase, which will unbreak world (broken on previous commit).

Other headers are generated as well, so swap INCSGROUPS with FILESGROUPS
for everything to avoid having to figure which ones.  The headers are
needed at runtime, not buildtime, so this is okay.

20 months agogcc47: Fix plugin mechanism
John Marino [Sat, 2 Feb 2013 15:29:40 +0000 (16:29 +0100)]
gcc47: Fix plugin mechanism

There were two problems with gcc 4.7 LTO plugin:
1) It needed a number of object files from libiberty.
   Unfortunately the previous object files couldn't be used as they need
   to be built with -fPIC and libiberty is only an internal (non-pic) lib.
2) The plugin header directory was missing completely, as seen with
   gcc -print-file-name=plugin only returning "plugin".

20 months agolibstdc++47: Fix iostream bug 2478
John Marino [Thu, 31 Jan 2013 15:58:59 +0000 (16:58 +0100)]
libstdc++47: Fix iostream bug 2478

c++ iostreams were segfaulting -- apparently _M_table isn't defined in all
cases.  Fix inspired from FreeBSD configuration files.

https://bugs.dragonflybsd.org/issues/2478

21 months agokernel - Fix improper tmpfs resource limit check
Matthew Dillon [Wed, 23 Jan 2013 00:51:52 +0000 (16:51 -0800)]
kernel - Fix improper tmpfs resource limit check

* Fix an improper check that was causing tmpfs to blow up when used as
  backing store for a VN device.

Reported-by: tuxillo
21 months agoudp6: Remove pcb from wildcard table before calling in_pcbconnect
Sepherosa Ziehau [Wed, 23 Jan 2013 09:21:03 +0000 (17:21 +0800)]
udp6: Remove pcb from wildcard table before calling in_pcbconnect

DragonFly-bug: http://bugs.dragonflybsd.org/issues/2485

21 months agokernel/amr: Extend the visibility of AMR_DEBUG.
Sascha Wildner [Tue, 22 Jan 2013 19:19:38 +0000 (20:19 +0100)]
kernel/amr: Extend the visibility of AMR_DEBUG.

Half the code was missing the setting of AMR_DEBUG in the config file
because its visibility was reduced to amr.c only.

Reported-by: tuxillo
21 months agom4: Sync with FreeBSD.
Peter Avalos [Tue, 15 Jan 2013 05:59:24 +0000 (21:59 -0800)]
m4: Sync with FreeBSD.

This improves compat with GNU m4 and brings the code closer to NetBSD
and OpenBSD.

Obtained-from:  FreeBSD

21 months agokernel/netgraph7: Remove <sys/ktr.h>. There's no DragonFly KTR here.
Sascha Wildner [Wed, 16 Jan 2013 20:14:31 +0000 (21:14 +0100)]
kernel/netgraph7: Remove <sys/ktr.h>. There's no DragonFly KTR here.

21 months agokernel/netgraph7: Add a missing header to the Makefile.
Sascha Wildner [Wed, 16 Jan 2013 20:19:44 +0000 (21:19 +0100)]
kernel/netgraph7: Add a missing header to the Makefile.

21 months agokernel/usb4bsd: Fix sizeof().
Sascha Wildner [Mon, 14 Jan 2013 18:22:58 +0000 (19:22 +0100)]
kernel/usb4bsd: Fix sizeof().

21 months agoVFS quota: hpfs is now read-only, remove support
Fran├žois Tigeot [Fri, 23 Nov 2012 06:57:26 +0000 (07:57 +0100)]
VFS quota: hpfs is now read-only, remove support

21 months agohpfs - Fix a couple panics and a little cleanup.
Antonio Huete Jimenez [Thu, 22 Nov 2012 10:47:58 +0000 (11:47 +0100)]
hpfs - Fix a couple panics and a little cleanup.

* Fix compilation with HPFS_DEBUG.

* Fix a panic due CNP_PDIRUNLOCK flag not being cleared.

* Fix a panic where returned vnode after a lookup is not
  NULL in the ENOENT case.

* Disable write support completely. It was pretty minimal
  and operations like create or rename were not supported.

It has been tested with a filesystem created by OS/2 Warp 2.1.
Copying data out of it worked fine, but there is still an
outstanding issue with overlapping buffers.

21 months agokprintf(9): Implement optional 'precision' for numbers.
Sascha Wildner [Thu, 3 Jan 2013 18:14:38 +0000 (19:14 +0100)]
kprintf(9): Implement optional 'precision' for numbers.

Previously, it was parsed but ignored. Some third-party modules
(e.g., APCICA) prefer this format over zero padding flag '0'.

Before this commit:

ACPI Warning: 32/64X FACS address mismatch in FADT - 0x3F611E40/0x       03F611D40, using 32 (20110527/tbfadt-589)

After this commit:

ACPI Warning: 32/64X FACS address mismatch in FADT - 0x3F611E40/0x000000003F611D40, using 32 (20110527/tbfadt-589)

Taken-from: FreeBSD (r209836 and r209949)

22 months agoFix INVARIANT build issue
Adam Sakareassen [Thu, 8 Nov 2012 15:46:00 +0000 (02:46 +1100)]
Fix INVARIANT build issue

22 months agokernel/atm: Fix wrong rt_tables[] access.
Sascha Wildner [Mon, 17 Dec 2012 08:25:33 +0000 (09:25 +0100)]
kernel/atm: Fix wrong rt_tables[] access.

22 months agoif_start: Fix a race that could delay the packets transmission
Sepherosa Ziehau [Mon, 17 Dec 2012 04:18:08 +0000 (12:18 +0800)]
if_start: Fix a race that could delay the packets transmission

Since if_start_need_schedule is called w/ the cached IFF_OACTIVE out
side of ifnet's TX serializer, there could be a race that IFF_OACTIVE
could be cleared before if_start_need_schedule but after releasing
ifnet's TX serializer.  This could delay already queued packets
transmission until the new packet is coming.  Fix this race by calling
if_start_need_schedule inside ifnet's TX serializer.

22 months agokernel - ufs softdep fix under heavy load v3.2.2
Matthew Dillon [Fri, 14 Dec 2012 21:05:00 +0000 (13:05 -0800)]
kernel - ufs softdep fix under heavy load

Fix is from OpenBSD ffs_softdep.c v1.79, originally from FreeBSD
ffs_softdep.c 1.196. Commit message from OpenBSD:

"due to ffs_sync not be able to sync some buffers here is another
instance of softdep code that must ensure proper syncing.
try harder to flush MKDIR_BODY dependancy if such still exists
during pagedep flush (that is by syncing first block of the dir)."

22 months agokernel - Fix sync() system call
Matthew Dillon [Thu, 13 Dec 2012 07:19:43 +0000 (23:19 -0800)]
kernel - Fix sync() system call

* The sync() system call was syncing the filesystems MNT_NOWAIT | MNT_LAZY.
  We need the MNT_NOWAIT to avoid an endless sync on a busy filesystem, but
  MNT_LAZY is another issue entirely.

* Remove the MNT_LAZY from the sync() system call, it can cause whole
  files to not be synced.  It is meant only to be used by the automatic
  kernel 30-second sync (which eventually gets everything flushed out).

22 months agokernel - Fix missing B_ORDERED inheritance
Matthew Dillon [Thu, 13 Dec 2012 04:09:45 +0000 (20:09 -0800)]
kernel - Fix missing B_ORDERED inheritance

* The cluster code was not inheriting B_ORDERED on buffers when constructing
  the rollup buffer due to a coding error.

* I don't think anything uses B_ORDERED so this shouldn't matter, but fix
  it anyway.

Reported-by: vsrinivas
22 months agokernel - Reduce the size of the callout wheel
Matthew Dillon [Mon, 10 Dec 2012 23:11:46 +0000 (15:11 -0800)]
kernel - Reduce the size of the callout wheel

* The callout wheel is per-cpu but ncallout is calculated based on memory.
  A system with many cpus tended to allocate an excessive amount of memory
  in aggregate for the callout wheels.

* Reduce the size of the per-cpu callout wheel by approximately a factor
  of (ncpus).  On a 16G machine with 8 cores, aggregate callout wheel
  allocations is reduced from 128MB to 16MB.

22 months agokernel - Fix softupdates panic with UFS
Matthew Dillon [Mon, 10 Dec 2012 23:02:01 +0000 (15:02 -0800)]
kernel - Fix softupdates panic with UFS

* If getdirtybuf() was unable to lookup a dirty buffer from the
  flush_pagedep_deps path, we need to retry the lookup, rather than
  proceeding through processing the diradd.

Reported-by: marino@
Submitted-by: vsrinivas
22 months agokernel - Fix bug (not reached in normal operation) in vm_map_set_wired_quick()
Matthew Dillon [Mon, 10 Dec 2012 22:37:28 +0000 (14:37 -0800)]
kernel - Fix bug (not reached in normal operation) in vm_map_set_wired_quick()

* Fix a bug where vm_map_set_wired_quick() only operated on the first
  vm_map_entry of a slab, and would panic if there were more.

* Slab allocations are only going to have one vm_map_entry anyway so the
  bug was never hit.  But we fix it anyway.

22 months agokernel - Fix debug output label
Matthew Dillon [Mon, 10 Dec 2012 22:35:39 +0000 (14:35 -0800)]
kernel - Fix debug output label

* Fix "rflags" to "eflags" in i386 kprintf() for smp_invltlb() debugging.

Reported-by: swildner
22 months agokernel - Fix improper assertion panic in vinvalbuf()
Matthew Dillon [Sat, 8 Dec 2012 22:22:15 +0000 (14:22 -0800)]
kernel - Fix improper assertion panic in vinvalbuf()

* Related to the removal of vhold/vdrop from buffer cache buffers, the
  state of a vnode being cleaned can now contain more active buffers and
  I/O's at the time of the vinvalbuf() call.

* Remove the 'vinvalbuf: dirty bufs' assertion and panic.  It is no longer
  a correct assertion.  Note that we've also had sporatic reports of this
  panic even prior to the work so it might not have been a completely
  correct assertion before either.

* Rework the vinvalbuf buffer-flushing and I/O-waiting code a bit.  We
  have to wait for I/O at least once and it is probably a good idea to
  wait for I/O after each buffer flush pass too, to avoid live-locks.

Reported-by: vsrinivas
22 months agokernel - Adjust NFS server for new allocvnode() code
Matthew Dillon [Sat, 8 Dec 2012 05:21:55 +0000 (21:21 -0800)]
kernel - Adjust NFS server for new allocvnode() code

* Adjust the NFS server to check for LWP_MP_VNLRU garbage collection
  requests and act on them.

  This prevents excessive allocation of vnodes by the nfsd's.

22 months agokernel - Change allocvnode() to not recursively block freeing vnodes
Matthew Dillon [Sat, 8 Dec 2012 02:52:30 +0000 (18:52 -0800)]
kernel - Change allocvnode() to not recursively block freeing vnodes

allocvnode() has caused many deadlock issues over the years, including
recent issues with softupdates, because it is often called from deep
within VFS modules and attempts to clean and free unrelated vnodes when
the vnode limit is reached to make room for the new one.

* numvnodes is not protected by any locks and needs atomic ops.

* Change allocvnode() to always allocate and not attempt to free
  other vnodes.

* allocvnode() now flags the LWP to handle reducing the number of vnodes
  in the system as of when it returns to userland instead.  Consolidate
  several flags into a single conditional function call, lwpuserret().

  When triggered, this code will do a limited scan of the free list to
  try to find vnodes to free.

* The vnlru_proc_wait() code existed to handle a separate algorithm
  related to vnodes with cached buffers and VM pages but represented
  a major bottleneck in the system.

  Remove vnlru_proc_wait() and allow vnodes with buffers and/or non-empty
  VM objects to be placed on the free list.

  This also requires not vhold()ing the vnode for related buffer cache
  buffer since the vnode will not go away until related buffers have been
  cleaned out.  We shouldn't need those holds.

Testing-by: vsrinivas
22 months agokernel - Fix filesystem lookup error due to parent directory recyclement race
Matthew Dillon [Fri, 7 Dec 2012 22:44:26 +0000 (14:44 -0800)]
kernel - Fix filesystem lookup error due to parent directory recyclement race

* When looking up a path the parent ncp's vnode is needed to pass into
  the VFS code as the directory vnode (dvp) for the element being looked up.

* Fix a timing race whereby a system under extreme vnode pressure (such as
  when kern.maxvnodes is set to a very low value) can squeek in recyclement
  of this directory vnode when there are no children under it in the
  namecache.

  We fix the problem by holding the directory vnode during the nlookup() and
  cache_resolve().

22 months agokernel - Fix issues where tmpfs loses file data
Matthew Dillon [Fri, 7 Dec 2012 22:20:31 +0000 (14:20 -0800)]
kernel - Fix issues where tmpfs loses file data

* For TMPFS, UIO_NOCOPY writes must use bawrite() or bwrite() and must NEVER
  used buwrite() because these operations are being called via the VM page
  cleaning code via the pageout daemon or the vnode termination code
  (when maxvnodes is reached), and the underlying pages are about to be
  destroyed.

* vm_object_terminate() must call vinvalbuf() both before (for normal
  filesystems) and also after (for tmpfs style filesystems).  Otherwise
  buffers potentially not disposed of during the page cleaning might
  get left hanging.  This is a safety feature.

* Remove post-flush test code from vm_object_page_collect_flush() entirely.
  The IO's are in progress at this point so it makes no sense to set
  PG_CLEANCHK here.

* vm_page_need_commit() must make the object writeable and dirty, I think.

* Fix multiple places where m->dirty is tested and PG_NEED_COMMIT is not.

Reported-by: vsrinivas, others
22 months agokernel - Fix memory starvation issue w/tmpfs
Matthew Dillon [Wed, 5 Dec 2012 19:40:01 +0000 (11:40 -0800)]
kernel - Fix memory starvation issue w/tmpfs

* TMPFS relies on the pagedaemon to retire dirty pages to swap.  The normal
  buffer cache flushing won't do the job (nor do we want it to).  To avoid
  starving the system we change bio_page_alloc() to not dig into the
  system reserve when allocating pages for TMPFS.

Reported-by: tuxillo (Antonio Huete)
22 months agoUPDATING: Note that aic(4) was deISAized (forgot to mention at the time).
Sascha Wildner [Sat, 1 Dec 2012 22:54:54 +0000 (23:54 +0100)]
UPDATING: Note that aic(4) was deISAized (forgot to mention at the time).

22 months agoint64_t is long on x86_64, and not always equivalent to long long.
Sascha Wildner [Thu, 29 Nov 2012 20:57:05 +0000 (21:57 +0100)]
int64_t is long on x86_64, and not always equivalent to long long.

Similarly, uint64_t is unsigned long.

For their min/max value definitions, change LL/ULL suffixes to L/UL.

The bug report has some C++ sample code that show issues resulting
from treating them as long long.

Reported-by: David Shao <davshao@gmail.com>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/2461>

22 months ago<sys/errno.h>: Try to fix errno's declaration a bit better for C++.
Sascha Wildner [Wed, 28 Nov 2012 23:26:41 +0000 (00:26 +0100)]
<sys/errno.h>: Try to fix errno's declaration a bit better for C++.

The test code from the bug ticket seems to work with it at least.

Reported-by: David Shao <davshao@gmail.com>
Dragonfly-bug:      <http://bugs.dragonflybsd.org/issues/2463>
In-discussion-with: vsrinivas

22 months agokernel - Fix proc_reparent() race/assertion panic
Matthew Dillon [Wed, 28 Nov 2012 18:21:38 +0000 (10:21 -0800)]
kernel - Fix proc_reparent() race/assertion panic

* Fix proc_reparent() race/assertion panic.  p_pptr changes can race,
  and the procedure had an assertion for the case.  Recode the procedure
  to retry on a mismatch instead of assert.

* Also move the old-parent-wakeup code into the procedure so it is
  properly executed in all cases.

Reported-by: Peter Avalos
22 months agoinstaller: Clarity language when asking the user for time-date info.
Matthew Dillon [Tue, 27 Nov 2012 21:50:54 +0000 (13:50 -0800)]
installer: Clarity language when asking the user for time-date info.

* Clarity language when asking the user for time-date info so the
  user is not confused between UTC vs his or her selected timezone.
  The program wants the user to enter the time and date in his or her
  selected timezone.

22 months agoinstaller: Fix handling of CMOS set to UTC vs. CMOS set to wall time.
Sascha Wildner [Mon, 26 Nov 2012 18:39:57 +0000 (19:39 +0100)]
installer: Fix handling of CMOS set to UTC vs. CMOS set to wall time.

It was reversed in the installer (compared to tzsetup(8)).

/etc/wall_cmos_clock needs to be created when the CMOS is set to the
time of the clock on the wall. While here, also add removing the file
in case the user selects 'CMOS set to UTC'. This is if he chose the
other setting previously and then tried again.

Reported-by: many
Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/39>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/2060>

23 months agovkernel: Make "options IPX" compilable into the vkernel.
Sascha Wildner [Thu, 22 Nov 2012 19:44:23 +0000 (20:44 +0100)]
vkernel: Make "options IPX" compilable into the vkernel.

Usage of "errno" in userspace as a variable name results in sad code.
Rename them to "error" instead.

Reported-by: tuxillo
23 months agoaac(4): Add a missing unlock.
Sascha Wildner [Tue, 20 Nov 2012 05:23:49 +0000 (06:23 +0100)]
aac(4): Add a missing unlock.

23 months agoext2fs - Clear CNP_PDIRUNLOCK flag after a lookup.
Antonio Huete Jimenez [Mon, 19 Nov 2012 22:32:16 +0000 (23:32 +0100)]
ext2fs - Clear CNP_PDIRUNLOCK flag after a lookup.

vop_compat_nresolve() unlocks the vnode when flag CNP_PDIRUNLOCK
is set, so either we clear the flag or avoid unlocking the vnode
after an ext2_lookup().

DragonFly-bug: http://bugs.dragonflybsd.org/issues/2454

Reported by: Skylar Hawk

23 months ago/usr/Makefile: Add pkgsrc-create-shallow option
John Marino [Mon, 19 Nov 2012 17:43:52 +0000 (18:43 +0100)]
/usr/Makefile: Add pkgsrc-create-shallow option

23 months agomake distribution: Remove some symlinks before (re-)creating them.
Sascha Wildner [Mon, 19 Nov 2012 16:59:05 +0000 (17:59 +0100)]
make distribution: Remove some symlinks before (re-)creating them.

Reported-by: marino
23 months agompt(4): Fix a panic in RAID operation.
Sascha Wildner [Sun, 18 Nov 2012 19:46:15 +0000 (20:46 +0100)]
mpt(4): Fix a panic in RAID operation.

I ported it wrongly. FreeBSD uses callout_init_mtx() here.

23 months agokernel - Fix off-by-1 error in semexit
Matthew Dillon [Thu, 15 Nov 2012 20:30:51 +0000 (12:30 -0800)]
kernel - Fix off-by-1 error in semexit

* Fix an off-by-1 error that was preventing semexit from properly undoing
  all the semaphores controlled by the exiting process.

Reported-by: lentferj, vsrinivas, others
23 months agobug 2450: Allow build of RELEASE 3.2 from master's bmake
John Marino [Thu, 15 Nov 2012 12:49:05 +0000 (13:49 +0100)]
bug 2450: Allow build of RELEASE 3.2 from master's bmake

It was not possible to build RELEASE 3.2 once the world was updated to
the 3.3 development branch.  The makefiles were incompatible with bmake.
It was possible to build RELEASE 3.2 with only a change to bsd.cpu.mk,
but parallel builds still failed.  The remaining changes and the previous
cherry-pick were all done to support parallel builds when building this
release branch from a system equipped with bmake as the system make.

<https://bugs.dragonflybsd.org/issues/2450>

23 months agoTweak some makefiles to prepare for bmake
John Marino [Sat, 27 Oct 2012 09:13:14 +0000 (11:13 +0200)]
Tweak some makefiles to prepare for bmake

These makefiles build fine with legacy make but contain (or lack)
information that causes the build to fail when used with bmake.  Make
small tweaks to makefiles to ensure they are compatible with both make
programs.

23 months agomount{,_ufs}: Fix wrong mountctl(2) error check.
Sascha Wildner [Wed, 14 Nov 2012 10:06:26 +0000 (11:06 +0100)]
mount{,_ufs}: Fix wrong mountctl(2) error check.

mountctl(2) returns the number of copied bytes when successful, and -1
if there was an error. This prevented ", local" from being printed in
mount output.

Reported-by: YONETANI Tomokazu
23 months agoSync zoneinfo database with tzdata2012j from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Tue, 13 Nov 2012 18:41:51 +0000 (19:41 +0100)]
Sync zoneinfo database with tzdata2012j from ftp://ftp.iana.org/tz/releases

* africa: Lybia set their time one hour back at 02:00 on November 10
    (last Saturday).

* Additional miscellaneous fixes in various comments.

23 months agoipcs(1): Fix the "ipcs: kvm_nlist: No such file or directory" error.
Sascha Wildner [Tue, 13 Nov 2012 17:35:17 +0000 (18:35 +0100)]
ipcs(1): Fix the "ipcs: kvm_nlist: No such file or directory" error.

The "semu" variable was removed in 79757ed082, causing this breakage.
Strangely, even before its removal it wasn't used for anything in
ipcs(1).

Reported-by: beket
23 months agoReally fix systat(1).
Sascha Wildner [Mon, 12 Nov 2012 20:59:30 +0000 (21:59 +0100)]
Really fix systat(1).

23 months agosystat - Do not use ccpu for %cpu calculation in pigs view.
Antonio Huete Jimenez [Sun, 11 Nov 2012 23:18:01 +0000 (00:18 +0100)]
systat - Do not use ccpu for %cpu calculation in pigs view.

- ccpu went away after the new scheduler work so sync with
  the current status of the kernel.
- Also remove all the unused kvm* stuff and get fscale via sysctl.

Reported-by: tpchin <tpchin@telstra.com>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/2245>

23 months agohammer.8: Add back an .El that was removed by mistake.
Sascha Wildner [Sun, 11 Nov 2012 09:26:17 +0000 (10:26 +0100)]
hammer.8: Add back an .El that was removed by mistake.

23 months agogetline(3): Fix segfault caused by NULL pointer
John Marino [Wed, 7 Nov 2012 20:15:35 +0000 (21:15 +0100)]
getline(3): Fix segfault caused by NULL pointer

This fixes a segfault seen with pkg's audit function, and effectively syncs
getdelim with FreeBSD.

Taken-from: FreeBSD SVN 197752 (04 OCT 2009)

- Tolerate applications that pass a NULL pointer for the buffer and
  claim that the capacity of the buffer is nonzero.

- If an application passes in a non-NULL buffer pointer and claims the
  buffer has zero capacity, we should free (well, realloc) it anyway.
  It could have been obtained from malloc(0), so failing to free it
  would be a small memory leak.

23 months agoboot - some VIA processors also have long mode!
Alex Hornung [Sun, 4 Nov 2012 15:53:22 +0000 (15:53 +0000)]
boot - some VIA processors also have long mode!

23 months agoigb: Configure TX head write back before turn enable bit in TXDCTL
Sepherosa Ziehau [Wed, 7 Nov 2012 13:47:59 +0000 (21:47 +0800)]
igb: Configure TX head write back before turn enable bit in TXDCTL

The original configure sequence works on 82575 and 82576.  However,
it does not work on i350 and probably will not work on 82580.  For
these two chips TX head write back _must_ be configured before
turning on enable bit in TXDCTL according to their datasheet.

Reported-by: ftigeot@
Tested-by: ftigeot@ (i350), me w/ (82575, 82576)
23 months agoSync zoneinfo database with tzdata2012i from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sun, 4 Nov 2012 13:00:36 +0000 (14:00 +0100)]
Sync zoneinfo database with tzdata2012i from ftp://ftp.iana.org/tz/releases

* asia: Comment typo fix.

* northamerica: Cuba switched back to standard time on 2012-11-04, 01:00.

23 months agobge: Fix a bug in the polling code when status tag is used
Sepherosa Ziehau [Sat, 3 Nov 2012 14:49:32 +0000 (22:49 +0800)]
bge: Fix a bug in the polling code when status tag is used

Status tag always needs to be written even if interrupt is not enabled.

23 months agoRevert "bge: Always configure MII mode register"
Sepherosa Ziehau [Sat, 3 Nov 2012 14:26:12 +0000 (22:26 +0800)]
Revert "bge: Always configure MII mode register"

This reverts commit dda43ff2bc5975a3cbd91838e7a46332039962f4.

Forcefully configure seems to break at least BCM5761 NIC auto-negotiation

23 months agokernel: Fix some wrong cam_simq_release() calls.
Sascha Wildner [Sat, 3 Nov 2012 11:08:13 +0000 (12:08 +0100)]
kernel: Fix some wrong cam_simq_release() calls.

Our (refcounted) simq can be released right after allocating the sim.
These drivers were not doing it correctly.

23 months ago/usr/Makefile: Bring back creating a master branch.
Sascha Wildner [Fri, 2 Nov 2012 02:47:18 +0000 (03:47 +0100)]
/usr/Makefile: Bring back creating a master branch.

It is useful to have it available, such as for MFC'ing changes from it
or upgrading to it, but it won't be checked out by default.

23 months agoMake sure that upgrading to master doesn't happen automatically/accidentally.
Justin C. Sherrill [Thu, 1 Nov 2012 02:39:50 +0000 (22:39 -0400)]
Make sure that upgrading to master doesn't happen automatically/accidentally.
Users will stay with a stable release unless they choose to change.
Also, nrelease builds will build the correct release.

23 months agoioapic/i386: Allow GSI > 191
Sepherosa Ziehau [Thu, 1 Nov 2012 01:29:53 +0000 (09:29 +0800)]
ioapic/i386: Allow GSI > 191

23 months agoioapic/x86_64: Allow GSI > 191
Sepherosa Ziehau [Tue, 30 Oct 2012 02:53:59 +0000 (10:53 +0800)]
ioapic/x86_64: Allow GSI > 191

Some BIOSes seem to assume that all 256 IDT vectors could be used,
while we limit the available IDT vectors percpu to 192.   Find an
unused IRQ for these GSIs, if this ever happens.

Reported-by: thowe on EFnet #dragonflybsd
23 months agoSync zoneinfo database with tzdata2012h from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sat, 27 Oct 2012 09:15:46 +0000 (11:15 +0200)]
Sync zoneinfo database with tzdata2012h from ftp://ftp.iana.org/tz/releases

* asia:
    Israel has new DST rules next year (thanks to Ephraim Silverberg).
    Jordan stays on DST this winter (thanks to Steffen Thorsen).

* southamerica:
    Bahia no longer has DST (thanks to Kelley Cook).
    Tocantins has DST (thanks to Rodrigo Severo).

23 months agomdoc: Fix .Os version.
Sascha Wildner [Fri, 26 Oct 2012 22:50:54 +0000 (00:50 +0200)]
mdoc: Fix .Os version.