]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoPull in r282174 from upstream llvm trunk (by Krzysztof Parzyszek):
Dimitry Andric [Fri, 25 Nov 2016 18:01:32 +0000 (18:01 +0000)]
Pull in r282174 from upstream llvm trunk (by Krzysztof Parzyszek):

  [PPC] Set SP after loading data from stack frame, if no red zone is
  present

  Follow-up to r280705: Make sure that the SP is only restored after
  all data is loaded from the stack frame, if there is no red zone.

  This completes the fix for
  https://llvm.org/bugs/show_bug.cgi?id=26519.

  Differential Revision: https://reviews.llvm.org/D24466

Reported by:    Mark Millard
PR:             214433

7 years agoUpdate r309143 to prevent false sharing.
Fabien Thomas [Fri, 25 Nov 2016 17:20:23 +0000 (17:20 +0000)]
Update r309143 to prevent false sharing.

Reported by: mjg
Approved by: so
MFC after: 1 month

7 years agoFix the TLB conflict abort value. This should be a no-op as we don't use
Andrew Turner [Fri, 25 Nov 2016 16:04:36 +0000 (16:04 +0000)]
Fix the TLB conflict abort value. This should be a no-op as we don't use
this value in the code.

7 years agoIPsec RFC6479 support for replay window sizes up to 2^32 - 32 packets.
Fabien Thomas [Fri, 25 Nov 2016 14:44:49 +0000 (14:44 +0000)]
IPsec RFC6479 support for replay window sizes up to 2^32 - 32 packets.

Since the previous algorithm, based on bit shifting, does not scale
with large replay windows, the algorithm used here is based on
RFC 6479: IPsec Anti-Replay Algorithm without Bit Shifting.
The replay window will be fast to be updated, but will cost as many bits
in RAM as its size.

The previous implementation did not provide a lock on the replay window,
which may lead to replay issues.

Reviewed by: ae
Obtained from: emeric.poupon@stormshield.eu
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D8468

7 years agoIn a dual processor system (2*6 cores) during IPSec throughput tests,
Fabien Thomas [Fri, 25 Nov 2016 13:49:33 +0000 (13:49 +0000)]
In a dual processor system (2*6 cores) during IPSec throughput tests,
we see a lot of contention on the arc4 lock, used to generate the IV
of the ESP output packets.

The idea of this patch is to split this mutex in order to reduce the
contention on this lock.

Reviewed by: delphij, markm, ache
Approved by: so
Obtained from: emeric.poupon@stormshield.eu
MFC after: 1 month
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D8130

7 years agoAdd WITH_LLD_AS_LD build knob
Ed Maste [Fri, 25 Nov 2016 13:15:28 +0000 (13:15 +0000)]
Add WITH_LLD_AS_LD build knob

If set it installs LLD as /usr/bin/ld.  LLD (as of version 3.9) is not
capable of linking the world and kernel, but can self-host and link many
substantial applications. GNU ld continues to be used for the world and
kernel build, regardless of how this knob is set.

It is on by default for arm64, and off for all other CPU architectures.

Sponsored by: The FreeBSD Foundation

7 years agohyperv/vmbus: Add a simplified version of channel close.
Sepherosa Ziehau [Fri, 25 Nov 2016 09:13:10 +0000 (09:13 +0000)]
hyperv/vmbus: Add a simplified version of channel close.

So that the caller can know the channel close error and react accordingly.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8600

7 years agohyperv/vmbus: Propagate close error.
Sepherosa Ziehau [Fri, 25 Nov 2016 08:57:52 +0000 (08:57 +0000)]
hyperv/vmbus: Propagate close error.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8599

7 years agohyperv/vmbus: Always try disconnect/free bufring memory upon channel close
Sepherosa Ziehau [Fri, 25 Nov 2016 08:31:13 +0000 (08:31 +0000)]
hyperv/vmbus: Always try disconnect/free bufring memory upon channel close

While I'm here, minor wording and style changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8598

7 years agohyperv/vmbus: Don't free the bufring if its GPADL can't be disconnected.
Sepherosa Ziehau [Fri, 25 Nov 2016 07:41:42 +0000 (07:41 +0000)]
hyperv/vmbus: Don't free the bufring if its GPADL can't be disconnected.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8570

7 years agohyperv/vmbus: Return EISCONN if the bufring GPADL can't be disconnected.
Sepherosa Ziehau [Fri, 25 Nov 2016 07:24:11 +0000 (07:24 +0000)]
hyperv/vmbus: Return EISCONN if the bufring GPADL can't be disconnected.

So that the callers of vmbus_chan_open_br() could handle the passed in
bufring memory properly.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8569

7 years agohyperv/vmbus: No stranded bufring GPADL is allowed.
Sepherosa Ziehau [Fri, 25 Nov 2016 07:03:45 +0000 (07:03 +0000)]
hyperv/vmbus: No stranded bufring GPADL is allowed.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8568

7 years agohyperv/vmbus: GPADL disconnect error on a revoked channel is benign.
Sepherosa Ziehau [Fri, 25 Nov 2016 06:48:53 +0000 (06:48 +0000)]
hyperv/vmbus: GPADL disconnect error on a revoked channel is benign.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8567

7 years agohyperv/vmbus: Don't close unopened channels.
Sepherosa Ziehau [Fri, 25 Nov 2016 06:12:18 +0000 (06:12 +0000)]
hyperv/vmbus: Don't close unopened channels.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8566

7 years agohyperv/vmbus: Fix sysctl tree leakage, if channel open fails.
Sepherosa Ziehau [Fri, 25 Nov 2016 06:01:45 +0000 (06:01 +0000)]
hyperv/vmbus: Fix sysctl tree leakage, if channel open fails.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8565

7 years agohyperv/vmbus: Minor style changes.
Sepherosa Ziehau [Fri, 25 Nov 2016 05:46:15 +0000 (05:46 +0000)]
hyperv/vmbus: Minor style changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8564

7 years agohyperv/vmbus: Commit the GPADL id only after the connection succeeds.
Sepherosa Ziehau [Fri, 25 Nov 2016 05:35:29 +0000 (05:35 +0000)]
hyperv/vmbus: Commit the GPADL id only after the connection succeeds.

Minor style change.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8563

7 years agohyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined
Dexuan Cui [Fri, 25 Nov 2016 04:35:40 +0000 (04:35 +0000)]
hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined

vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at
least shouldn't break build.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 3 days
Sponsored by: Microsoft

7 years agoCorrect lld llvm-tblgen dependency file name
Ed Maste [Fri, 25 Nov 2016 01:24:35 +0000 (01:24 +0000)]
Correct lld llvm-tblgen dependency file name

7 years agoUpgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0
Dimitry Andric [Thu, 24 Nov 2016 22:54:55 +0000 (22:54 +0000)]
Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0
release, and add lld 3.9.0.  Also completely revamp the build system for
clang, llvm, lldb and their related tools.

Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
support to build; see UPDATING for more information.

Release notes for llvm, clang and lld are available here:
<http://llvm.org/releases/3.9.0/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.9.0/tools/clang/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.9.0/tools/lld/docs/ReleaseNotes.html>

Thanks to Ed Maste, Bryan Drewery, Andrew Turner, Antoine Brodin and Jan
Beich for their help.

Relnotes: yes
MFC after: 1 month

7 years agoMerge ^/head r309118 through r309122.
Dimitry Andric [Thu, 24 Nov 2016 22:33:18 +0000 (22:33 +0000)]
Merge ^/head r309118 through r309122.

7 years agoAdd UPDATING entry for clang/llvm 3.9.0 import.
Dimitry Andric [Thu, 24 Nov 2016 22:18:55 +0000 (22:18 +0000)]
Add UPDATING entry for clang/llvm 3.9.0 import.

7 years agovirtio_console: handle short writes to an Unix domain socket gracefully.
Jakub Wojciech Klama [Thu, 24 Nov 2016 22:16:18 +0000 (22:16 +0000)]
virtio_console: handle short writes to an Unix domain socket gracefully.

writev() can do a short write.  Retrying it results in a very convoluted
and complex code, so we iterate over iovec and do regular stream_write()
instead.

Approved by: trasz
Sponsored by: iXsystems, Inc.

7 years agoAllow opening virtio-console ports from the host side before guest
Jakub Wojciech Klama [Thu, 24 Nov 2016 21:53:42 +0000 (21:53 +0000)]
Allow opening virtio-console ports from the host side before guest
enumerates them.

Approved by: trasz
Sponsored by: iXsystems, Inc.

7 years agovirtio_pci: fix announcement of MSI-X interrupts for queues
Andriy Gapon [Thu, 24 Nov 2016 21:32:04 +0000 (21:32 +0000)]
virtio_pci: fix announcement of MSI-X interrupts for queues

Queues that do not need interrupts - for instance, output queues - do
not have a corresponding entry in vtpci_msix_vq_interrupts.
So, it was wrong to increment a pointer into that array when iterating
over such a queue.

I ran into this bug while trying to use virtio_console(4) that allocates
a lot of queues with every other being an output queue without an
interrupt handler (if MultiplePorts feature is negotiated).

MFC after: 2 weeks

7 years agoMerge ^/head r309106 through r309117.
Dimitry Andric [Thu, 24 Nov 2016 21:14:22 +0000 (21:14 +0000)]
Merge ^/head r309106 through r309117.

7 years agoIn preparation for merging back to head, bump __FreeBSD_version,
Dimitry Andric [Thu, 24 Nov 2016 21:12:43 +0000 (21:12 +0000)]
In preparation for merging back to head, bump __FreeBSD_version,
FREEBSD_CC_VERSION and set date in ObsoleteFiles.inc.

7 years agovirtio_console: correctly determine presense of payload and its length
Andriy Gapon [Thu, 24 Nov 2016 21:12:32 +0000 (21:12 +0000)]
virtio_console: correctly determine presense of payload and its length

MFC after: 2 weeks

7 years agoFix the build post-r309017 for MPC85XX/MPC85XXSPE
Justin Hibbits [Thu, 24 Nov 2016 20:31:46 +0000 (20:31 +0000)]
Fix the build post-r309017 for MPC85XX/MPC85XXSPE

r309017 removed two fields from struct vmmeter, which is embedded in struct
pcpu.  This caused the struct size to change, triggering the CTASSERT in
sys/pcpu.h.  Add the extra 8 bytes back in as padding.

7 years agoAdd the etherswitch(4) support for TI CPSW.
Luiz Otavio O Souza [Thu, 24 Nov 2016 20:14:43 +0000 (20:14 +0000)]
Add the etherswitch(4) support for TI CPSW.

Adds VLAN and port management abilities for etherswitchcfg(8).

The code is conditionally enabled for now, because it is not necessary on
single ethernet use cases.

Obtained from: pfSense
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)

7 years ago[bytgpio] Fix pc98 build by disabling bytgpio module for this platform
Oleksandr Tymoshenko [Thu, 24 Nov 2016 20:08:17 +0000 (20:08 +0000)]
[bytgpio] Fix pc98 build by disabling bytgpio module for this platform

Reported by: dim

7 years agowait: avoid relocking the child if proc_to_reap returns 1
Mateusz Guzik [Thu, 24 Nov 2016 18:21:48 +0000 (18:21 +0000)]
wait: avoid relocking the child if proc_to_reap returns 1

proc_to_reap would always unlock. However, if it returned 1, kern_wait6
would immediately lock it again. Save the dance.

Reviewed by: kib

7 years agoAdd a warning against modifying this code without understanding it, and
Dag-Erling Smørgrav [Thu, 24 Nov 2016 14:50:21 +0000 (14:50 +0000)]
Add a warning against modifying this code without understanding it, and
an example of how not to make it more portable.  I've had this lying
around uncommitted since 2009...

7 years agoMerge ^/head r308870 through r309105.
Dimitry Andric [Thu, 24 Nov 2016 14:39:04 +0000 (14:39 +0000)]
Merge ^/head r308870 through r309105.

7 years agoSync the rtwn(4) entry with the manpage.
Christian Brueffer [Thu, 24 Nov 2016 10:35:49 +0000 (10:35 +0000)]
Sync the rtwn(4) entry with the manpage.

7 years agoMFV r308990: 7181 race between zfs_mount and zfs_ioc_rollback
Andriy Gapon [Thu, 24 Nov 2016 10:34:42 +0000 (10:34 +0000)]
MFV r308990: 7181 race between zfs_mount and zfs_ioc_rollback

illumos/illumos-gate@90f2c094b3822f4825f21cef2c2faf7d03b55139
https://github.com/illumos/illumos-gate/commit/90f2c094b3822f4825f21cef2c2faf7d03b55139

https://www.illumos.org/issues/7181
  zfsvfs_setup() is called in both zfs_mount and zfs_resume_fs paths.
  dmu_objset_set_user(zfsvfs->z_os, zfsvfs) is called early in zfsvfs_setup()
  before the setup is actually completed,
  thus an under-constructed zfsvfs becomes visible.
  Additionally, there is nothing to serialize the two call paths. As a result two
  threads can step on each other's toes.
  assertion failed: zilog->zl_clean_taskq == NULL, file:
  ../../common/fs/zfs/zil.c, line: 1772

  > $c
  vpanic()
  0xfffffffffbdf6928()
  zil_open+0x45(ffffff1bbc5dd000fffffffff7993880)
  zfsvfs_setup+0x84(ffffffb378d77000, 0)
  zfs_resume_fs+0x132(ffffffb378d77000ffffffb37ddcf000)
  zfs_ioc_rollback+0x96(ffffffb37ddcf000ffffff01dcdc4cd0ffffff01aa091000)
  zfsdev_ioctl+0x215(10a00000000, 5a19, 80465f8, 100003, ffffff01ab318368,
  ffffff0004b59e58)
  cdev_ioctl+0x39(10a00000000, 5a19, 80465f8, 100003, ffffff01ab318368,
  ffffff0004b59e58)
  spec_ioctl+0x60(ffffff0197737700, 5a19, 80465f8, 100003,
  ffffff01ab318368ffffff0004b59e58)
  fop_ioctl+0x55(ffffff0197737700, 5a19, 80465f8, 100003,
  ffffff01ab318368ffffff0004b59e58)
  ioctl+0x9b(7, 5a19, 80465f8)
  sys_syscall32+0x1f7()

  > ffffff1bbc5dd000::print objset_t os_zil
  os_zil = 0xffffff1c053cf7c0
  > 0xffffff1c053cf7c0::print zilog_t zl_clean_taskq

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

MFC after: 2 weeks

7 years agoMFV r308988: 7199, 7200 dsl_dataset_rollback_sync may try to free
Andriy Gapon [Thu, 24 Nov 2016 10:29:21 +0000 (10:29 +0000)]
MFV r308988: 7199, 7200 dsl_dataset_rollback_sync may try to free
already free blocks

7199 dsl_dataset_rollback_sync may try to free already free blocks
7200 no blocks must be born in a txg after a snaphot is created

illumos/illumos-gate@bfaed0b91e57062c38bc16b4f89db3c8f0052a9b
https://github.com/illumos/illumos-gate/commit/bfaed0b91e57062c38bc16b4f89db3c8f0052a9b

https://www.illumos.org/issues/7199
  dsl_dataset_rollback_sync may try to free already freed blocks when it calls
  dsl_destroy_head_sync_impl to destroy a temporary clone.
  That happens if a snapshot to which we are rolling back and from which the
  clone is created has some ZIL records.

https://www.illumos.org/issues/7200
  No new blocks must be born in a dataset in the same TXG after a snapshot of the
  dataset is taken.
  Those blocks would have the same blk_birth as the dataset's ds_prev_snap_txg
  and as such they would be presumed to belong o the snapshot while in fact they
  do not.
  All the datasets must be clean before sync tasks are run, so the described
  scenario may happen only if one of the sync tasks dirties the dataset and
  another sync task takes its snapshot.
  Then, there will be another sync pass because of the dirty data and the new
  blocks will be born in the same TXG when the data is written out.
  It seems that almost all of the existing sync tasks modify only MOS and do not
  dirty any objsets.
  The only exception that I've been able to identify so far is the rollback which
  can modify an objset when it zeroes out the objset's ZIL.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

MFC after: 3 weeks

7 years agoMFV r308987: 7180 potential race between zfs_suspend_fs+zfs_resume_fs
Andriy Gapon [Thu, 24 Nov 2016 10:21:22 +0000 (10:21 +0000)]
MFV r308987: 7180 potential race between zfs_suspend_fs+zfs_resume_fs
and zfs_ioc_rename

illumos/illumos-gate@690041b9caf801816f2d0bac90bc7cecefb73523
https://github.com/illumos/illumos-gate/commit/690041b9caf801816f2d0bac90bc7cecefb73523

https://www.illumos.org/issues/7180
  If a filesystem is not unmounted while the rename is being performed, then, for
  example, a concurrect zfs rollback may call zfs_suspend_fs followed by
  zfs_resume_fs on the same filesystem.
  The latter takes the filesystem's name as an argument. If the filesystem name
  changes as a result of the rename, then dmu_objset_hold(osname, zfsvfs, &os)
  call in zfs_resume_fs would fail resulting in a kernel panic.
  So far I have been able to reproduce this problem on FreeBSD where zfs rename
  has -u option that skips the unmounting before doing the renaming.
  But I think that in theory the same problem can occur on illumos as well,
  because the unmounting is done in userland before invoking the rename ioctl and
  there could be a race with, e.g., zfs mount.
  panic: solaris assert: dmu_objset_hold(osname, zfsvfs, &zfsvfs->z_os) == 0 (0x2
  == 0x0), file: /usr/devel/svn/head/sys/cddl/contrib/opensolaris/uts/common/fs/
  zfs/zfs_vfsops.c, line: 2210
  KDB: stack backtrace:
  db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004df30710
  vpanic() at vpanic+0x182/frame 0xfffffe004df30790
  panic() at panic+0x43/frame 0xfffffe004df307f0
  assfail3() at assfail3+0x2c/frame 0xfffffe004df30810
  zfs_resume_fs() at zfs_resume_fs+0xb9/frame 0xfffffe004df30860
  zfs_ioc_rollback() at zfs_ioc_rollback+0x61/frame 0xfffffe004df308a0
  zfsdev_ioctl() at zfsdev_ioctl+0x65c/frame 0xfffffe004df30940
  devfs_ioctl_f() at devfs_ioctl_f+0x156/frame 0xfffffe004df309a0
  kern_ioctl() at kern_ioctl+0x246/frame 0xfffffe004df30a00
  sys_ioctl() at sys_ioctl+0x171/frame 0xfffffe004df30ae0
  amd64_syscall() at amd64_syscall+0x2db/frame 0xfffffe004df30bf0
  Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe004df30bf0

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

MFC after: 2 weeks

7 years agoMFV r308989: 6428 set canmount=off on unmounted filesystem tries to
Andriy Gapon [Thu, 24 Nov 2016 10:11:09 +0000 (10:11 +0000)]
MFV r308989: 6428 set canmount=off on unmounted filesystem tries to
unmount children

This is a cosmetic and bookkeeping change as the actual change is
already in FreeBSD.
See r297521, r304520, r308985.

7 years agoFix path for per-user nsmb.conf file
Ganael LAPLANCHE [Thu, 24 Nov 2016 10:04:20 +0000 (10:04 +0000)]
Fix path for per-user nsmb.conf file

~/nsmb.conf, as erroneously introduced by r214387, is never used. Fix the man
page to specify that ~/.nsmbrc is used instead.

PR: 210652
Submitted by: ganael.laplanche@corp.ovh.com
Approved by: gjb (doceng@)

7 years agofirewire: initialize tag label to -1 in fw_xfer_alloc()
Andriy Gapon [Thu, 24 Nov 2016 09:47:56 +0000 (09:47 +0000)]
firewire: initialize tag label to -1 in fw_xfer_alloc()

Zero can be confused for a potentially valid value.
For example, if I load and unload sbp driver I get a lot of messages
like the following:

fw_tl_free: the xfer is not in the queue (tlabel=0, flag=0x0)
send: dst=0x00 tl=0x00 rt=0 tcode=0x0 pri=0x0 src=0x000
recv: dst=0x01 tl=0x21 rt=1 tcode=0x1 pri=0x0 src=0xffc0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe04464407e0
fw_tl_free() at fw_tl_free+0x18d/frame 0xfffffe0446440820
fw_xfer_unload() at fw_xfer_unload+0xca/frame 0xfffffe0446440840
fw_xferlist_remove() at fw_xferlist_remove+0x2f/frame 0xfffffe0446440870
sbp_detach() at sbp_detach+0x1e0/frame 0xfffffe04464408e0
device_detach() at device_detach+0x80/frame 0xfffffe0446440900
devclass_driver_deleted() at devclass_driver_deleted+0x6a/frame 0xfffffe0446440940
devclass_delete_driver() at devclass_delete_driver+0x7d/frame 0xfffffe0446440980
driver_module_handler() at driver_module_handler+0xff/frame 0xfffffe04464409d0
module_unload() at module_unload+0x32/frame 0xfffffe04464409f0
linker_file_unload() at linker_file_unload+0x24b/frame 0xfffffe0446440a40
kern_kldunload() at kern_kldunload+0xbc/frame 0xfffffe0446440a70
amd64_syscall() at amd64_syscall+0x314/frame 0xfffffe0446440bf0
Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe0446440bf0

MFC after: 2 weeks

7 years agofwohci: report whether PhysicalUpperBound register is implemented
Andriy Gapon [Thu, 24 Nov 2016 09:43:42 +0000 (09:43 +0000)]
fwohci: report whether PhysicalUpperBound register is implemented

Please see section 5.15 of 1394 OHCI Specification.
If the register is not implemented, then the physical response unit is
limited to the first 4GB of the physical memory.
In that case the non-cooperative debugging over firewire (using /dev/fwmem)
can not be expected to work if a target has more RAM than that.
The method is described in gdb.4 and the Developer's Handbook.

It seems that most of the consumer hardware does not implement
PhysicalUpperBound register.

MFC after: 1 week

7 years agofurther fix zfs_lock() diagnostics
Andriy Gapon [Thu, 24 Nov 2016 09:00:51 +0000 (09:00 +0000)]
further fix zfs_lock() diagnostics

It was very wrong to look at the vnode and znode internals without
having locked the vnode first.

Reported by: pho
Tested by: pho
MFC after: 1 week
X-MFC with: r308887

7 years agohyperv/hn: Fix primary channel revocation
Sepherosa Ziehau [Thu, 24 Nov 2016 07:35:16 +0000 (07:35 +0000)]
hyperv/hn: Fix primary channel revocation

Since hypervisor will not drain the TX bufring, once the channels are
revoked:
- Setup vmbus orphan handler properly.
- Make sure that suspension will not wait the TX bufring draining
  forever.
- GC the pending TX descs on detach path, before freeing the busdma
  stuffs.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8559

7 years agoEnable the SPI1 and SPI2 node for Olimex A20 SOM EVB.
Emmanuel Vadot [Thu, 24 Nov 2016 06:43:11 +0000 (06:43 +0000)]
Enable the SPI1 and SPI2 node for Olimex A20 SOM EVB.
This was missed in r309079.

7 years agohyperv/vmbus: Fix the multi-channel revoking on vmbus side.
Sepherosa Ziehau [Thu, 24 Nov 2016 06:01:29 +0000 (06:01 +0000)]
hyperv/vmbus: Fix the multi-channel revoking on vmbus side.

- Reference count the sub-channel when channel offer message is
  processed, so that immediate rescind message on the same channel
  will not race sub-channel open on driver side.
- Drop the above reference when sub-channel is closed, this closely
  mimics the hypervisor's reaction when primary channel is closed
  on the VM side.  No drivers use sub-channel after primary channel
  is closed.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8546

7 years agoshare/man/man4/Makefile: Only install Hyper-V man pages on amd64 and i386
Dexuan Cui [Thu, 24 Nov 2016 05:52:28 +0000 (05:52 +0000)]
share/man/man4/Makefile: Only install Hyper-V man pages on amd64 and i386

We shouldn't install them on the architectures not supported by Hyper-V.

And, hv_ata_pci_disengage.4.gz should be removed from all architectures:
1) It should have only applied to Hyper-V;
2) For Hyper-V platforms (amd64 and i386), the related driver was removed by
r306426 | sephe | 2016-09-29 09:41:52 +0800 (Thu, 29 Sep 2016),
because now we have a better mechanism to disble the ata driver for hard
disks when the VM runs on Hyper-V.

Reviewed by: sephe, andrew, jhb
Approved by: sephe (mentor)
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8572

7 years agohyperv/vmbus: Fix the primary channel revoking on vmbus side.
Sepherosa Ziehau [Thu, 24 Nov 2016 05:18:45 +0000 (05:18 +0000)]
hyperv/vmbus: Fix the primary channel revoking on vmbus side.

Drivers can now use vmbus_chan_{is_revoked,set_orphan,unset_orphan}() and
vmbus_xact_ctx_orphan() to fix their attach/detach DEVMETHODs for revoked
primary channels.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8545

7 years agohyperv/vmbus: Implement orphan support for transaction API
Sepherosa Ziehau [Thu, 24 Nov 2016 04:58:13 +0000 (04:58 +0000)]
hyperv/vmbus: Implement orphan support for transaction API

It will be used to fix the primary channel revocation support.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8525

7 years agoEnable the SCL and SDA i2c line for DDC.
Emmanuel Vadot [Thu, 24 Nov 2016 01:24:26 +0000 (01:24 +0000)]
Enable the SCL and SDA i2c line for DDC.
This is an undocumented register that we need to set if we do not want to
rely on u-boot or other bootloader.

7 years agoAdd new device IDs
Stephen Hurd [Thu, 24 Nov 2016 00:49:00 +0000 (00:49 +0000)]
Add new device IDs

Add device IDs for new hardware, sort the device IDs, add comment
regarding fragice NPAR/VF detection.

Approved by: davidch
MFC after: 6 days
Sponsored by: Broadcom Limited

7 years ago[rpi3] Move SOC_BRCM_BCM2837 from UP config to SMP one
Oleksandr Tymoshenko [Thu, 24 Nov 2016 00:45:52 +0000 (00:45 +0000)]
[rpi3] Move SOC_BRCM_BCM2837 from UP config to SMP one

Now that BCM283x source are buildable with SMP option it cam be moved to
GENERIC SMP config. SMP itself does not work on RPi3 yet due to lack of
PSCI monitor which is work in progress at the moment

7 years ago[rpi3] Fix SMP build for FreeBSD/arm64
Oleksandr Tymoshenko [Thu, 24 Nov 2016 00:39:17 +0000 (00:39 +0000)]
[rpi3] Fix SMP build for FreeBSD/arm64

7 years agoFix version string
Stephen Hurd [Thu, 24 Nov 2016 00:15:32 +0000 (00:15 +0000)]
Fix version string

This is no longer on github, but in FreeBSD base.

Approved by: davidch
MFC after: 6 days
Sponsored by: Broadcom Limited

7 years agortwn.4: fix hostapd(8) man page section.
Andriy Voskoboinyk [Wed, 23 Nov 2016 22:57:47 +0000 (22:57 +0000)]
rtwn.4: fix hostapd(8) man page section.

7 years agoAdd tunable to disable destructive dtrace
George V. Neville-Neil [Wed, 23 Nov 2016 22:50:20 +0000 (22:50 +0000)]
Add tunable to disable destructive dtrace

Submitted by: Joerg Pernfuss <code.jpe@gmail.com>
Reviewed by: rstone, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8624

7 years agoFix _mips_rtld_bind() to handle ELF filters.
John Baldwin [Wed, 23 Nov 2016 20:21:53 +0000 (20:21 +0000)]
Fix _mips_rtld_bind() to handle ELF filters.

MIPS does not use the common _rtld_bind() to handle runtime binding.
Instead, it uses a private _mips_rtld_bind().  Update _mips_rtld_bind()
to include the changes made to _rtld_bind() in r216695 and r218476 to
support upgrading the read-locked rtld_bind_lock to a write lock when
an object with a filter is encountered.

While here, add a 'where' variable to track the location of the fixup
in the GOT to make the code flow more closely match _rtld_bind().

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D8625

7 years agocache: ensure that the number of bucket locks does not exceed hash size
Mateusz Guzik [Wed, 23 Nov 2016 19:50:12 +0000 (19:50 +0000)]
cache: ensure that the number of bucket locks does not exceed hash size

The size can be changed by side effect of modifying kern.maxvnodes.

Since numbucketlocks was not modified, setting a sufficiently low value
would give more locks than actual buckets, which would then lead to
corruption.

Force the number of buckets to be not smaller.

Note this should not matter for real world cases.

Reported and tested by: pho

7 years agoFix various mdoc issues reported by mandoc -Tlint.
Christian Brueffer [Wed, 23 Nov 2016 19:19:11 +0000 (19:19 +0000)]
Fix various mdoc issues reported by mandoc -Tlint.

7 years agoFix various mdoc issues reported by mandoc -Tlint.
Christian Brueffer [Wed, 23 Nov 2016 18:45:15 +0000 (18:45 +0000)]
Fix various mdoc issues reported by mandoc -Tlint.

7 years agoEnable UEXT related nodes for Olimex A20 SOM
Emmanuel Vadot [Wed, 23 Nov 2016 18:31:34 +0000 (18:31 +0000)]
Enable UEXT related nodes for Olimex A20 SOM

UEXT are Universal EXTension connector from Olimex. They embed i2c, spi
and uart pins along power in one connector and are found on most,
if not all, Olimex boards.
The Olimex A20 SOM EVB have two UEXT connector so enable the nodes found on
those two connectors.

Patch has been applied upstream, in the meantime add the nodes to our custom
DTS.

7 years agoTest that the emac device is enabled in probe function
Emmanuel Vadot [Wed, 23 Nov 2016 18:07:44 +0000 (18:07 +0000)]
Test that the emac device is enabled in probe function

MFC after: 3 days

7 years agoRelease laundered vnode pages to the head of the inactive queue.
Mark Johnston [Wed, 23 Nov 2016 17:53:07 +0000 (17:53 +0000)]
Release laundered vnode pages to the head of the inactive queue.

The swap pager enqueues laundered pages near the head of the inactive queue
to avoid another trip through LRU before reclamation. This change adds
support for this behaviour to the vnode pager and makes use of it in UFS and
ext2fs. Some ioflag handling is consolidated into a common subroutine so
that this support can be easily extended to other filesystems which make use
of the buffer cache. No changes are needed for ZFS since its putpages
routine always undirties the pages before returning, and the laundry
thread requeues the pages appropriately in this case.

Reviewed by: alc, kib
Differential Revision: https://reviews.freebsd.org/D8589

7 years agoFix comment typo.
Christian Brueffer [Wed, 23 Nov 2016 16:54:27 +0000 (16:54 +0000)]
Fix comment typo.

PR: 208484
Submitted by: madpilot
MFC after: 1 week

7 years ago- Add myself (misha) as a ports committer
Mikhail Pchelin [Wed, 23 Nov 2016 14:15:51 +0000 (14:15 +0000)]
- Add myself (misha) as a ports committer
- Update mentor/mentee relationships

Approved by: jpaetzel (mentor)

7 years agoSplit MALTA board config to big and little endian versions.
Ruslan Bukin [Wed, 23 Nov 2016 11:56:22 +0000 (11:56 +0000)]
Split MALTA board config to big and little endian versions.

This fixes compilation after r308807 ("Pass MACHINE_ARCH on
command line for MIPS kernels.")

Sponsored by: DARPA, AFRL

7 years agoIncrease pcpu size to 512 so it become both denominator
Ruslan Bukin [Wed, 23 Nov 2016 11:30:40 +0000 (11:30 +0000)]
Increase pcpu size to 512 so it become both denominator
of PAGE_SIZE and aligned to CACHE_LINE_SIZE.

This fixes CTASSERT.

Sponsored by: DARPA, AFRL

7 years agoRemove debugging code.
Dag-Erling Smørgrav [Wed, 23 Nov 2016 10:52:19 +0000 (10:52 +0000)]
Remove debugging code.

7 years agoMark cpu_find_cpu0_fdt as FDT only. It's only called when this is set, and
Andrew Turner [Wed, 23 Nov 2016 09:38:10 +0000 (09:38 +0000)]
Mark cpu_find_cpu0_fdt as FDT only. It's only called when this is set, and
the kernel is using FDT.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years agoRemove the unneeded ofw_cpu_reg function signature, it's not used in this
Andrew Turner [Wed, 23 Nov 2016 09:33:47 +0000 (09:33 +0000)]
Remove the unneeded ofw_cpu_reg function signature, it's not used in this
file.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years agohyperv/vmbus: Merge free/active locks.
Sepherosa Ziehau [Wed, 23 Nov 2016 08:30:02 +0000 (08:30 +0000)]
hyperv/vmbus: Merge free/active locks.

These functions are only used by management stuffs, so there are
no needs to introduce extra complexity.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8524

7 years agoThis little BSD licensed library has been kicking around for years.
Julian Elischer [Wed, 23 Nov 2016 07:57:52 +0000 (07:57 +0000)]
This little BSD licensed library has been kicking around for years.
It allows one to trivially convert an absolute path to a relative path
and the reverse. The test programs themselves are very useful in scripts
but the real use comes shortly with the -r and -a arguments to ln.
These are sometimes known as the --relative and --absolute flags and
can force a symlink to be relative when you only have an absolue path.
Another place these are sometimes used is to add -a and -r args to 'realpath'.
Incredibly useful in Makefiles.

I was going to just add the files in with 'ln' but a library makes more sense.
The test programs may come out in their own right some day for scripting.

released under a BSD 2-clause:
 * Copyright (c) 1997 Shigio Yamaguchi. All rights reserved.
 * Copyright (c) 1999 Tama Communications Corporation. All rights reserved.

The test directry does not conform to any framework.
Not connected to build.
doc people may want to play with the manual pages.

Obtained from:  https://www.tamacom.com/pathconvert.html  Shigio Yamaguchi.
MFC after: 1 month
Relnotes:       yes
Sponsored by:   Panzura, Tama Communications Corporation

7 years agohyperv/vmbus: Set a mark on the revoked channel.
Sepherosa Ziehau [Wed, 23 Nov 2016 05:03:44 +0000 (05:03 +0000)]
hyperv/vmbus: Set a mark on the revoked channel.

This will be used to fix device detach DEVMETHOD for revoked primary
channel.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8522

7 years agoDo not attempt to disable/release clock if it had not been enabled.
Emmanuel Vadot [Wed, 23 Nov 2016 01:44:28 +0000 (01:44 +0000)]
Do not attempt to disable/release clock if it had not been enabled.
While here fix a style(9) issue.

MFC after: 1 week

7 years agoAdd missing break to switch statement
Stephen Hurd [Wed, 23 Nov 2016 00:26:31 +0000 (00:26 +0000)]
Add missing break to switch statement

Minimal impact, would allow selection of LR media when KR is connected.

Reported by: Coverity
Approved by: davidch
MFC after: 7 days
Sponsored by: Broadcom Limited

7 years agoAllocate a struct ifreq rather than using a (wrong) computed size for
Brooks Davis [Tue, 22 Nov 2016 22:45:15 +0000 (22:45 +0000)]
Allocate a struct ifreq rather than using a (wrong) computed size for
the BIOCSETIF ioctl.

The kernel always copies an entire struct ifreq and IPv4 addresses will
always fit in an ifreq.

On systems with pointers larger than 64-bits, the computed size will be
less than the size of struct ifreq, potentially resulting in the kernel
attempting to copyin memory from outside the allocation.

Reviewed by: jhb
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8445

7 years agoopen(2): Clarify non-POSIX error when opening a symlink with O_NOFOLLOW.
Jilles Tjoelker [Tue, 22 Nov 2016 22:30:55 +0000 (22:30 +0000)]
open(2): Clarify non-POSIX error when opening a symlink with O_NOFOLLOW.

We return [EMLINK] instead of [ELOOP] when trying to open a symlink with
O_NOFOLLOW, so that the original case of [ELOOP] can be distinguished. Code
like cmp -h and xz takes advantage of this.

PR: 214633
Reviewed by: kib, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D8586

7 years agoPass the correct size argument to ioctl(DIOCGSECTORSIZE)
Poul-Henning Kamp [Tue, 22 Nov 2016 22:10:58 +0000 (22:10 +0000)]
Pass the correct size argument to ioctl(DIOCGSECTORSIZE)

7 years agoAdd the missing DEVMETHOD_ENDs to the arm64 nexus ACPI and FDT drivers.
Andrew Turner [Tue, 22 Nov 2016 19:31:32 +0000 (19:31 +0000)]
Add the missing DEVMETHOD_ENDs to the arm64 nexus ACPI and FDT drivers.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years agoAdd myself (dab) as a src committer and vangyzen as my mentor.
David Bright [Tue, 22 Nov 2016 18:32:20 +0000 (18:32 +0000)]
Add myself (dab) as a src committer and vangyzen as my mentor.

Approved by: vangyzen (mentor)

7 years agoRevert r306186 ("Adjust the sopt_val pointer on bigendian systems").
Ruslan Bukin [Tue, 22 Nov 2016 18:31:43 +0000 (18:31 +0000)]
Revert r306186 ("Adjust the sopt_val pointer on bigendian systems").

This logic doesn't work with bigger sopt_valsize (e.g. when ipfw
passing 2048 bytes rule).

Reported by: adrian
Sponsored by: DARPA, AFRL

7 years agoRemove PG_CACHED-related fields from struct vmmeter, because they are no
Alan Cox [Tue, 22 Nov 2016 18:13:46 +0000 (18:13 +0000)]
Remove PG_CACHED-related fields from struct vmmeter, because they are no
longer used.  More precisely, they are always zero because the code that
decremented and incremented them no longer exists.

Bump __FreeBSD_version to mark this change.

Reviewed by: kib, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8583

7 years agoOnly build acpi_timer.c on x86, it fails on arm64 as it attempts to access
Andrew Turner [Tue, 22 Nov 2016 18:13:04 +0000 (18:13 +0000)]
Only build acpi_timer.c on x86, it fails on arm64 as it attempts to access
an invalid address. It is also unneeded on arm64 as we use the ARM Generic
Timer driver.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years ago[net80211] high oops on the high seas, or "god damnit compilers, it's 2016 and you...
Adrian Chadd [Tue, 22 Nov 2016 17:36:16 +0000 (17:36 +0000)]
[net80211] high oops on the high seas, or "god damnit compilers, it's 2016 and you're supposed to save me from this."

TODO:

* drink real coffee before committing in the morning, or there's a high
  risk of more obviously self-evident commits being turned into attempts
  at humour.

Reported by: cem, Coverity CID 1366219

7 years agoremove unnecessary vm includes from setproctitle
Ed Maste [Tue, 22 Nov 2016 16:00:18 +0000 (16:00 +0000)]
remove unnecessary vm includes from setproctitle

vm headers were needed only for the PS_STRINGS fallback, which was
removed in r297888.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

7 years agoRefactor fetch_connect() and fetch_bind() to improve readability and avoid
Dag-Erling Smørgrav [Tue, 22 Nov 2016 13:30:07 +0000 (13:30 +0000)]
Refactor fetch_connect() and fetch_bind() to improve readability and avoid
repeating the same DNS lookups.

MFC after: 3 weeks

7 years agoOn error, bread(9) zeroes buffer pointer, do not dereference it.
Konstantin Belousov [Tue, 22 Nov 2016 13:24:57 +0000 (13:24 +0000)]
On error, bread(9) zeroes buffer pointer, do not dereference it.
See r294954 for the bread(9) change and r297401 for similar cd9660 fix.

Reported and tested by: Joshua Kinard <kumba@gentoo.org>
PR: 214705
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years ago7181 race between zfs_mount and zfs_ioc_rollback
Andriy Gapon [Tue, 22 Nov 2016 11:51:55 +0000 (11:51 +0000)]
7181 race between zfs_mount and zfs_ioc_rollback

illumos/illumos-gate@90f2c094b3822f4825f21cef2c2faf7d03b55139
https://github.com/illumos/illumos-gate/commit/90f2c094b3822f4825f21cef2c2faf7d03b55139

https://www.illumos.org/issues/7181
  zfsvfs_setup() is called in both zfs_mount and zfs_resume_fs paths.
  dmu_objset_set_user(zfsvfs->z_os, zfsvfs) is called early in zfsvfs_setup()
  before the setup is actually completed,
  thus an under-constructed zfsvfs becomes visible.
  Additionally, there is nothing to serialize the two call paths. As a result two
  threads can step on each other's toes.
  assertion failed: zilog->zl_clean_taskq == NULL, file:
  ../../common/fs/zfs/zil.c, line: 1772

  > $c
  vpanic()
  0xfffffffffbdf6928()
  zil_open+0x45(ffffff1bbc5dd000fffffffff7993880)
  zfsvfs_setup+0x84(ffffffb378d77000, 0)
  zfs_resume_fs+0x132(ffffffb378d77000ffffffb37ddcf000)
  zfs_ioc_rollback+0x96(ffffffb37ddcf000ffffff01dcdc4cd0ffffff01aa091000)
  zfsdev_ioctl+0x215(10a00000000, 5a19, 80465f8, 100003, ffffff01ab318368,
  ffffff0004b59e58)
  cdev_ioctl+0x39(10a00000000, 5a19, 80465f8, 100003, ffffff01ab318368,
  ffffff0004b59e58)
  spec_ioctl+0x60(ffffff0197737700, 5a19, 80465f8, 100003,
  ffffff01ab318368ffffff0004b59e58)
  fop_ioctl+0x55(ffffff0197737700, 5a19, 80465f8, 100003,
  ffffff01ab318368ffffff0004b59e58)
  ioctl+0x9b(7, 5a19, 80465f8)
  sys_syscall32+0x1f7()

  > ffffff1bbc5dd000::print objset_t os_zil
  os_zil = 0xffffff1c053cf7c0
  > 0xffffff1c053cf7c0::print zilog_t zl_clean_taskq

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years ago6428 set canmount=off on unmounted filesystem tries to unmount children
Andriy Gapon [Tue, 22 Nov 2016 11:50:52 +0000 (11:50 +0000)]
6428 set canmount=off on unmounted filesystem tries to unmount children

illumos/illumos-gate@c079fa4d202eff15e318131c52755d214ffa2da7
https://github.com/illumos/illumos-gate/commit/c079fa4d202eff15e318131c52755d214ffa2da7

https://www.illumos.org/issues/6428
  Scenario:
  $ zfs create rpool/p
  $ zfs set canmount=noauto rpool/p
  $ zfs umount rpool/p
  $ zfs create rpool/p/c
  $ zfs get -r mounted,canmount rpool/p
  NAME             PROPERTY  VALUE     SOURCE
  rpool/p    mounted   no        -
  rpool/p    canmount  noauto    local
  rpool/p/c  mounted   yes       -
  rpool/p/c  canmount  on        default
  In another shell ensure that rpool/p/c is in use, for example:
  $ cd /rpool/p/c
  Then:
  $ zfs set canmount=off rpool/p
  cannot unmount '/rpool/p/c': Device busy
  But there is no reason to try to unmount rpool/p/c in this scenario.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years ago7199, 7200 dsl_dataset_rollback_sync may try to free already free blocks
Andriy Gapon [Tue, 22 Nov 2016 11:49:55 +0000 (11:49 +0000)]
7199, 7200 dsl_dataset_rollback_sync may try to free already free blocks

7199 dsl_dataset_rollback_sync may try to free already free blocks
7200 no blocks must be born in a txg after a snaphot is created

illumos/illumos-gate@bfaed0b91e57062c38bc16b4f89db3c8f0052a9b
https://github.com/illumos/illumos-gate/commit/bfaed0b91e57062c38bc16b4f89db3c8f0052a9b

https://www.illumos.org/issues/7199
  dsl_dataset_rollback_sync may try to free already freed blocks when it calls
  dsl_destroy_head_sync_impl to destroy a temporary clone.
  That happens if a snapshot to which we are rolling back and from which the
  clone is created has some ZIL records.

https://www.illumos.org/issues/7200
  No new blocks must be born in a dataset in the same TXG after a snapshot of the
  dataset is taken.
  Those blocks would have the same blk_birth as the dataset's ds_prev_snap_txg
  and as such they would be presumed to belong o the snapshot while in fact they
  do not.
  All the datasets must be clean before sync tasks are run, so the described
  scenario may happen only if one of the sync tasks dirties the dataset and
  another sync task takes its snapshot.
  Then, there will be another sync pass because of the dirty data and the new
  blocks will be born in the same TXG when the data is written out.
  It seems that almost all of the existing sync tasks modify only MOS and do not
  dirty any objsets.
  The only exception that I've been able to identify so far is the rollback which
  can modify an objset when it zeroes out the objset's ZIL.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years ago7180 potential race between zfs_suspend_fs+zfs_resume_fs and zfs_ioc_rename
Andriy Gapon [Tue, 22 Nov 2016 11:47:27 +0000 (11:47 +0000)]
7180 potential race between zfs_suspend_fs+zfs_resume_fs and zfs_ioc_rename

illumos/illumos-gate@690041b9caf801816f2d0bac90bc7cecefb73523
https://github.com/illumos/illumos-gate/commit/690041b9caf801816f2d0bac90bc7cecefb73523

https://www.illumos.org/issues/7180
  If a filesystem is not unmounted while the rename is being performed, then, for
  example, a concurrect zfs rollback may call zfs_suspend_fs followed by
  zfs_resume_fs on the same filesystem.
  The latter takes the filesystem's name as an argument. If the filesystem name
  changes as a result of the rename, then dmu_objset_hold(osname, zfsvfs, &os)
  call in zfs_resume_fs would fail resulting in a kernel panic.
  So far I have been able to reproduce this problem on FreeBSD where zfs rename
  has -u option that skips the unmounting before doing the renaming.
  But I think that in theory the same problem can occur on illumos as well,
  because the unmounting is done in userland before invoking the rename ioctl and
  there could be a race with, e.g., zfs mount.
  panic: solaris assert: dmu_objset_hold(osname, zfsvfs, &zfsvfs->z_os) == 0 (0x2
  == 0x0), file: /usr/devel/svn/head/sys/cddl/contrib/opensolaris/uts/common/fs/
  zfs/zfs_vfsops.c, line: 2210
  KDB: stack backtrace:
  db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004df30710
  vpanic() at vpanic+0x182/frame 0xfffffe004df30790
  panic() at panic+0x43/frame 0xfffffe004df307f0
  assfail3() at assfail3+0x2c/frame 0xfffffe004df30810
  zfs_resume_fs() at zfs_resume_fs+0xb9/frame 0xfffffe004df30860
  zfs_ioc_rollback() at zfs_ioc_rollback+0x61/frame 0xfffffe004df308a0
  zfsdev_ioctl() at zfsdev_ioctl+0x65c/frame 0xfffffe004df30940
  devfs_ioctl_f() at devfs_ioctl_f+0x156/frame 0xfffffe004df309a0
  kern_ioctl() at kern_ioctl+0x246/frame 0xfffffe004df30a00
  sys_ioctl() at sys_ioctl+0x171/frame 0xfffffe004df30ae0
  amd64_syscall() at amd64_syscall+0x2db/frame 0xfffffe004df30bf0
  Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe004df30bf0

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years ago6412 zfs receive: -u can be ignored sometimes
Andriy Gapon [Tue, 22 Nov 2016 11:46:22 +0000 (11:46 +0000)]
6412 zfs receive: -u can be ignored sometimes

illumos/illumos-gate@9185393f2919d8b897f6142d8a9fa0429c285dc1
https://github.com/illumos/illumos-gate/commit/9185393f2919d8b897f6142d8a9fa0429c285dc1

https://www.illumos.org/issues/6412
  It seems that zfs receive -F -u would mount a received filesystem after
  receiving a full stream if a destination filesystem already existed (and, thus,
  got destroyed and re-created) and was mounted.
  How to reproduce:
  $ zfs create rpool/sandbox
  $ zfs create rpool/sandbox/from
  $ zfs create rpool/sandbox/to
  $ zfs snap rpool/sandbox/from@snap
  $ zfs send rpool/sandbox/from@snap | zfs recv -v -F -u rpool/sandbox/to
  receiving full stream of rpool/sandbox/from@snap into rpool/sandbox/to@snap
  received 41.7KB stream in 1 seconds (41.7KB/sec)
  $ zfs get mounted rpool/sandbox/to
  NAME                  PROPERTY  VALUE    SOURCE
  rpool/tmp/sandbox/to  mounted   yes      -
  This behavior can be problematic if the mountpoint property changes either
  because it had a non-inherited value or the stream contains properties because
  it has been generated with either -R or -p.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years agorevert r304520, set canmount=on is not supposed to mount the filesystem
Andriy Gapon [Tue, 22 Nov 2016 11:44:30 +0000 (11:44 +0000)]
revert r304520, set canmount=on is not supposed to mount the filesystem

Not sure where I got the idea that it should.

See https://github.com/openzfs/openzfs/pull/218

Reported by: mahrens
Pointyhat to: avg
MFC after: 5 days

7 years agoUse buffer pager for NFS.
Konstantin Belousov [Tue, 22 Nov 2016 10:58:24 +0000 (10:58 +0000)]
Use buffer pager for NFS.

The pager, due to its construction, implements clustering for the
page-ins.  In particular, buildworld load demonstrates reduction of
the READ RPCs from 39k down to 24k.  No change in real or CPU time was
observed.

Discussed with, and measured by: bde
No objections from: rmacklem
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoMinor cleanup, remove unneeded XXX comments and unused re-define.
Konstantin Belousov [Tue, 22 Nov 2016 10:24:59 +0000 (10:24 +0000)]
Minor cleanup, remove unneeded XXX comments and unused re-define.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRestore vnode pager statistic for buffer pagers.
Konstantin Belousov [Tue, 22 Nov 2016 10:06:39 +0000 (10:06 +0000)]
Restore vnode pager statistic for buffer pagers.

Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D8585

7 years agoSplit out the FDT parts of the pmu driver to make way for adding ACPI
Andrew Turner [Tue, 22 Nov 2016 09:39:31 +0000 (09:39 +0000)]
Split out the FDT parts of the pmu driver to make way for adding ACPI
support.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years agoReplay r304721 in contrib/ so the change won't get lost across import.
Xin LI [Tue, 22 Nov 2016 08:30:32 +0000 (08:30 +0000)]
Replay r304721 in contrib/ so the change won't get lost across import.

7 years agoMFV r308954:
Xin LI [Tue, 22 Nov 2016 08:27:49 +0000 (08:27 +0000)]
MFV r308954:

ntp 4.2.8p9.

Approved by: so

7 years ago[net80211] Only send out a probe request if we see an unknown IBSS node that matches...
Adrian Chadd [Tue, 22 Nov 2016 06:53:52 +0000 (06:53 +0000)]
[net80211] Only send out a probe request if we see an unknown IBSS node that matches our SSID.