dragonfly.git
10 months agohammer2 - Fix indefinite dirty chains due to rename v5.0.2
Matthew Dillon [Sat, 2 Dec 2017 19:06:30 +0000 (11:06 -0800)]
hammer2 - Fix indefinite dirty chains due to rename

* Do not call cache_setunresolved() on tnch before calling
  cache_rename().  Doing so prevents cache_rename() from properly
  setting VREF_FINALIZE on the vnode.  Since the deleted inode is
  no longer in the chain hierarchy the related chains can remain
  dirty indefinitely (until the vnode is reused or the filesystem
  is unmounted).

* This fixes inmem dirty chain accounting and 'chnmem' stalls.

10 months agohammer2 - optimize hammer2_pfs_memory_wakeup()
Matthew Dillon [Sat, 2 Dec 2017 19:05:58 +0000 (11:05 -0800)]
hammer2 - optimize hammer2_pfs_memory_wakeup()

* Optimize hammer2_pfs_memory_wakeup() to use fetchadd instead of
  cmpset, reducing contention.

10 months agohammer2 - Fix rename race
Matthew Dillon [Sat, 2 Dec 2017 09:02:59 +0000 (01:02 -0800)]
hammer2 - Fix rename race

* Fix a rename race in hammer2 which can result in unwanted namecache
  overloading.  When this occurs, a rename operation can wind up
  deleting the same inode more than once.

* This fixes a "hammer2_chain_getparent: no parent" panic in H2.

Reported-by: kerma
10 months agolibarchive: Revert commit that was not meant to be pushed.
Sascha Wildner [Tue, 28 Nov 2017 19:13:35 +0000 (20:13 +0100)]
libarchive: Revert commit that was not meant to be pushed.

10 months agolibc/nls: Use current locale (set by thread).
Sascha Wildner [Tue, 28 Nov 2017 18:34:23 +0000 (19:34 +0100)]
libc/nls: Use current locale (set by thread).

It was global locale always previously.

Taken-from:  FreeBSD (r304755)
Reported-by: xenu (also provided a test case)
11 months agomtree: Fix owner for several directories in /usr/share.
Sascha Wildner [Mon, 13 Nov 2017 08:51:29 +0000 (09:51 +0100)]
mtree: Fix owner for several directories in /usr/share.

Only /usr/share/man/cat* directories should have owner 'man'.

0ba28897abadbf broke this by removing needed '/set uname=root' lines
in BSD.usr.dist.

While here, remove some trailing whitespace.

In-discussion-with: zrj

11 months agolibc and pthreads - Fix atfork issues with nmalloc, update dmalloc
Matthew Dillon [Wed, 8 Nov 2017 18:56:06 +0000 (10:56 -0800)]
libc and pthreads - Fix atfork issues with nmalloc, update dmalloc

* Implement atfork handling for nmalloc.  As part of this, refactor
  some of nmalloc.

* Remove ZERO_LENGTH_PTR from nmalloc.  Instead, force 0-byte
  allocations to allocate 1 byte.  The standard requires unique
  pointers to be returned.

* For now go back to a single depot lock instead of a per-zone
  lock.  It is unclear whether multi-threaded performance will
  suffer or not, but its the only way to implement atfork handling.

* Implement proper atfork interlocks for nmalloc via pthreads to avoid
  corruption when heavily threaded programs call fork().

* Bring dmalloc up to date in various ways, including properly
  implementing a minimum 16-byte alignment for allocations >= 16 bytes,
  and atfork handling.  Also use a global depot lock for the same
  reason we use it in nmalloc, and implement a front-end magazine
  shortcut for any allocations <= 2MB.

Reported-by: mneumann
11 months agokernel - Update umtx documentation
Matthew Dillon [Tue, 7 Nov 2017 06:08:21 +0000 (22:08 -0800)]
kernel - Update umtx documentation

* Update the umtx(2) documentation with better examples and include
  fine detail and warnings on use.

* Update the fork(2) documentation to include warnings about using
  the function in threaded programs.

11 months agokernel - selective MFC of kernel umtx work from master
Matthew Dillon [Wed, 8 Nov 2017 19:08:35 +0000 (11:08 -0800)]
kernel - selective MFC of kernel umtx work from master

* MFC code to wakeup all waiting umtx_sleep()s for a process
  when one of its threads forks.

* Add a second wakeup sysctl to help debug umtx issues.

* Implement a 2-second failsafe for umtx_sleep().

11 months agohammer2 - Fix divide by 0 race
Matthew Dillon [Mon, 6 Nov 2017 19:21:43 +0000 (11:21 -0800)]
hammer2 - Fix divide by 0 race

* Fix a statfs/statvfs race which can cause a divide-by-0.

Reported-by: arcade@b1t.name
11 months agotelnetd: print system information (OS and architecture) before login prompt.
Christian Groessler [Fri, 3 Nov 2017 13:28:53 +0000 (14:28 +0100)]
telnetd: print system information (OS and architecture) before login prompt.

11 months agoSay 'hammer2' instead of 'hammer' in various places.
Sascha Wildner [Mon, 6 Nov 2017 00:42:17 +0000 (01:42 +0100)]
Say 'hammer2' instead of 'hammer' in various places.

11 months agohammer2.8: Fix typo.
Sascha Wildner [Sun, 5 Nov 2017 23:34:51 +0000 (00:34 +0100)]
hammer2.8: Fix typo.

11 months agopthreads - Fix rtld-elf and libthread_xu v5.0.1
Matthew Dillon [Thu, 2 Nov 2017 23:21:13 +0000 (16:21 -0700)]
pthreads - Fix rtld-elf and libthread_xu

* Fixes chrome, thunderbird, and multiple other issues with recent
  libpthreads work.

Testing-by: mneumann, dillon
11 months agokernel - Add atomic_fcmpset_*()
Matthew Dillon [Sun, 15 Oct 2017 21:20:56 +0000 (14:20 -0700)]
kernel - Add atomic_fcmpset_*()

* Add atomic_fcmpset_*().  GCC has gotten good enough that it no longer
  forces that &count onto the stack.

  These functions work like atomic_cmpset_*() but update the originating
  value on failure, allowing us to avoid reloading it from memory.

Suggested-by: mjg__
11 months agokernel - Refactor vm_fault and vm_map a bit (3)
Matthew Dillon [Thu, 2 Nov 2017 03:33:24 +0000 (20:33 -0700)]
kernel - Refactor vm_fault and vm_map a bit (3)

* Fix bug in vm_map_split() where boject was being released
  and dropped out of order on a certain condition, causing an
  assertion.  bobject is released properly later so we should
  be able to simply remove the offending code.

11 months agokernel - Refactor vm_fault and vm_map a bit (partial MFC)
Matthew Dillon [Thu, 2 Nov 2017 02:23:50 +0000 (19:23 -0700)]
kernel - Refactor vm_fault and vm_map a bit (partial MFC)

* Fix an incorrect assertion in vm_map_split().

* Make sure OBJ_ONEMAPPING is cleared for nobject in vm_map_split().

* Fix a bug in the virtual copy test.  Multiple elements were
  not being retested after reacquiring the map lock.

* NOTE: moving the chain acquisition out of vm_map_split() not MFCd.

11 months agolibc - Add rtld stubs for pthreads
Matthew Dillon [Thu, 2 Nov 2017 01:53:30 +0000 (18:53 -0700)]
libc - Add rtld stubs for pthreads

* Add needed rtld stubs for -static -pthreads links.

11 months agolibthread_xu - Fix rtld and refactor locks
Matthew Dillon [Thu, 2 Nov 2017 00:18:56 +0000 (17:18 -0700)]
libthread_xu - Fix rtld and refactor locks

* Add a separate atfork facility for internal pthread atfork entities
  (sem and rtld) which must execute after all user atfork entities
  pre-fork and before all user atfork entities post-fork.

* Install an atfork handler for rtld-elf (also requires rtld-elf to
  be updated).  The handler will ensure that RTLD locks are in a sane
  state prior to fork (by acquiring them), and will then release the
  locks post-fork.  This is the primary fix for lang/rust and cargo.

  Also do not issue _thr_rtld_fini() when threading drops to 0.
  Once threading has been set, rtld's pthread locks remain installed.

* Refactor thr_cond.c.  Refactor condition variables to perform
  according to the spec.  Use a TAILQ to make pthread_cond_signal()
  work exactly as described in the manual (that is, waking up only
  one waiter at a time).

* Refactor thr_mutex.c.  Primary instrument for debugging and
  clean up.  Also deal with improper EINTR handling.

* Refactor thr_fork.c.  Implement the new atfork facility for
  internal atfork handlers.

* Refactor thr_rwlock.c.  Add debugging, cleanup.

* thr_sem.c now uses the internal atfork handler to ensure proper
  ordering.

* thr_sig.c implements debugging features.

* Refactor thr_umtx.c... the low level mutex code.  Store the id
  for additonal verification and use an atomic lock to clear the
  lock instead of an assignment.  Properly ignore EINTR.

* Cleanup init_private() a bit.

* Add PTHREADS_DEBUGGING=TRUE and PTHREADS_DEBUGGING2=TRUE make
  flags.  The first writes out a garbage file in /tmp for all
  locking operations as they occur.  The second is used for
  point debugging and writes out a file when signal 63 is sent
  to the program.

* Add cpu_ccfence() in various places that might need it (a hack
  for the moment, userland cannot currently #include
  "machine/cpufunc.h").

* Should fix lang/rust and 'cargo'

11 months agortld - Add fork hooks for libthread_xu to install
Matthew Dillon [Thu, 2 Nov 2017 00:15:26 +0000 (17:15 -0700)]
rtld - Add fork hooks for libthread_xu to install

* Add fork hooks for libthread_xu to install.  rtld must acquire its
  locks exclusively during a fork, and then release them after the
  fork is complete, to prevent the fork() from catching the locks in
  a bad state.  See libthread_xu.

11 months agoInstall hammer2 periodic script.
Sascha Wildner [Wed, 1 Nov 2017 11:02:38 +0000 (12:02 +0100)]
Install hammer2 periodic script.

Reported-by: ftigeot
11 months agokernel: Rename struct tmpfs_args to tmpfs_mount_info
Markus Pfeiffer [Sun, 29 Oct 2017 22:47:18 +0000 (22:47 +0000)]
kernel: Rename struct tmpfs_args to tmpfs_mount_info

This makes the names of vfs argument structures slightly more
uniform.

Since they were not installed before this should not break
any userland software.

11 months agokernel: Rename tmpfs_args.h to tmpfs_mount.h
Markus Pfeiffer [Sun, 29 Oct 2017 21:36:47 +0000 (21:36 +0000)]
kernel: Rename tmpfs_args.h to tmpfs_mount.h

This is slightly more consistent with the other VFS.

11 months agoInstall vfs/tmpfs headers
Markus Pfeiffer [Sun, 29 Oct 2017 15:46:59 +0000 (15:46 +0000)]
Install vfs/tmpfs headers

11 months agox86_64: Add pauses in the TSC mpsync testing loop.
Sepherosa Ziehau [Sat, 28 Oct 2017 06:46:31 +0000 (14:46 +0800)]
x86_64: Add pauses in the TSC mpsync testing loop.

This fixes Intel N3450 deadlock in the tight rdtsc/IPI loop.

Suggested-by: dillon@
Tested-by: mneumann@
Dragonfly-bug: http://bugs.dragonflybsd.org/issues/3087

11 months agokernel - Fix boot issues with > 512GB of ram
Matthew Dillon [Sun, 29 Oct 2017 21:37:32 +0000 (14:37 -0700)]
kernel - Fix boot issues with > 512GB of ram

* Fix DMAP installation issues for kernels with > 512GB of ram.
  The page table was not being laid out properly for PML4e
  entries past the first one.

* Fix early panic reporting.  Conditionalize the lapic access as the
  lapic might not exist yet.

* Tested to 1TB of ram.  Theoretically DragonFlyBSD can support up
  to 32TB of ram (and slightly less than ~64TB with one #define
  change).

Reported-by: zrj
Testing-by: zrj
11 months agohammer2 - Fix "hammer2_chain_getparent: no parent" assertion
Matthew Dillon [Sun, 29 Oct 2017 17:48:15 +0000 (10:48 -0700)]
hammer2 - Fix "hammer2_chain_getparent: no parent" assertion

* Inodes are placed on the pmp->sideq when a flush action is required
  but no vnode association exists.  This is most typically done when
  a vnode is reclaimed.  The sideq code also handles destroying an
  unlinked inode on last-close.

* It is possible for an already-deleted inode (not just unlinked, but
  also deleted from the topology) to wind up on the sideq list, resulting
  in the above assertion.

* Fix the assertion by handling the case.  Just flush the inode normally
  instead of trying to re-delete it.  The related in-memory topology will
  be destroyed automatically.

11 months agokernel - Fix cluster_awrite() race
Matthew Dillon [Sat, 28 Oct 2017 22:14:02 +0000 (15:14 -0700)]
kernel - Fix cluster_awrite() race

* Fix a race between cluster_awrite() and vnode destruction.  We
  have to finish working the cluster pbuf before disposing of the
  component elements.  b_vp in the cluster pbuf is held only by
  the presence of the components.

* Fixes NULL pointer indirection panic associated with heavy
  paging during tmpfs operations.  This typically only occurs
  when maxvnodes is set to a relatively low value, but it can
  eventually occur in any modestly paging environment when
  tmpfs is used.

11 months agoSync zoneinfo database with tzdata2017c from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sun, 29 Oct 2017 10:46:32 +0000 (11:46 +0100)]
Sync zoneinfo database with tzdata2017c from ftp://ftp.iana.org/tz/releases

* Northern Cyprus switches from +03 to +02/+03 on 2017-10-29.

* Fiji ends DST 2018-01-14, not 2018-01-21.

* Namibia switches from +01/+02 to +02 on 2018-04-01.

* Sudan switches from +03 to +02 on 2017-11-01.

* Tonga likely switches from +13/+14 to +13 on 2017-11-05.

* Turks & Caicos switches from -04 to -05/-04 on 2018-11-04.

For a detailed list of changes, see share/zoneinfo/NEWS.

11 months agoif_vtnet - Handle missing IFCAP_VLAN_* flags nicer. Comment IFCAP_LOR stuff.
Imre Vadász [Tue, 17 Oct 2017 20:06:23 +0000 (22:06 +0200)]
if_vtnet - Handle missing IFCAP_VLAN_* flags nicer. Comment IFCAP_LOR stuff.

* The if_vtnet driver used to define the IFCAP_LRO, IFCAP_VLAN_HWFILTER and
  IFCAP_VLAN_HWTSO flags itself, to make the code from FreeBSD build.
  Instead define IFCAP_VLAN_HWFILTER and IFCAP_VLAN_HWTSO to 0, when they
  are not defined already. This allows the code to build, but all checks
  for the flags fail. (Inspired by the vmxnet3 driver port).

* The IFCAP_LRO flag is unavailable in DragonFly, but the LRO offload seems
  to work somehow.

* According to the virtio specification, LRO support should be possible
  without rx checksum support as well.

11 months agoif_vtnet - Disable rx csum offload due to unsupported ipv6 rx csum offload.
Imre Vadász [Tue, 17 Oct 2017 20:11:08 +0000 (22:11 +0200)]
if_vtnet - Disable rx csum offload due to unsupported ipv6 rx csum offload.

* Ignoring the checksum offloading in the receive path of the driver isn't
  sufficient, since we might receive only partially checksummed packets
  from the host.

* Unfortunately there is only a single feature flag for both ipv4 and ipv6
  receive checksum offloading, so we need to disable both for now.

* At the moment we don't support a way to explicitly enable the rx csum
  feature at runtime, but this will be easily possible by adding support
  for the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature.

* Mention this as a caveat in the manpage.

* Update correct default value of hw.vtnet.lro_disable tunable in the
  manpage, to match the code again.

11 months agokernel - Zero out syncache_percpu properly
Matthew Dillon [Sun, 22 Oct 2017 00:31:43 +0000 (17:31 -0700)]
kernel - Zero out syncache_percpu properly

* The kmalloc for the syncache_percpu was not using M_ZERO
  which I believe can cause cache_count to be some random
  value.  If this value is close to or larger than the syncache
  limit, the garbage collector may run with no entries to reuse,
  causing a NULL pointer dereference and panic.

Reported-by: pa3k #3088
11 months agoinitrd - Add 'fetch'
Matthew Dillon [Fri, 20 Oct 2017 23:42:42 +0000 (16:42 -0700)]
initrd - Add 'fetch'

* Add the 'fetch' program to the recovery shell.  This is just too
  useful a program to not have on the rescue ramdisk.

12 months agokernel - Increase ACPI_SEMAPHORES_MAX_PENDING
Matthew Dillon [Thu, 19 Oct 2017 04:43:27 +0000 (21:43 -0700)]
kernel - Increase ACPI_SEMAPHORES_MAX_PENDING

* Increase ACPI_SEMAPHORES_MAX_PENDING to a very large number.
  Some of the ACPI codes assumes that mutexes always succeed,
  but the mutex code uses the semaphore code and the semaphore
  code appears to have an arbitrary failure path based on the
  number of concurrent requests.

* This fixes kernel confusion and console spam from the ACPI
  subsystem when running sysctl -a concurrently on more than
  4 threads.

12 months agokernel - Remove 'Emergency Pager' debugging messages
Matthew Dillon [Tue, 17 Oct 2017 18:55:24 +0000 (11:55 -0700)]
kernel - Remove 'Emergency Pager' debugging messages

* Remove these messages.  They were for debugging only and, in fact,
  the activation of the anonymous-only pager is not really an
  'Emergency'.

12 months agoAdd mount_hammer2 and newfs_hammer2 to initrd list.
Justin C. Sherrill [Tue, 17 Oct 2017 18:28:14 +0000 (14:28 -0400)]
Add mount_hammer2 and newfs_hammer2 to initrd list.

12 months agomkinitrd - Add missing /var/db (3)
Matthew Dillon [Mon, 16 Oct 2017 22:17:42 +0000 (15:17 -0700)]
mkinitrd - Add missing /var/db (3)

* When /var is mounted via tmpfs we have to mkdir the subdirs
  manually.

* Add /var/db and /var/empty to the directories initrd creates
  in its rc.

Submitted-by: amonk
12 months agovirtio_blk - Fix capacity calculation, when host sets large disk block size.
Imre Vadász [Mon, 16 Oct 2017 22:00:32 +0000 (00:00 +0200)]
virtio_blk - Fix capacity calculation, when host sets large disk block size.

* The disk capacity in the virtio configuration space is always specified
  in 512 byte sectors, so info.d_media_blksize should be 512.

* Also check for VIRTIO_BLK_F_GEOMETRY feature before reading the disk
  geometry from configuration space.

* Add some device_printf calls to report the disk size and (if available)
  geometry during bootup.

12 months agoLINT64: Sort vmx a bit better. v5.0.0
Sascha Wildner [Sun, 15 Oct 2017 11:07:04 +0000 (13:07 +0200)]
LINT64: Sort vmx a bit better.

12 months agoRevert "libthread_xu - Wakeup all waiters"
Matthew Dillon [Sun, 15 Oct 2017 07:44:06 +0000 (00:44 -0700)]
Revert "libthread_xu - Wakeup all waiters"

This reverts commit 4e7c9dfbd0ad1f7bb5ec7c5f6eb6d6a1c44c404a.

* Didn't intend to push this.

12 months agolibthread_xu - Wakeup all waiters
Matthew Dillon [Sun, 15 Oct 2017 07:13:42 +0000 (00:13 -0700)]
libthread_xu - Wakeup all waiters

* For now punt on trying to wakeup an optimized numbers of waiters.
  Wake up all waiters and let them sort it out.

* This may fix specific count races in threaded programs using
  pthread mutexes.

12 months agohammer2 - Handle error on rename in media out of space case
Matthew Dillon [Sat, 14 Oct 2017 22:28:12 +0000 (15:28 -0700)]
hammer2 - Handle error on rename in media out of space case

* Process the error code from hammer2_chain_delete() in
  hammer2_xop_nrename() to ensure that we do not try to reattach
  the chain under another parent.

Reported-by: arcade (Bug #3055)
12 months agosshd - Disable tunneled clear text passwords by default
Matthew Dillon [Sat, 14 Oct 2017 21:18:39 +0000 (14:18 -0700)]
sshd - Disable tunneled clear text passwords by default

* Reapply 1cb3a32c13b and c866a462b3.  sshd on DragonFlyBSD defaults
  to disabling cleartext passwords by default.

Reminded-by: ivadasz
12 months agocpdup(1): Some improvements.
Sascha Wildner [Sat, 14 Oct 2017 19:06:14 +0000 (21:06 +0200)]
cpdup(1): Some improvements.

* Make cpdup retry failed rmdirs after chflags. It already does this
  for remove().

* When deciding whether to copy a file, cpdup should ignore the
  UF_ARCHIVE file flag. If that flag is supported by the destination
  file system but it's cleared on a source file, then multiple
  invocations of cpdup would all copy the source file because its
  flags wouldn't match. OTOH, if the destination filesystem doesn't
  support UF_ARCHIVE, then there's no point in cpdup setting it.

Submitted-by: Will Andrews <will@firepipe.net>
Dragonfly-bug: https://bugs.dragonflybsd.org/issues/2987
               https://bugs.dragonflybsd.org/issues/2988
               https://bugs.dragonflybsd.org/issues/3067

12 months agohammer2 - Slightly reduce LZ4 output buffer limit
Matthew Dillon [Sat, 14 Oct 2017 17:59:30 +0000 (10:59 -0700)]
hammer2 - Slightly reduce LZ4 output buffer limit

* LZ4_compress_limitedOutput() appears to be able to overrun the
  supplied buffer.

* Slightly reduce the LZ4 output buffer limit from a 4-byte alignment
  to an 8-byte alignment to try to fix the problem.

12 months agoFix additional cases of seg-faults on crypt(3) failure
Lubos Boucek [Fri, 13 Oct 2017 21:33:01 +0000 (21:33 +0000)]
Fix additional cases of seg-faults on crypt(3) failure

* On failure, crypt(3) returns NULL, which is then used as a
  strcmp(3) argument

opieftpd.c and opiesu.c are not actually used anywhere.

12 months agosystat.1: Update man page: sync to current program & improve markup a bit
Thomas Nikolajsen [Wed, 11 Oct 2017 23:03:46 +0000 (01:03 +0200)]
systat.1: Update man page: sync to current program & improve markup a bit

    Substantial changes has happened, especially for vmstat display.

12 months agorc.8: Clarify foo.sh behavior.
Sascha Wildner [Sat, 14 Oct 2017 08:48:04 +0000 (10:48 +0200)]
rc.8: Clarify foo.sh behavior.

Improve wording a bit. See NetBSD's revision 1.38.

Reported-by: Aaron LI <aly@aaronly.me>
12 months agodisklabel64: Fix an error message
Aaron LI [Fri, 13 Oct 2017 04:26:29 +0000 (12:26 +0800)]
disklabel64: Fix an error message

12 months agoifconfig(8): Add 'lscan'. Like 'scan', but displays long SSIDs.
Sascha Wildner [Sat, 14 Oct 2017 08:38:45 +0000 (10:38 +0200)]
ifconfig(8): Add 'lscan'. Like 'scan', but displays long SSIDs.

Submitted-by: Max Herrgard <herrgard@gmail.com>
12 months agomkinitrd - Add missing /var/db
Matthew Dillon [Sat, 14 Oct 2017 06:14:31 +0000 (23:14 -0700)]
mkinitrd - Add missing /var/db

* dhclient also needs /var/db to exist, make sure it does.

Reported-by: amonk
12 months agomkinitrd - Add missing /var/empty
Matthew Dillon [Sat, 14 Oct 2017 05:39:31 +0000 (22:39 -0700)]
mkinitrd - Add missing /var/empty

* /var/empty is required by dhclient, which will SIGHUP itself
  without it.

Reported-by: amonk
12 months agoImport OpenSSH-7.6p1
Matthew Dillon [Fri, 13 Oct 2017 01:33:48 +0000 (18:33 -0700)]
Import OpenSSH-7.6p1

* Adjust build to match import

12 months agoImport OpenSSH-7.6p1
Matthew Dillon [Fri, 13 Oct 2017 01:32:28 +0000 (18:32 -0700)]
Import OpenSSH-7.6p1

* Import OpeNSSH-7.6p1.  Couldn't really merge from the vendor branch
  so just brought it in.

* Adjustments for WARNS issues

12 months ago<netdb.h>: Adjust comment a bit.
Sascha Wildner [Thu, 12 Oct 2017 08:16:06 +0000 (10:16 +0200)]
<netdb.h>: Adjust comment a bit.

12 months agolibc/net: Add NI_NUMERICSCOPE flag for getnameinfo().
Sascha Wildner [Thu, 12 Oct 2017 08:13:31 +0000 (10:13 +0200)]
libc/net: Add NI_NUMERICSCOPE flag for getnameinfo().

Code to handle it is already present in getnameinfo() but we
were missing the flag so far.

See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html

12 months agokernel: Simplify various redundant conditions.
Sascha Wildner [Wed, 11 Oct 2017 14:55:23 +0000 (16:55 +0200)]
kernel: Simplify various redundant conditions.

Found-by: cppcheck
One was reported by dcb in <https://bugs.dragonflybsd.org/issues/3078>.

12 months agokernel/atkbdc: Fix a prototype.
Sascha Wildner [Wed, 11 Oct 2017 20:05:26 +0000 (22:05 +0200)]
kernel/atkbdc: Fix a prototype.

12 months agokernel/cam: Add some missing parameter names.
Sascha Wildner [Wed, 11 Oct 2017 20:04:43 +0000 (22:04 +0200)]
kernel/cam: Add some missing parameter names.

Just like the rest of the file.

12 months ago<vfs/hammer2/hammer2.h>: Fix parameter names in two prototypes.
Sascha Wildner [Wed, 11 Oct 2017 17:31:25 +0000 (19:31 +0200)]
<vfs/hammer2/hammer2.h>: Fix parameter names in two prototypes.

Discussed-with: dillon

12 months agolibc - Bring in s_ceill.c v1.2 from OpenBSD (2)
Matthew Dillon [Tue, 10 Oct 2017 22:38:08 +0000 (15:38 -0700)]
libc - Bring in s_ceill.c v1.2 from OpenBSD (2)

* Note, correction, v1.3 from OpenBSD, not v1.2

* Restore a cast that we need to compile with our higher WARNS level.

Reported-by: marino, xenu
12 months agokernel/mrsas: Simplify redundant conditions and remove never used variable
Lubos Boucek [Mon, 2 Oct 2017 02:16:10 +0000 (02:16 +0000)]
kernel/mrsas: Simplify redundant conditions and remove never used variable

Reported-by: dcb
12 months agolibc - Bring in s_ceill.c v1.2 from OpenBSD
Matthew Dillon [Tue, 10 Oct 2017 02:17:32 +0000 (19:17 -0700)]
libc - Bring in s_ceill.c v1.2 from OpenBSD

fix a case where ceill() returns 1.0L: in the x86 extended precision format
the fraction part has no implicit bit.

Reported-by: xenu
Taken-from: OpenBSD

12 months agohammer2.8/pthread_attr_setaffinity_np.3: Fix mdoc issues.
Sascha Wildner [Sun, 8 Oct 2017 07:47:58 +0000 (09:47 +0200)]
hammer2.8/pthread_attr_setaffinity_np.3: Fix mdoc issues.

12 months agodisklabel64.8: Add HAMMER2 fstype info.
Thomas Nikolajsen [Sat, 7 Oct 2017 14:14:52 +0000 (16:14 +0200)]
disklabel64.8: Add HAMMER2 fstype info.

12 months agoperiodic.conf.5: Add hammer2 variables.
Thomas Nikolajsen [Sat, 7 Oct 2017 14:09:36 +0000 (16:09 +0200)]
periodic.conf.5: Add hammer2 variables.

    Add description for periodic HAMMER2 script variables: 161.clean_hammer2.
    While here add HAMMER man pages to SEE ALSO section.

12 months agoetc/periodic/daily/161.clean-hammer2: Fix typo
Thomas Nikolajsen [Sat, 7 Oct 2017 13:53:37 +0000 (15:53 +0200)]
etc/periodic/daily/161.clean-hammer2: Fix typo

    pfslist variable for HAMMER, not HAMMER2 was used.
    This will typically have no effect, as pfslist is typically empty.

12 months agoperiodic.conf: Fix typo in comment
Thomas Nikolajsen [Sat, 7 Oct 2017 13:19:41 +0000 (15:19 +0200)]
periodic.conf: Fix typo in comment

12 months agomount_hammer2(8): Add man page.
Thomas Nikolajsen [Sat, 7 Oct 2017 13:13:11 +0000 (15:13 +0200)]
mount_hammer2(8): Add man page.

12 months agoBring in vmx(4) (VMware virtual network driver, aka vmxnet3).
Sascha Wildner [Wed, 4 Oct 2017 17:01:17 +0000 (19:01 +0200)]
Bring in vmx(4) (VMware virtual network driver, aka vmxnet3).

Some features are still disabled, namely LRO, TSO, VLAN_HWFILTER,
and MSI-X support. That being said, it works and seems stable.

Tested-by: swildner (VMware Player 7.1.4 build-3848939)
            tuxillo (VMware ESXi 6.5.0 (Build 4887370))
Taken-from: FreeBSD (in turn based on OpenBSD's driver)

12 months agokernel - Refuse to swapoff under certain conditions
Matthew Dillon [Fri, 6 Oct 2017 05:59:40 +0000 (22:59 -0700)]
kernel - Refuse to swapoff under certain conditions

* Both tmpfs and vn can't handle swapoff's method of bringing pages
  back in from the swap partition being decomissioned.

* Fixing this properly is fairly involved. The normal swapoff procedure
  is to page swap into the related VM object, but tmpfs and vn use their
  VM objects ONLY to track swap blocks and not for vm_page manipulation,
  so that just won't work.  In addition, the swap code may associate
  a swap block with a VM object before issuing the write I/O to page
  out the data, and the swapoff code's asynchronous pagein might cause
  problems.

  For now, just make sure that swapoff refuses to remove the partition
  under these conditions, so it doesn't blow up tmpfs or vn.

12 months agotmpfs - Fix bug in call to vinitvmio()
Matthew Dillon [Fri, 6 Oct 2017 01:57:33 +0000 (18:57 -0700)]
tmpfs - Fix bug in call to vinitvmio()

* TMPFS_BLKMASK was being passed to vinitvmio() instead of
  TMPFS_BLKSIZE.  It is unclear if this caused any particular
  issue other than an occasional console warning.  Fixed.

12 months agokernel - Change index fields from unsigned to signed
Matthew Dillon [Thu, 5 Oct 2017 20:46:54 +0000 (13:46 -0700)]
kernel - Change index fields from unsigned to signed

* We use a signed trick for (j), fix the code so it actually works.

* The chipset field used to index (i) cannot exceed 1024 anyway.

Reported-by: lubos Bug #3020
12 months agoFix seg-faults on crypt(3) failure
Lubos Boucek [Sat, 23 Sep 2017 07:12:28 +0000 (07:12 +0000)]
Fix seg-faults on crypt(3) failure

12 months agoImprove kdump.1 and ktrace.1
Lubos Boucek [Fri, 22 Sep 2017 22:27:18 +0000 (22:27 +0000)]
Improve kdump.1 and ktrace.1

12 months agonologin(8): Sync with FreeBSD; Symlink as /usr/sbin/nologin
Aaron LI [Wed, 27 Sep 2017 10:24:05 +0000 (18:24 +0800)]
nologin(8): Sync with FreeBSD; Symlink as /usr/sbin/nologin

* Sync "nologin.c" with FreeBSD.  Login attempts are logged into syslog.
* Create symlink "/usr/sbin/nologin" to "/sbin/nologin".  FreeBSD
  (and Linux) installs "nologin" at  "/usr/sbin/nologin", and the users
  created by DPorts/packages also use "/usr/sbin/nologin" (see
  "/usr/dports/UIDs").
* Statically link "nologin" as done by FreeBSD.

12 months agosocket: Limit the number of accepted sockets that kevent reports.
Sepherosa Ziehau [Thu, 5 Oct 2017 06:06:11 +0000 (14:06 +0800)]
socket: Limit the number of accepted sockets that kevent reports.

By default it is limited to 32.  It can be changed through:
sysctl kern.ipc.soavailconn=X

This change does _not_ affect userland using accept(2) in the following
way:
    for (;;) {
        s = accept();
        if (s < 0 && errno == EAGAIN)
            break;
        /* Processing accepted socket. */
    }

This change only affects optimized userland using kevent.data to avoid
extra accept(2) syscall:
    for (i = 0; i < kevent.data; ++i) {
        s = accept();
        /* Processing accepted socket. */
    }

The above logic is applied by nginx.  However, due to the cost of the
"Processing accepted socket" parts, this kinda of loop can increase
latency and destablize latency.

The comparison w/ 30K concurrent connections, 1 request/connection.

 1K web object
         |  performance |  lat-avg | lat-stdev |  lat-99%
---------+--------------+----------+-----------+----------
no limit | 210279.88tps |  59.19ms |    4.60ms |  69.02ms
---------+--------------+----------+-----------+----------
32 limit | 217599.01tps |  32.00ms |    2.35ms |  35.59ms

========

 8K web object
         |  performance |  lat-avg | lat-stdev |  lat-99%
---------+--------------+----------+-----------+----------
no limit | 180627.61tps |  70.53ms |    4.95ms |  80.61ms
---------+--------------+----------+-----------+----------
32 limit | 186324.41tps |  37.41ms |    4.81ms |  48.69ms

========

16K web object
         |  performance |  lat-avg | lat-stdev |  lat-99%
---------+--------------+----------+-----------+----------
no limit | 138667.84tps |  95.93ms |   14.90ms | 135.47ms
---------+--------------+----------+-----------+----------
32 limit | 138778.11tps |  60.90ms |   11.80ms |  92.07ms

This change significantly reduces average latency and .99 latency,
and performance is improved slightly.

12 months agokernel - Fix GCC reordering problem with td_critcount
Matthew Dillon [Tue, 3 Oct 2017 01:42:34 +0000 (18:42 -0700)]
kernel - Fix GCC reordering problem with td_critcount

* Wrap all ++td->td_critcount and --td->td_critcount use cases
  with an inline which executes cpu_ccfence() before and after,
  to guarantee that GCC does not try to reorder the operation around
  critical memory changes.

* This fixes a race in lockmgr() and possibly a few other places
  too.

12 months agokernel - Fix rare lockmgr() state transition (2)
Matthew Dillon [Sun, 1 Oct 2017 18:18:49 +0000 (11:18 -0700)]
kernel - Fix rare lockmgr() state transition (2)

* Fix two lock timeout cases for LK_EXCLUPGRADE and LK_UPGRADE, and
  fix a bug in undo_upreq().

* A tsleep failure (such as the LK_TIMELOCK case via
  vm_map_lock_read_to()) was not properly backing-out a LKC_UPREQ,
  resulting in a situation where the lock becomes exclusively owned
  by nobody and deadlocks against all-comers.  Fix by properly
  calling undo_upreq().

* Fix a bug in undo_upreq() itself.  When undoing a granted UPREQ,
  the lockholder must be set prior to releasing the now-granted
  exclusive lock in order to avoid an assertion panic.

* While we are at it, replace a weird cmpset count,count with a
  fetchadd(count, 0).

12 months agosbin/hammer: Fix compile-time warning by some Linux distros
Tomohiro Kusumi [Sun, 1 Oct 2017 12:37:54 +0000 (15:37 +0300)]
sbin/hammer: Fix compile-time warning by some Linux distros

--
test_dupkey.c: In function 'main':
test_dupkey.c:54:1: warning: control reaches end of non-void function [-Wreturn-type]
 }

12 months agoFix some minor issues in several manual pages.
Sascha Wildner [Sun, 1 Oct 2017 10:09:02 +0000 (12:09 +0200)]
Fix some minor issues in several manual pages.

12 months agoX86_64_GENERIC: Fix indent.
Sascha Wildner [Sun, 1 Oct 2017 09:35:59 +0000 (11:35 +0200)]
X86_64_GENERIC: Fix indent.

12 months agokernel - Improve tsleep/wakeup queue collisions (3)
Matthew Dillon [Sun, 1 Oct 2017 01:17:55 +0000 (18:17 -0700)]
kernel - Improve tsleep/wakeup queue collisions (3)

* Doh, fix variable declaration.

12 months agokernel - Improve tsleep/wakeup queue collisions (2)
Matthew Dillon [Sun, 1 Oct 2017 01:11:08 +0000 (18:11 -0700)]
kernel - Improve tsleep/wakeup queue collisions (2)

* Fix SMP race.  When testing ident0 against -1 or the ident value
  as stored in a remote cpu's structure, ident0 must be loaded from memory
  once to avoid a cross-over race.

12 months agokernel - Fix rare lockmgr() state transition
Matthew Dillon [Sat, 30 Sep 2017 22:12:30 +0000 (15:12 -0700)]
kernel - Fix rare lockmgr() state transition

* When lockmgr() is releasing the last count on an exclusive lock
  with an upgrade request pending, and the atomic op fails, the
  code fails to properly retry.  Fixed by properly retrying.

* This situation should not be possible to even get into, hence 'rare'.
  It requires UPREQ to be set while the lock is being held exclusively,
  which should never be possible because there is no shared lock holder
  in that case who might attempt to upgrade.

  I checked race conditions when multiple shared holders attempt
  to upgrade but all that happens is that one will release and
  acquire a normal exclusive lock instead.

12 months agoFix some Xr punctuation issues in several manual pages.
Sascha Wildner [Sat, 30 Sep 2017 21:18:41 +0000 (23:18 +0200)]
Fix some Xr punctuation issues in several manual pages.

12 months agoUse standard section name 'AUTHORS' in several manual pages.
Sascha Wildner [Sat, 30 Sep 2017 21:12:11 +0000 (23:12 +0200)]
Use standard section name 'AUTHORS' in several manual pages.

12 months agoChanged OSNAME to match 5.0. v5.0.0rc2
Justin C. Sherrill [Sat, 30 Sep 2017 21:24:32 +0000 (17:24 -0400)]
Changed OSNAME to match 5.0.

12 months agoRevert "Update drm/radeon to Linux 4.7.10 as much as possible..."
Imre Vadász [Sat, 30 Sep 2017 19:08:51 +0000 (21:08 +0200)]
Revert "Update drm/radeon to Linux 4.7.10 as much as possible..."

This caused severe issues on some modern radeon models (e.g. Kaveri APUs).
Not reverting the 62dc643ef61b347c4c2e60ad9ea68dd766741c90 commit, it's just
a 2 character diff that was conflicting with this change.

This reverts commit a7a95252afec8bfcc34ee5b8725136b17b77043f.

Tested-By: ivadasz
Reported-By: several people on #dragonflybsd
12 months ago<sys/param.h>: Fix __DragonFly_version.
Sascha Wildner [Sat, 30 Sep 2017 17:47:14 +0000 (19:47 +0200)]
<sys/param.h>: Fix __DragonFly_version.

Reported-by: zrj
12 months agoUpdate UPDATING a bit for the disabling of FFS_ROOT.
Sascha Wildner [Sat, 30 Sep 2017 17:29:42 +0000 (19:29 +0200)]
Update UPDATING a bit for the disabling of FFS_ROOT.

12 months agorc.conf.5: Improve moused_type description a bit more.
Sascha Wildner [Sat, 30 Sep 2017 14:47:04 +0000 (16:47 +0200)]
rc.conf.5: Improve moused_type description a bit more.

12 months ago5.0 branching. v5.0.0rc1
Justin C. Sherrill [Sat, 30 Sep 2017 00:10:43 +0000 (20:10 -0400)]
5.0 branching.

12 months agorc.conf.5: Improve wording of the moused_type variable description.
Sascha Wildner [Fri, 29 Sep 2017 19:03:36 +0000 (21:03 +0200)]
rc.conf.5: Improve wording of the moused_type variable description.

Especially, point out that the default is 'auto' and if that is
what the user wants, they need not set it explicitly in their
/etc/rc.conf.

Reported-by: htse (Harald Brinkhof)
12 months agoarp: Allocate context memory on owner cpu.
Sepherosa Ziehau [Fri, 29 Sep 2017 06:38:35 +0000 (14:38 +0800)]
arp: Allocate context memory on owner cpu.

12 months agosyncache: Timer queue iteration is MPsafe; no need to use marker.
Sepherosa Ziehau [Fri, 29 Sep 2017 01:30:46 +0000 (09:30 +0800)]
syncache: Timer queue iteration is MPsafe; no need to use marker.

12 months agosyncache: Move local variables close their usage.
Sepherosa Ziehau [Fri, 29 Sep 2017 01:03:46 +0000 (09:03 +0800)]
syncache: Move local variables close their usage.

12 months agosyncache: inpcb will never be NULL.
Sepherosa Ziehau [Fri, 29 Sep 2017 01:02:03 +0000 (09:02 +0800)]
syncache: inpcb will never be NULL.

12 months agosyncache: Resurrect net.inet.tcp.syncache.count
Sepherosa Ziehau [Fri, 29 Sep 2017 00:11:18 +0000 (08:11 +0800)]
syncache: Resurrect net.inet.tcp.syncache.count

12 months agosyncache: Allocate syncache context on the owner cpu.
Sepherosa Ziehau [Thu, 28 Sep 2017 23:38:19 +0000 (07:38 +0800)]
syncache: Allocate syncache context on the owner cpu.