]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
7 years agoMFC r305205: MFV r302657:
mav [Wed, 12 Oct 2016 05:41:10 +0000 (05:41 +0000)]
MFC r305205: MFV r302657:
4521 zfstest is trying to execute evil "zfs unmount -a"

illumos/illumos-gate@8808ac5dae118369991f158b6ab736cb2691ecde
https://github.com/illumos/illumos-gate/commit/8808ac5dae118369991f158b6ab736cb2
691ecde

https://www.illumos.org/issues/4521
  zfstest is trying to execute evil "zfs unmount -a", which fails (fortunately,
  as it would otherwise leave me with my ~ missing):
  03:44:11.86 cannot unmount '/export/home/yuri': Device busy cannot unmount '/
  export/home': Device busy
  03:44:11.86 ERROR: /usr/sbin/zfs unmount -a exited 1
  This affects, at least, zfs_mount_009_neg and zfs_mount_all_001_pos, both
  failing on that step. The pool containing the /export/home hierarchy is
  included in KEEP variable, but it doesn't seem to affect anything here.

Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Yuri Pankov <yuri.pankov@nexenta.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307120 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305203: MFV r302655: 6873 zfs_destroy_snaps_nvl leaks errlist
mav [Wed, 12 Oct 2016 05:39:29 +0000 (05:39 +0000)]
MFC r305203: MFV r302655: 6873 zfs_destroy_snaps_nvl leaks errlist

illumos/illumos-gate@4cde22c29999ffb907ca39d2ebd512812f7e5168
https://github.com/illumos/illumos-gate/commit/4cde22c29999ffb907ca39d2ebd512812
f7e5168

https://www.illumos.org/issues/6873
  lzc_destroy_snaps() returns an nvlist in errlist.
  zfs_destroy_snaps_nvl() should nvlist_free() it before returning.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Chris Williamson <chris.williamson@delphix.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307119 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305202: MFV r302654:
mav [Wed, 12 Oct 2016 05:38:44 +0000 (05:38 +0000)]
MFC r305202: MFV r302654:
6879 incorrect endianness swap for drr_spill.drr_length in libzfs_sendrecv.c

illumos/illumos-gate@20fea7a47472aceb64d3ed48cc2a3ea268bc4795
https://github.com/illumos/illumos-gate/commit/20fea7a47472aceb64d3ed48cc2a3ea26
8bc4795

https://www.illumos.org/issues/6879
  In libzfs_sendrecv, there's a typo:
  case DRR_SPILL:
              if (byteswap) {
                  drr->drr_u.drr_write.drr_length =
                      BSWAP_64(drr->drr_u.drr_spill.drr_length);
              }
  Instead of drr_write.drr_length, we should be assigning the result of the
  byteswap to drr_spill.drr_length.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Dan Kimmel <dan.kimmel@delphix.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307118 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305201: MFV r302653:
mav [Wed, 12 Oct 2016 05:37:54 +0000 (05:37 +0000)]
MFC r305201: MFV r302653:
6111 zfs send should ignore datasets created after the ending snapshot

illumos/illumos-gate@4a20c933b148de8a1c1d3538391c64284e636653
https://github.com/illumos/illumos-gate/commit/4a20c933b148de8a1c1d3538391c64284
e636653

https://www.illumos.org/issues/6111
  If you create a zfs child folder, zfs send returns an error when a recursive
  incremental send is done between two snapshots made prior to the folder
  creation.
  The problem can be reproduced with the following steps.
  root@zfs:/# zfs create pool/test
  root@zfs:/# zfs snapshot pool/test@snap1
  root@zfs:/# zfs snapshot pool/test@snap2
  root@zfs:/# zfs create pool/test/child
  root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap2 > /dev/null
  WARNING: could not send pool/test/child@snap2: does not exist
  WARNING: could not send pool/test/child@snap2: does not exist
  root@zfs:/# echo $?
  1
  root@zfs:/# zfs snapshot -r pool/test@snap3
  root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap3 > /dev/null
  root@zfs:/# echo $?
  0
  root@zfs:/# zfs send -R -I pool/test@snap2 pool/test@snap3 > /dev/null
  root@zfs:/# echo $?
  0
  Since pool/test/child was created after snap2, zfs send should not expect snap2
  to be in pool/test/child when doing a recursive send. It should examine the
  compare the creation time of the snapshot and each child folder to decide if
  the folder will be sent. The next incremental send between snap2 and snap3
  would properly create the child folder and snap3 which first appears in the
  child folder.
  The problem is identical if '-i' is used instead of '-I'.

Reviewed by: Alex Aizman alex.aizman@nexenta.com
Reviewed by: Alek Pinchuk alek.pinchuk@nexenta.com
Reviewed by: Roman Strashkin roman.strashkin@nexenta.com
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Alex Deiter <alex.deiter@nexenta.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307117 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305194: MFV r302642:
mav [Wed, 12 Oct 2016 05:36:55 +0000 (05:36 +0000)]
MFC r305194: MFV r302642:
6876 Stack corruption after importing a pool with a too-long name

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

https://www.illumos.org/issues/6876
  Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for
  trouble. We should check every dataset on import, using a 1024 byte buffer and
  checking each time to see if the dataset's new name is longer than 256 bytes.

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Paul Dagnelie <pcd@delphix.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307116 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303379
sephe [Wed, 12 Oct 2016 05:28:24 +0000 (05:28 +0000)]
MFC 303379

    hyperv/vmbus: Rename cleaned up bufring code

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7318

git-svn-id: svn://svn.freebsd.org/base/stable/10@307114 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303284,303329,303361,303362,303366,303368-303370
sephe [Wed, 12 Oct 2016 05:09:26 +0000 (05:09 +0000)]
MFC 303284,303329,303361,303362,303366,303368-303370

303284
    hyperv/vmbus: Move bufring info definition to vmbus_brvar.h

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7282

303329
    hyperv/vmbus: Nuke unnecessary accessor functions.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7303

303361
    hyperv/vmbus: Initialize RX/TX bufring mutex at channel creation time

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7312

303362
    hyperv/vmbus: Use different struct for RX/TX bufring.

    So that they can use suitable MP synchronization mechanism.

    While I'm here change the bufring init/read/write function names.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7313

303366
    hyperv/vmbus: Update comment for bufring

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7314

303368
    hyperv/vmbus: Cleanup TX bufring write process.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7315

303369
    hyperv/vmbus: Stringent RX bufring data length checks.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7316

303370
    hyperv/vmbus: Cleanup RX bufring read process.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7317

git-svn-id: svn://svn.freebsd.org/base/stable/10@307103 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303283
sephe [Wed, 12 Oct 2016 03:37:43 +0000 (03:37 +0000)]
MFC 303283

    hyperv/vmbus: Rename hv_vmbus_priv.h to vmbus_brvar.h

    It only contains bufring related bits for a while.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7281

git-svn-id: svn://svn.freebsd.org/base/stable/10@307099 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303178,303180,303182
sephe [Wed, 12 Oct 2016 03:32:47 +0000 (03:32 +0000)]
MFC 303178,303180,303182

303178
    hyperv/vmbus: Cosmetic bufring cleanup.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7267

303180
    hyperv/vmbus: Cleanup and augment bufring sysctl tree creation

    Binary state node is added, so that userland programs do not have
    to parse human readable state string.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7268

303182
    hyperv/vmbus: Move vmbus bufring definition to vmbus_reg.h

    And add more comment about its fields.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7269

git-svn-id: svn://svn.freebsd.org/base/stable/10@307097 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303066-303072,303127-303129,303131
sephe [Wed, 12 Oct 2016 03:18:17 +0000 (03:18 +0000)]
MFC 303066-303072,303127-303129,303131

303066
    hyperv/vmbus: Get rid of unnecessary definition.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7240

303067
    hyperv/vmbus: Move IC register definition to Hyper-V utilities

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7241

303068
    hyperv/vmbus: Channel struct field rename

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7242

303069
    hyperv/vmbus: Pass channel as the first argument for channel callback

    The prepares to kill device private fields in channel struct, which
    are not flexible and extensible.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7243

303070
    hyperv/vmbus: Deprecate the device private data in channel struct

    They are neither flexible nor extensible.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7244

303071
    hyperv/vmbus: Hide channel struct definition.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7245

303072
    hyperv/vmbus: Save MNF trigger location instead of MNF trigger index.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7246

303127
    hyperv/vmbus: Save event flag location and evet flag mask.

    This avoids unnecessary access to the vmbus_softc struct on sending path.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7257

303128
    hyperv/vmbus: Reorder channel fields.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7258

303129
    hyperv/vmbus: Shuffle function declaration and macro definition.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7259

303131
    hyperv: hv_vmbus_channel -> vmbus_channel

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7260

git-svn-id: svn://svn.freebsd.org/base/stable/10@307096 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303023
sephe [Wed, 12 Oct 2016 02:55:24 +0000 (02:55 +0000)]
MFC 303023

    hyperv/vmbus: Rename laundered vmbus channel code

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7232

git-svn-id: svn://svn.freebsd.org/base/stable/10@307086 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302888-302892,302986,303020-303022
sephe [Wed, 12 Oct 2016 02:45:30 +0000 (02:45 +0000)]
MFC 302888-302892,302986,303020-303022

302888
    hyperv/hn: Busdma-fy rxbuf and chimney sending buffer

    Nuke unused channel GPADL API.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7211

302889
    hyperv/vmbus: Back out r302888 temporarily

    Committed by accident w/ duplicated commit log

    Sponsored by:   Microsoft OSTC

302890
    hyperv/vmbus: Function rename

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7212

302891
    hyperv/vmbus: Cosmetic vmbus channel close cleanup

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7213

302892
    hyperv/vmbus: Cleanup channel sysctl tree creation

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7214

302986
    hyperv/vmbus: Cosmetic vmbus channel open cleanup

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7217

303020
    hyperv/vmbus: Cleanup cpu based channel selection.

    And create cpu to channel map at device attach time for storvsc(4).

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7229

303021
    hyperv/vmbus: Function rename

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7230

303022
    hyperv/vmbus: Temp/internal variable/function rename

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7231

git-svn-id: svn://svn.freebsd.org/base/stable/10@307084 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302887
sephe [Wed, 12 Oct 2016 02:15:06 +0000 (02:15 +0000)]
MFC 302887

    hyperv/hn: Busdma-fy rxbuf and chimney sending buffer

    Nuke unused channel GPADL API.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7211

git-svn-id: svn://svn.freebsd.org/base/stable/10@307081 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302885,302886
sephe [Wed, 12 Oct 2016 02:09:53 +0000 (02:09 +0000)]
MFC 302885,302886

302885
    hyperv/vmbus: Cleanup channel receiving.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7202

302886
    hyperv/vmbus: Cleanup channel packet receiving.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7204

git-svn-id: svn://svn.freebsd.org/base/stable/10@307080 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302882-302884
sephe [Wed, 12 Oct 2016 02:03:05 +0000 (02:03 +0000)]
MFC 302882-302884

302882
    hyperv/vmbus: Function rename

    And reorder the error prone parameters list.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7191

302883
    hyperv/vmbus: Field rename

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7193

302884
    hyperv/vmbus: Factor out macros to do channel packet length conversion.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7194

git-svn-id: svn://svn.freebsd.org/base/stable/10@307079 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agowait: Do not copyout uninitialized status/rusage/wrusage.
jilles [Tue, 11 Oct 2016 18:51:03 +0000 (18:51 +0000)]
wait: Do not copyout uninitialized status/rusage/wrusage.

If wait4() or wait6() return 0 because of WNOHANG, the status, rusage and
wrusage information should not be returned.

PR: 212048
Reported by: Casey Lucas

git-svn-id: svn://svn.freebsd.org/base/stable/10@307065 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305207: MFV r302659: 6931 lib/libzfs: cleanup gcc warnings
mav [Tue, 11 Oct 2016 16:53:50 +0000 (16:53 +0000)]
MFC r305207: MFV r302659: 6931 lib/libzfs: cleanup gcc warnings

illumos/illumos-gate@88f61dee20b358671b1b643e9d1dbf220a1d69be
https://github.com/illumos/illumos-gate/commit/88f61dee20b358671b1b643e9d1dbf220a1d69be

https://www.illumos.org/issues/6931
  need cleanup:
  CERRWARN += -_gcc=-Wno-switch
  CERRWARN += -_gcc=-Wno-parentheses
  CERRWARN += -_gcc=-Wno-unused-function

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Igor Kozhukhov <ikozhukhov@gmail.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307058 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305200: MFV r302651:
mav [Tue, 11 Oct 2016 16:52:57 +0000 (16:52 +0000)]
MFC r305200: MFV r302651:
7054 dmu_tx_hold_t should use refcount_t to track space

illumos/illumos-gate@0c779ad424a92a84d1e07d47cab7f8009189202b
https://github.com/illumos/illumos-gate/commit/0c779ad424a92a84d1e07d47cab7f8009
189202b

https://www.illumos.org/issues/7054
  upstream:
  ee0003de7d3e598499be7ac3fe6b61efcc47cb7f
  DLPX-40399 dmu_tx_hold_t should use refcount_t to track space

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307057 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305199: MFV r302648: 7019 zfsdev_ioctl skips secpolicy when FKIOCTL is set
mav [Tue, 11 Oct 2016 16:50:45 +0000 (16:50 +0000)]
MFC r305199: MFV r302648: 7019 zfsdev_ioctl skips secpolicy when FKIOCTL is set

Note that the bulk of the upstream change is not applicable to FreeBSD
and the affected files are not even in the vendor area.

illumos/illumos-gate@45b1747515a17db45e8971501ee84a26bdff37b2
https://github.com/illumos/illumos-gate/commit/45b1747515a17db45e8971501ee84a26bdff37b2

https://www.illumos.org/issues/7019
  Currently zfsdev_ioctl, when confronted by a request with the FKIOCTL flag set,
  skips all processing of secpolicy functions. This means that ZFS is not doing
  any kind of verification of the credentials or access rights of the caller and
  assuming that (as it is an in-kernel client) all such checks have already been
  done.
  This turns out to be quite a dangerous assumption, especially with respect to
  sdev. In general I don't think it's particularly reasonable to offload this
  enforcement of access rights onto other kernel subsystems when ZFS has some
  particular local semantics in this area (delegated datasets etc) and does not
  provide any kind of API to allow other subsystems to avoid code duplication
  when doing it. ZFS should apply its normal access policy to requests from
  within the kernel, and callers should take care to give it the correct
  credentials and call it from the correct context in order to get the results
  they need.
  You can observe the currently unfortunate consequences of this bug in any non-
  global zone that has access to /dev/zvol or any subset of it via sdev profiles.
  In particular, a zone used to contain a KVM or similar which has a single zvol
  passed through to it using a <device match= block in its zone XML.
  Even though sdev makes something of an attempt to control for whether the
  caller should have access to nodes in /dev/zvol, it doesn't do this correctly,
  or really at all in the lookup call path. So, if we have a zone that's been
  given access to any part of /dev/zvol, it can simply look up the full path to
  any other zvol on the entire system, and the node will appear and be able to be
  used.

Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Alex Wilson <alex.wilson@joyent.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307056 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305198: MFV r302647:
mav [Tue, 11 Oct 2016 16:49:16 +0000 (16:49 +0000)]
MFC r305198: MFV r302647:
6922 Emit ESC_ZFS_VDEV_REMOVE_AUX after removing an aux device

illumos/illumos-gate@63364b0ee2604783e7a55f8425888867768eafa4
https://github.com/illumos/illumos-gate/commit/63364b0ee2604783e7a55f84258888677
68eafa4

https://www.illumos.org/issues/6922
  ZFS does not do a config_sync after removing an aux (spare, log, or cache)
  device. AFAICT this isn't being done because it is slow and was deemed
  unnecessary. However, it should be such a rare operation that speed doesn't
  matter, and not doing it results in two problems:
  1) It is theoretically possible to remove an aux device from one pool and
  attach it to another, then lose power. When power is restored, both pools woul
d
  think that they own the aux device.
  2) Removal of the aux device doesn't send any useful sysevents to userland.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Alan Somers <asomers@gmail.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307055 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305197: MFV r302646:
mav [Tue, 11 Oct 2016 16:48:12 +0000 (16:48 +0000)]
MFC r305197: MFV r302646:
6980 6902 causes zfs send to break due to 32-bit/64-bit struct mismatch

illumos/illumos-gate@ea4a67f462de0a39a9adea8197bcdef849de5371
https://github.com/illumos/illumos-gate/commit/ea4a67f462de0a39a9adea8197bcdef84
9de5371

https://www.illumos.org/issues/6980
  doing zfs send -i snap1 snap2 >testfile results in
  internal error: Invalid argument
  Abort (core dumped)

Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307054 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305195: MFV r302643:
mav [Tue, 11 Oct 2016 16:47:21 +0000 (16:47 +0000)]
MFC r305195: MFV r302643:
6902 speed up listing of snapshots if requesting name only and sorting by name

This was our change from the beginning, so just reduce the upstream diff.

git-svn-id: svn://svn.freebsd.org/base/stable/10@307053 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305193: MFV r302642:
mav [Tue, 11 Oct 2016 16:46:16 +0000 (16:46 +0000)]
MFC r305193: MFV r302642:
6876 Stack corruption after importing a pool with a too-long name

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

https://www.illumos.org/issues/6876
  Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for
  trouble. We should check every dataset on import, using a 1024 byte buffer and
  checking each time to see if the dataset's new name is longer than 256 bytes.

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Paul Dagnelie <pcd@delphix.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@307052 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agobuild: Add vmbus_if.m
sephe [Tue, 11 Oct 2016 09:19:30 +0000 (09:19 +0000)]
build: Add vmbus_if.m

This is a direct commit, which reflects the difference between
current and 10-stable.

Sponsored by: Microsoft

git-svn-id: svn://svn.freebsd.org/base/stable/10@307035 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302875,302876,302878-302881
sephe [Tue, 11 Oct 2016 09:11:23 +0000 (09:11 +0000)]
MFC 302875,302876,302878-302881

302875
    hyperv/vmbus: Redefine channel packet.

    The channel packet header will be shared w/ PRP (physical region page)
    list channel packet and SG (scatter gather) list channel packet.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7155

302876
    hyperv/vmbus: Rework sglist sending.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7156

302878
    hyeprv/vmbus: Rework prplist sending.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7175

302879
    hyperv/vmbus: Move channel packet flags definition to vmbus.h

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7176

302880
    hyperv/vmbus: Move channel packet types definition to vmbus.h

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7177

302881
    hyperv/vmbus: Cleanup channel sending

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7178

git-svn-id: svn://svn.freebsd.org/base/stable/10@307034 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302873,302874
sephe [Tue, 11 Oct 2016 09:02:55 +0000 (09:02 +0000)]
MFC 302873,302874

302873
    hyperv/vmbus: Set vcpuid to 0, if MSR_HV_VP_INDEX does not exist.

    Mainly for compatibility.  While I'm here, rename cpuid related
    fields in hv_vmbus_channel.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7141

302874
    hyperv/vmbus: Field rename

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7146

git-svn-id: svn://svn.freebsd.org/base/stable/10@307033 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302871,302872
sephe [Tue, 11 Oct 2016 08:52:27 +0000 (08:52 +0000)]
MFC 302871,302872

302871
    hyperv/vmbus: Add vmbus_chan_gpadl_connect, which takes GPA physaddr

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7139

302872
    hyperv/vmbus: Busdma-fy channel bufring.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7140

git-svn-id: svn://svn.freebsd.org/base/stable/10@307032 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302867-302870
sephe [Tue, 11 Oct 2016 08:48:36 +0000 (08:48 +0000)]
MFC 302867-302870

302867
    hyperv/vmbus: Remove unused struct

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7127

302868
    hyperv/vmbus: Function rename

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7129

302869
    hyperv/vmbus: Remove unused function definition/declaration.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7131

302870
    hyperv/vmbus: Use iovec for bufring scatter/gather list.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7134

git-svn-id: svn://svn.freebsd.org/base/stable/10@307031 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302864
sephe [Tue, 11 Oct 2016 08:41:27 +0000 (08:41 +0000)]
MFC 302864

    hyperv/vmbus: Merge hv_channel_mgmt.c into hv_channel.c

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7126

git-svn-id: svn://svn.freebsd.org/base/stable/10@307030 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302819,302823
sephe [Tue, 11 Oct 2016 08:29:04 +0000 (08:29 +0000)]
MFC 302819,302823

302819
    hyperv/vmbus: Sub-channel related fields renaming

    And reorganize comment.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7113

302823
    hyperv/vmbus: Move bus related message processing into vmbus.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7125

git-svn-id: svn://svn.freebsd.org/base/stable/10@307029 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302816-302818
sephe [Tue, 11 Oct 2016 08:22:17 +0000 (08:22 +0000)]
MFC 302816-302818

302816
    hyperv/vmbus: Release vmbus channel lock before detach devices

    Device detach method may sleep.

    While I'm here, rename the function, fix indentation and function
    comment.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7110

302817
    hyperv/vmbus: Field renaming to reflect reality

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7111

302818
    hyperv/vmbus: Fix the racy channel close.

    It is not safe to iterate the sub-channel list w/o lock on the
    close path, while it's even more difficult to hold the lock
    and iterate the sub-channel list.  We leverage the
    vmbua_{get,rel}_subchan() functions to solve this dilemma.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7112

git-svn-id: svn://svn.freebsd.org/base/stable/10@307028 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302808-302815
sephe [Tue, 11 Oct 2016 08:14:11 +0000 (08:14 +0000)]
MFC 302808-302815

302808
    hyperv/vmbus: Alloc/Free monitor param in vmbus channel alloc/free.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7101

302809
    hyperv/vmbus: Move device register and channel free to the caller.

    This paves the way for more cleanup/disentangle.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7102

302810
    hyperv/vmbus: Move new channel scan notification to device register

    And nuke now unnecessary function indirection.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7103

302811
    hyperv/vmbus: Cleanup vmbus_chan_msgproc_choffer

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7104

302812
    hyperv/vmbus: Nuke the channel open state.

    Channel is either opened or not-opened.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7105

302813
    hyperv/vmbus: Cleanup vmbus_chan_add()

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7106

302814
    hyperv/vmbus: Use sub-channel index to detect primary channel

    In case that VMBUS_CHAN_ISPRIMARY is needed in the early place of
    channel setup.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7108

302815
    hyperv/vmbus: Only add primary channels to vmbus channel list

    - Make the vmbus_chan_add more straightforward.
    - Partially fix the hv_vmbus_release_unattached_channels().

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7109

git-svn-id: svn://svn.freebsd.org/base/stable/10@307027 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302733,302737,302801-302806
sephe [Tue, 11 Oct 2016 08:01:43 +0000 (08:01 +0000)]
MFC 302733,302737,302801-302806

302733
    hyperv/vmbus: Remove unused code

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7089

302737
    hyperv/vmbus: Cleanup channel rescind

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7090

302801
    hyperv/vmbus: Remove unused bits

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7091

302802
    hyperv: hv_guid -> struct hyperv_guid.

    This paves way for the further cleanup/disentangle.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7092

302803
    hyperv/vmbus: Move channel offer message definition to vmbus_reg.h

    - Avoid bit fields.
    - Avoid unnecessary indirection.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7093

302804
    hyperv/vmbus: Switch to vmbus channel message macros

    Prepare for more cleanup.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7094

302805
    hyperv/vmbus: Remove unused bits

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7095

302806
    hyperv/vmbus: Get rid of rel{_id,id}, use channel id consistently.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7100

git-svn-id: svn://svn.freebsd.org/base/stable/10@307026 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302723,302726,302731
sephe [Tue, 11 Oct 2016 07:50:09 +0000 (07:50 +0000)]
MFC 302723,302726,302731

302723
    hyperv: All Hypercall parameters have same alignment requirement.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7086

302726
    hyperv: Signal event input parameter is shared w/ MNF

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7087

302731
    hyperv/vmbus: Reorganize MNF event sending.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7088

git-svn-id: svn://svn.freebsd.org/base/stable/10@307025 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302710,302713
sephe [Tue, 11 Oct 2016 07:44:26 +0000 (07:44 +0000)]
MFC 302710,302713

302710
    hyperv/vmbus: Remove unnecessary callback check.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7046

302713
    hyperv/vmbus: Install different task function for batch/non-batch channels

    This avoids bunch of unnecessary checks on hot path and simplifies the
    channel processing.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7085

git-svn-id: svn://svn.freebsd.org/base/stable/10@307024 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302707-302709
sephe [Tue, 11 Oct 2016 07:37:45 +0000 (07:37 +0000)]
MFC 302707-302709

302707
    hyperv/vmbus: Nuke unused field from hv_vmbus_channel.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7036

302708
    hyperv/bufring: Remove unused fields

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7037

302709
    hyperv/vmbus: Pack bool field into flags field

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7038

git-svn-id: svn://svn.freebsd.org/base/stable/10@307023 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302698-302704,302706
sephe [Tue, 11 Oct 2016 07:30:59 +0000 (07:30 +0000)]
MFC 302698-302704,302706

302698
    hyperv/vmbus: Add vmbus method for GUID base device probing.

    Reduce the exposure of hv_device.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7024

302699
    hyperv/vmbus: All ivars are read-only; nuke unnecessary write_ivar

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7025

302700
    hyperv/vmbus: Add channel ivar accessor.

    This makes life easier during the transition period to nuke the hv_device.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7026

302701
    hyperv/stor: Avoid the hv_device and nuke the broken get_stor_device

    This paves way to nuke the hv_device, which is actually an unncessary
    indirection.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7027

302702
    hyperv/util: Avoid the hv_device

    This paves way to nuke the hv_device, which is actually an unncessary
    indirection.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7028

302703
    hyperv/vmbus: Deprecate the usage of hv_device.

    This paves way to nuke the hv_device, which is actually an unncessary
    indirection.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7032

302704
    hyperv/hn: Avoid the hv_device

    This paves way to nuke the hv_device, which is actually an unncessary
    indirection.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7033

302706
    hyperv: Get rid of hv_device, which is unnecessary indirection.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7034

git-svn-id: svn://svn.freebsd.org/base/stable/10@307022 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302693-302697
sephe [Tue, 11 Oct 2016 07:10:12 +0000 (07:10 +0000)]
MFC 302693-302697

302693
    hyperv/vmbus: Make channel id a field of hv_vmbus_channel.

    This prepares to remove the unnecessary offer message embedding in
    hv_vmbus_channel.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7014

302694
    hyperv/vmbus: Make subchan index a field of hv_vmbus_channel.

    This prepares to remove the unnecessary offer message embedding in
    hv_vmbus_channel.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7015

302695
    hyperv/vmbus: Add flags field into hv_vmbus_channel for MNF indication

    This prepares to remove the unnecessary offer message embedding in
    hv_vmbus_channel.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7019

302696
    hyperv/vmbus: Add type/instance guid fields into hv_vmbus_channel

    This prepares to remove the unnecessary offer message embedding in
    hv_vmbus_channel.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7020

302697
    hyperv/vmbus: Remove the embedded offer message from hv_vmbus_channel

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7021

git-svn-id: svn://svn.freebsd.org/base/stable/10@307021 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302636-302638,302692
sephe [Tue, 11 Oct 2016 07:00:43 +0000 (07:00 +0000)]
MFC 302636-302638,302692

302636
    hyperv/vmbus: Move channel map to vmbus_softc

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6982

302637
    hyperv/vmbus: Remove needed bits

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7002

302638
    hyperv/vmbus: Destroy channel list lock upon attach failure and detach.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7003

302692
    hyperv/vmbus: Merge hv_connection.c into hv_channel.c

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7004

git-svn-id: svn://svn.freebsd.org/base/stable/10@307020 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302632-302634
sephe [Tue, 11 Oct 2016 06:46:24 +0000 (06:46 +0000)]
MFC 302632-302634

302632
    hyperv/vmbus: More verbose for GPADL_connect/chan_{rescind,offer}

    Reviewed by:    Dexuan Cui <decui microsoft com>, Hongjiang Zhang <honzhan microsoft com>
    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6976

302633
    hyperv/vmbus: Free sysctl properly upon channel close.

    Prepare for sub-channel re-open.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6977

302634
    hyperv/vmbus: Fix sub-channel re-open support.

    For multi-channel devices, once the primary channel is closed,
    a set of 'rescind' messages for sub-channels will be delivered
    by Hypervisor.  Sub-channel MUST be freed according to these
    'rescind' messages; directly re-openning sub-channels in the
    same fashion as the primary channel's re-opening does NOT work
    at all.

    After the primary channel is re-opened, requested # of sub-
    channels will be delivered though 'channel offer' messages, and
    this set of newly offered channels can be opened along side with
    the primary channel.

    This unbreaks the MTU setting for hn(4), which requires re-
    openning all existsing channels upon MTU change.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6978

git-svn-id: svn://svn.freebsd.org/base/stable/10@307019 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302617-302621,302623,302629-302631
sephe [Tue, 11 Oct 2016 06:35:29 +0000 (06:35 +0000)]
MFC 302617-302621,302623,302629-302631

302617
    hyperv/vmbus: Flatten channel message response processing.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6914

302618
    hyperv/vmbus: Avoid tx_evtflags setting code duplication.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6915

302619
    hyperv/vmbus: Busdma-fy Hypercall signal event input parameter.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6916

302620
    hyperv: Nuke unused stuffs

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6917

302621
    hyperv/vmbus: Don't be oversmart in default cpu selection.

    Pin the channel to cpu0 by default.  Drivers having special channel-cpu
    mapping requirement should call vmbus_channel_cpu_{set,rr}() themselves.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6918

302623
    hyperv/vmbus: Minor renaming

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6919

302629
    hyperv/vmbus: Rework vmbus version accessing.

    Instead of global variable, vmbus version is accessed through
    a vmbus DEVMETHOD now.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6953

302630
    hyperv/vmbus: Move GPADL index into vmbus_softc

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6954

302631
    hyperv/vmbus: Move channel list to vmbus_softc

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6956

git-svn-id: svn://svn.freebsd.org/base/stable/10@307018 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302607-302612
sephe [Tue, 11 Oct 2016 06:19:06 +0000 (06:19 +0000)]
MFC 302607-302612

302607
    hyperv/vmbus: Use post message Hypercall APIs for channel open

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6876

302608
    hyperv/vmbus: Remove unnecessary check and unapplied comment

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6877

302609
    hyperv/vmbus: Use post message Hypercall APIs for GPADL connect.

    This also fixes memory leakge if sub-connect messages are needed.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6878

302610
    hyperv/vmbus: Use post message Hypercall APIs for channel close

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6906

302611
    hyperv/vmbus: Use post message Hypercall APIs for GPA disconnect

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6912

302612
    hyperv: Nuke unused stuffs

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6913

git-svn-id: svn://svn.freebsd.org/base/stable/10@307017 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302543,302545,302547,302549,302554,302556,302557,302559,302606
sephe [Tue, 11 Oct 2016 06:04:40 +0000 (06:04 +0000)]
MFC 302543,302545,302547,302549,302554,302556,302557,302559,302606

302543
    hyperv/vmbus: Use post message Hypercall APIs for channel request

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6831

302545
    hyperv/vmbus: Function renaming.

    And pass vmbus_softc to vmbus_doattach()

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6842

302547
    hyperv/vmbus: Explicitly assign channel message process array.

    While I'm here, remove the useless message type from message process
    array, which is not used and serves no purposes at all.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6858

302549
    hyperv/vmbus: Add sysctl to expose vmbus version.

    Requested by:   Hongxiong Xian <v-hoxian microsoft com>
    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6860

302554
    hyperv/vmbus: Use post message Hypercall APIs for unload

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6861

302556
    hyperv/vmbus: Create channel synchronously.

    The device probe/attach has been move to a different thread, so the
    reasons to create the channel asynchronously are no longer valid.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6862

302557
    hyperv/vmbus: Save vmbus softc to channels.

    So that we don't need to access the global vmbus softc.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6863

302559
    hyperv/vmbus: Embed channel detach task in channel itself.

    GC work queue stuffs.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6864

302606
    hyperv/vmbus: Reorganize vmbus scan process.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6875

git-svn-id: svn://svn.freebsd.org/base/stable/10@307016 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302544
sephe [Tue, 11 Oct 2016 05:47:52 +0000 (05:47 +0000)]
MFC 302544

    hyperv/hn: Add tunable to allow tcp_lro_queue_mbuf()

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6841

git-svn-id: svn://svn.freebsd.org/base/stable/10@307015 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302540
sephe [Tue, 11 Oct 2016 05:44:36 +0000 (05:44 +0000)]
MFC 302540

    hyperv/vmbus: Implement a new set of APIs for post message Hypercall

    And use this new APIs for Initial Contact post message Hypercall.
    More post message Hypercalls will be converted.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6830

git-svn-id: svn://svn.freebsd.org/base/stable/10@307014 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 306480
sephe [Tue, 11 Oct 2016 02:25:59 +0000 (02:25 +0000)]
MFC 306480

    linuxkpi: Fix PCI BAR lazy allocation support.

    FreeBSD supports lazy allocation of PCI BAR, that is, when a device
    driver's attach method is invoked, even if the device's PCI BAR
    address wasn't initialized, the invocation of bus_alloc_resource_any()
    (the call chain: pci_alloc_resource() -> pci_alloc_multi_resource() ->
    pci_reserve_map() -> pci_write_bar()) would allocate a proper address
    for the PCI BAR and write this 'lazy allocated' address into the PCI
    BAR.

    This model works fine for native FreeBSD device drivers, but _not_ for
    device drivers shared with Linux (e.g. dev/mlx5/mlx5_core/mlx5_main.c
    and ofed/drivers/net/mlx4/main.c.  Both of them use
    pci_request_regions(), which doesn't work properly with the PCI BAR
    lazy allocation, because pci_resource_type() -> _pci_get_rle() always
    returns NULL, so pci_request_regions() doesn't have the opportunity to
    invoke bus_alloc_resource_any().  We now use pci_find_bar() in
    pci_resource_type(), which is able to locate all available PCI BARs
    even if some of them will be lazy allocated.

    Submitted by:   Dexuan Cui <decui microsoft com>
    Reviewed by:    hps
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8071

git-svn-id: svn://svn.freebsd.org/base/stable/10@307011 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306610:
sevan [Mon, 10 Oct 2016 16:38:07 +0000 (16:38 +0000)]
MFC r306610:
Note mount_fusefs appeared in FreeBSD 10.
Move note regarding implementation to caveats.
Address issued raised by Igor.

PR: 212513
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306996 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306607:
sevan [Mon, 10 Oct 2016 16:36:14 +0000 (16:36 +0000)]
MFC r306607:
mksnap_ffs appeared in FreeBSD 5.1.

PR:             212510
Approved by:    bcr (mentor)
Differential Revision:  https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306995 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306606:
sevan [Mon, 10 Oct 2016 16:32:55 +0000 (16:32 +0000)]
MFC r306606:
mknod appeared in V4 UNIX
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man8/mknod.8

PR: 212509
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306992 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306605:
sevan [Mon, 10 Oct 2016 16:30:01 +0000 (16:30 +0000)]
MFC r306605:
init was there in UNIX from V1
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V1/init.s

PR:             212503
Approved by:    bcr (mentor)
Differential Revision:  https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306991 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306604:
sevan [Mon, 10 Oct 2016 16:26:38 +0000 (16:26 +0000)]
MFC r306604:
gbde first appeared in FreeBSD 5.0

PR: 212478
Approved by: brc (mentor)
Differential Revision: https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306988 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306603:
sevan [Mon, 10 Oct 2016 16:25:05 +0000 (16:25 +0000)]
MFC r306603:
Document which version of BSD first showed up in and add the version info
for NetBSD & FreeBSD.

PR:             212477
Approved by:    bcr (mentor)
Differential Revision:  https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306987 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306602:
sevan [Mon, 10 Oct 2016 16:21:34 +0000 (16:21 +0000)]
MFC r306602:
Mention the version of NetBSD the utility originated from.

PR: 212476
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306984 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306601:
sevan [Mon, 10 Oct 2016 16:17:14 +0000 (16:17 +0000)]
MFC r306601:
dumpon(8) appears to be present in FreeBSD 2.0.5,
despite initial import of man page listed FreeBSD 2.1.

PR:             212445
Approved by:    bcr (mentor)
Differential Revision:  https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306983 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306600:
sevan [Mon, 10 Oct 2016 16:14:00 +0000 (16:14 +0000)]
MFC r306600:
dump(8) first appeared in V4 UNIX
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man8

PR: 212444
Approved by: bcr (mentor)
Obtained from: TUHS
Differential Revision: https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306980 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306598
sevan [Mon, 10 Oct 2016 16:11:51 +0000 (16:11 +0000)]
MFC r306598
ccdconfig first appeared in NetBSD 1.1
From NetBSD man page, confirmed with repo tags in CVS [1]
(there was also no 1.0a release according to [2])

[1] http://cvsweb.netbsd.org/bsdweb.cgi/src/sbin/ccdconfig/ccdconfig.c
[2] http://netbsd.org/releases/formal.html#history

PR:             212437
Approved by:    bcr (mentor)
Obtained from:  NetBSD
Differential Revision:  https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306979 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306582:
sevan [Mon, 10 Oct 2016 16:07:23 +0000 (16:07 +0000)]
MFC r306582:
"POSIX doesn't specify -h." - r1.27 from NetBSD
http://man.openbsd.org/?query=chmod&apropos=0&sec=0&arch=default&manpath=POSIX-2013

PR: 212337
Approved by: bcr (mentor)
Obtained from: NetBSD
Differential Revision: https://reviews.freebsd.org/D8118

git-svn-id: svn://svn.freebsd.org/base/stable/10@306976 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306581:
sevan [Mon, 10 Oct 2016 15:54:32 +0000 (15:54 +0000)]
MFC r306581:
Use .At macro instead of specifying AT&T UNIX literaly.

PR:             212034
Approved by:    bcr (mentor)
Differential Revision:  https://reviews.freebsd.org/D8114

git-svn-id: svn://svn.freebsd.org/base/stable/10@306974 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306714:
sevan [Mon, 10 Oct 2016 15:48:40 +0000 (15:48 +0000)]
MFC r306714:
Document where chio(1) originated from & which version of FreeBSD first
included it.

PR:           211776
Approved by:  bcr (mentor)
Differential Revision:        https://reviews.freebsd.org/D8104

git-svn-id: svn://svn.freebsd.org/base/stable/10@306971 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306584:
sevan [Mon, 10 Oct 2016 15:44:42 +0000 (15:44 +0000)]
MFC r306584:
Move the description of CHANGER variable to ENVIRONMENT section rather than
in the DESCRIPTION section.
From OpenBSD src/bin/chio/chio.1 r1.23

PR:           212158
Approved by:  bjk
Obtained from:        OpenBSD
Differential Revision:        https://reviews.freebsd.org/D8117

git-svn-id: svn://svn.freebsd.org/base/stable/10@306968 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC: r306318
tijl [Mon, 10 Oct 2016 11:53:54 +0000 (11:53 +0000)]
MFC: r306318

Allocate a zeroed LDT.

Failing to do this might result in the LDT appearing to run out of free
descriptors because of random junk in the descriptor's 'sd_type' field.

http://lists.freebsd.org/pipermail/freebsd-amd64/2014-May/016088.html

PR:             212639
Submitted by:   wheelcomplex@gmail.com

git-svn-id: svn://svn.freebsd.org/base/stable/10@306961 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306478:
hselasky [Mon, 10 Oct 2016 11:47:29 +0000 (11:47 +0000)]
MFC r306478:
Add new USB ID.

While at it remove some whitespaces.

Submitted by: Jose Luis Duran <jlduran@gmail.com>
PR: 213110

git-svn-id: svn://svn.freebsd.org/base/stable/10@306957 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306454:
hselasky [Mon, 10 Oct 2016 11:43:55 +0000 (11:43 +0000)]
MFC r306454:
Set hardware stats flag to avoid double counting the number of incoming bytes.

Found by: Ben RUBSON <ben.rubson@gmail.com>
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@306955 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306453:
hselasky [Mon, 10 Oct 2016 11:40:52 +0000 (11:40 +0000)]
MFC r306453:
Set hardware stats flag to avoid double counting the number of incoming bytes.

Found by: Ben RUBSON <ben.rubson@gmail.com>
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@306953 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306451:
hselasky [Mon, 10 Oct 2016 11:34:51 +0000 (11:34 +0000)]
MFC r306451:
The IORESOURCE_XXX defines should resemble a bitmask while SYS_RES_XXX
are not bitmasks. Fix return value of pci_resource_flags() to reflect
this change.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@306950 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306441 and r306634:
hselasky [Mon, 10 Oct 2016 11:25:11 +0000 (11:25 +0000)]
MFC r306441 and r306634:
While draining a timeout task prevent the taskqueue_enqueue_timeout()
function from restarting the timer.

Commonly taskqueue_enqueue_timeout() is called from within the task
function itself without any checks for teardown. Then it can happen
the timer stays active after the return of taskqueue_drain_timeout(),
because the timeout and task is drained separately.

This patch factors out the teardown flag into the timeout task itself,
allowing existing code to stay as-is instead of applying a teardown
flag to each and every of the timeout task consumers.

Add assert to taskqueue_drain_timeout() which prevents parallel
execution on the same timeout task.

Update manual page documenting the return value of
taskqueue_enqueue_timeout().

Differential Revision: https://reviews.freebsd.org/D8012
Reviewed by: kib, trasz

git-svn-id: svn://svn.freebsd.org/base/stable/10@306947 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoWhile the thread is sleeping in taskqueue_drain_all() it is
julian [Mon, 10 Oct 2016 04:57:33 +0000 (04:57 +0000)]
While the thread is sleeping in taskqueue_drain_all() it is
posible that the queue entry it is looking at is removed
from the queue, but we make no effort to account
for this. when we wake up we need to check it's still there.

PR: 209580
Sponsored by: Panzura inc
Differential Revision: D8160

git-svn-id: svn://svn.freebsd.org/base/stable/10@306935 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306443:
jch [Sun, 9 Oct 2016 21:35:12 +0000 (21:35 +0000)]
MFC r306443:

Fix an issue with accept_filter introduced with r261242:

As a side effect of r261242 when using accept_filter the
first call to soisconnected() is done earlier in tcp_input()
instead of tcp_do_segment() context.  Restore the expected behaviour.

Note:  This call to soisconnected() seems to be extraneous in all
cases (with or without accept_filter).  Will be addressed in a
separate commit.

PR: 212920
Reported by: Alexey
Tested by: Alexey, jch
Sponsored by: Verisign, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306925 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r297314: rc.d: Make msgs a proper rc.d script.
jilles [Sun, 9 Oct 2016 21:28:56 +0000 (21:28 +0000)]
MFC r297314: rc.d: Make msgs a proper rc.d script.

PR: 207149
Reported by: Jonathan de Boyne Pollard

git-svn-id: svn://svn.freebsd.org/base/stable/10@306924 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306560, r306561:
pfg [Sun, 9 Oct 2016 20:13:53 +0000 (20:13 +0000)]
MFC r306560, r306561:
patch(1): make some macros look boolean.

Minor cleanup inspired by a new patch(1) variant in schily tools.

For reference:
https://sourceforge.net/p/schillix-on/

git-svn-id: svn://svn.freebsd.org/base/stable/10@306914 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305812:
pfg [Sun, 9 Oct 2016 19:58:27 +0000 (19:58 +0000)]
MFC r305812:

fifolog(1): invert order of calloc(3) arguments.

The second argument to calloc(3) should be the size, make it so.

While here be a little bit more cautious in fifolog_reader_open()
to protect in the unlikely event of an overflowed allocation.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306910 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306599:
sevan [Sat, 8 Oct 2016 21:19:44 +0000 (21:19 +0000)]
MFC r306599:
dmesg(8) first appeared in 3BSD.
http://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/man/man1/dmesg.1m

PR:           212443
Approved by:  bcr (mentor)
Obtained from:        TUHS
Differential Revision:        https://reviews.freebsd.org/D8105

git-svn-id: svn://svn.freebsd.org/base/stable/10@306880 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306568, r306569
vangyzen [Sat, 8 Oct 2016 14:10:45 +0000 (14:10 +0000)]
MFC r306568, r306569

Add the __printflike attribute to the declarations of
dprintf(3) and vdprintf(3).

Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@306846 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH: r259647
julian [Fri, 7 Oct 2016 19:28:45 +0000 (19:28 +0000)]
MFH: r259647

 o Remove assertions on ipa_version as sometimes the version detection
   using cpuid can be quirky (this is the case of VMWare without the
   vPMC support) but fail to probe hwpmc.
 o Apply the fix for XEON family of processors as established by
   315338-020 document (bug AJ85).

 Sponsored by: EMC / Isilon storage division
 Reviewed by: fabient
MFC courtesy of panzura.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306824 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306292: fix vnode lock assertion for extended attributes directory
avg [Fri, 7 Oct 2016 18:56:24 +0000 (18:56 +0000)]
MFC r306292: fix vnode lock assertion for extended attributes directory

git-svn-id: svn://svn.freebsd.org/base/stable/10@306819 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306291: the rest of changes intended to be committed in r306290
avg [Fri, 7 Oct 2016 18:53:28 +0000 (18:53 +0000)]
MFC r306291: the rest of changes intended to be committed in r306290

git-svn-id: svn://svn.freebsd.org/base/stable/10@306817 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306218,306290: amdsbwd, intpm: unify bits specific to AMD chipsets
avg [Fri, 7 Oct 2016 18:51:04 +0000 (18:51 +0000)]
MFC r306218,306290: amdsbwd, intpm: unify bits specific to AMD chipsets

git-svn-id: svn://svn.freebsd.org/base/stable/10@306815 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r299199: Add nid_namelen bounds check to nfssvc system call
emaste [Fri, 7 Oct 2016 14:46:34 +0000 (14:46 +0000)]
MFC r299199: Add nid_namelen bounds check to nfssvc system call

This is only allowed by root and only used by the nfs daemon, which
should not provide an incorrect value. However, it's still good
practice to validate data provided by userland.

PR: 206626

git-svn-id: svn://svn.freebsd.org/base/stable/10@306809 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306674:
kib [Fri, 7 Oct 2016 11:50:59 +0000 (11:50 +0000)]
MFC r306674:
Style.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306805 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r296454:
jtl [Fri, 7 Oct 2016 10:47:32 +0000 (10:47 +0000)]
MFC r296454:
  Some cleanup in tcp_respond() in preparation for another change:
  - Reorder variables by size
  - Move initializer closer to where it is used
  - Remove unneeded variable

MFC r296455:
  As reported on the transport@ and current@ mailing lists, the FreeBSD TCP
  stack is not compliant with RFC 7323, which requires that TCP stacks send
  a timestamp option on all packets (except, optionally, RSTs) after the
  session is established.

  This patch adds that support. It also adds a TCP signature option to the
  packet, if appropriate.

MFC r300764 (by jhb@):
  Don't reuse the source mbuf in tcp_respond() if it is not writable.

  Not all mbufs passed up from device drivers are M_WRITABLE().  In
  particular, the Chelsio T4/T5 driver uses a feature called "buffer
  packing" to receive multiple frames in a single receive buffer.  The mbufs
  to receive multiple frames in a single receive buffer.  The mbufs for
  these frames all share the same external storage so are treated as
  read-only by the rest of the stack when multiple frames are in flight.
  Previously tcp_respond() would blindly overwrite read-only mbufs when
  INVARIANTS was disabled or panic with an assertion failure if INVARIANTS
  was enabled.  Note that the new case is a bit of a mix of the two other
  cases in tcp_respond().  The TCP and IP headers must be copied explicitly
  into the new mbuf instead of being inherited (similar to the m == NULL
  case), but the addresses and ports must be swapped in the reply (similar
  to the m != NULL case).

git-svn-id: svn://svn.freebsd.org/base/stable/10@306802 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306528: Fix `sesutil fault` operation.
mav [Fri, 7 Oct 2016 01:33:03 +0000 (01:33 +0000)]
MFC r306528: Fix `sesutil fault` operation.

Fault and ident bits are located in different control bytes, so previous
code was just doing nothing, writing into reserved bit.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306797 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302859: Include command line arguments in core dump process info.
jhb [Thu, 6 Oct 2016 21:17:18 +0000 (21:17 +0000)]
MFC 302859: Include command line arguments in core dump process info.

Fill in pr_psargs in the NT_PRSINFO ELF core dump note with command
line arguments.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306786 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299458: Fix buffer overrun in gcore(1) NT_PRPSINFO
jhb [Thu, 6 Oct 2016 19:41:09 +0000 (19:41 +0000)]
MFC 299458: Fix buffer overrun in gcore(1) NT_PRPSINFO

Use size of destination buffer, rather than a constant that may or may not
correspond to the source buffer, to restrict the length of copied strings.  In
particular, pr_fname has 16+1 characters but MAXCOMLEN is 18+1.

Use strlcpy instead of strncpy to ensure the result is nul-terminated.  This
seems to be what is expected of these fields.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306781 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306522
davidcs [Thu, 6 Oct 2016 18:56:06 +0000 (18:56 +0000)]
MFC r306522
Upgrade Firmware/Bootloader/ResetSeq/Minidump to revision 5.4.62

git-svn-id: svn://svn.freebsd.org/base/stable/10@306779 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306279: Use g_wither_provider() where applicable.
mav [Thu, 6 Oct 2016 15:36:13 +0000 (15:36 +0000)]
MFC r306279: Use g_wither_provider() where applicable.

It is just a helper function combining G_PF_WITHER setting with
g_orphan_provider().

git-svn-id: svn://svn.freebsd.org/base/stable/10@306765 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoFix ABI compat shims for FreeBSD 9.0-9.1 binaries (CAM_VERSION 0x16).
mav [Thu, 6 Oct 2016 03:20:47 +0000 (03:20 +0000)]
Fix ABI compat shims for FreeBSD 9.0-9.1 binaries (CAM_VERSION 0x16).

This is a direct commit to stable/10, inspired by some commits to later
branches.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306750 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306417: portsnap: only move expected snapshot contents from snap/ to files/
emaste [Wed, 5 Oct 2016 00:33:06 +0000 (00:33 +0000)]
MFC r306417: portsnap: only move expected snapshot contents from snap/ to files/

Previously it was possible to smuggle in addional files that would
be used by later portsnap runs. Now we only move those files expected
to be in the snapshot into files/ and require that there are no
unexpected files.

This was used by portsnap attacks 2, 3, and 4 in the "non-cryptanalytic
attacks against FreeBSD update components" anonymous gist.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306697 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoRevert r306659 since the userland changes won't merge and this would
rmacklem [Mon, 3 Oct 2016 23:17:57 +0000 (23:17 +0000)]
Revert r306659 since the userland changes won't merge and this would
break the build.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306663 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC: r304026
rmacklem [Mon, 3 Oct 2016 22:11:45 +0000 (22:11 +0000)]
MFC: r304026
Update the nfsstats structure to include the changes needed by
the patch in D1626 plus changes so that it includes counts for
NFSv4.1 (and the draft of NFSv4.2).
Also, make all the counts uint64_t and add a vers field at the
beginning, so that future revisions can easily be implemented.
There is code in place to handle the old vesion of the nfsstats
structure for backwards binary compatibility.

Subsequent commits will update nfsstat(8) to use the new fields.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306659 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306048
asomers [Mon, 3 Oct 2016 15:17:22 +0000 (15:17 +0000)]
MFC r306048

Fix periodic scripts when an NFS mount covers a local mount

100.chksetuid and 110.neggrpperm try to search through all UFS and ZFS
filesystems. But their logic contains an error. They also search through
remote filesystems that are mounted on top of the root of a local
filesystem. For example, if a user installs a FreeBSD system with the
default ZFS layout, he'll get a zroot/usr/home filesystem. If he then mounts
/usr/home over NFS, these scripts would search through /usr/home.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306644 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r305977:
kib [Mon, 3 Oct 2016 10:15:16 +0000 (10:15 +0000)]
MFC r305977:
Be more strict when selecting between snapshot/regular mount.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306630 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306334:
kib [Mon, 3 Oct 2016 09:32:19 +0000 (09:32 +0000)]
MFC r306334:
Document thr_suspend(2) and thr_wake(2).

MFC r306506:
Reword the statement.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306626 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306289:
kp [Sun, 2 Oct 2016 21:11:25 +0000 (21:11 +0000)]
MFC r306289:

bridge: Fix fragment handling and memory leak

Fragmented UDP and ICMP packets were corrupted if a firewall with reassembling
feature (like pf'scrub) is enabled on the bridge.  This patch fixes corrupted
packet problem and the panic (triggered easly with low RAM) as explain in PR
185633.

bridge_pfil and bridge_fragment relationship:

bridge_pfil() receive (IN direction) packets and sent it to the firewall The
firewall can be configured for reassembling fragmented packet (like pf'scrubing)
in one mbuf chain when bridge_pfil() need to send this reassembled packet to the
outgoing interface, it needs to re-fragment it by using bridge_fragment()
bridge_fragment() had to split this mbuf (using ip_fragment) first then
had to M_PREPEND each packet in the mbuf chain for adding Ethernet
header.

But M_PREPEND can sometime create a new mbuf on the begining of the mbuf chain,
then the "main" pointer of this mbuf chain should be updated and this case is
tottaly forgotten. The original bridge_fragment code (Revision 158140,
2006 April 29) came from OpenBSD, and the call to bridge_enqueue was
embedded.  But on FreeBSD, bridge_enqueue() is done after bridge_fragment(),
then the original OpenBSD code can't work as-it of FreeBSD.

PR:             185633
Submitted by:   Olivier Cochard-LabbĂ©

git-svn-id: svn://svn.freebsd.org/base/stable/10@306594 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC: r284583, r285797, r285799, r287168, r298714, r298720, r298838,
jkim [Fri, 30 Sep 2016 22:40:58 +0000 (22:40 +0000)]
MFC: r284583, r285797, r285799, r287168, r298714, r298720, r298838,
r300879

Merge ACPICA up to 20160527.

Requested by: mav

git-svn-id: svn://svn.freebsd.org/base/stable/10@306536 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 305034: Implement 'devctl clear driver' to undo a previous 'set driver'.
jhb [Fri, 30 Sep 2016 22:05:47 +0000 (22:05 +0000)]
MFC 305034: Implement 'devctl clear driver' to undo a previous 'set driver'.

Add a new 'clear driver' command for devctl along with the accompanying
ioctl and devctl_clear_driver() library routine to reset a device to
use a wildcard devclass instead of a fixed devclass.  This can be used
to undo a previous 'set driver' command.  After the device's name has
been reset to permit wildcard names, it is reprobed so that it can
attach to newly-available (to it) device drivers.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@306533 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 305502: Reset PCI pass through devices via PCI-e FLR during VM start/end.
jhb [Fri, 30 Sep 2016 18:47:34 +0000 (18:47 +0000)]
MFC 305502: Reset PCI pass through devices via PCI-e FLR during VM start/end.

Add routines to trigger a function level reset (FLR) of a PCI-express
device via the PCI-express device control register.  This also includes
support routines to wait for pending transactions to complete as well
as calculating the maximum completion timeout permitted by a device.

Change the ppt(4) driver to reset pass through devices before attaching
to a VM during startup and before detaching from a VM during shutdown.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@306520 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r299064
royger [Fri, 30 Sep 2016 13:49:50 +0000 (13:49 +0000)]
MFC r299064

rtc: fix inverted resolution check

git-svn-id: svn://svn.freebsd.org/base/stable/10@306501 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 304858,305485: Fix various issues with PCI pass through and VT-d.
jhb [Fri, 30 Sep 2016 01:42:29 +0000 (01:42 +0000)]
MFC 304858,305485: Fix various issues with PCI pass through and VT-d.

304858:
Enable I/O MMU when PCI pass through is first used.

Rather than enabling the I/O MMU when the vmm module is loaded,
defer initialization until the first attempt to pass a PCI device
through to a guest.  If the I/O MMU fails to initialize or is not
present, than fail the attempt to pass a PCI device through to a
guest.

The hw.vmm.force_iommu tunable has been removed since the I/O MMU is
no longer enabled during boot.  However, the I/O MMU support can be
disabled by setting the hw.vmm.iommu.enable tunable to 0 to prevent
use of the I/O MMU on any systems where it is buggy.

305485:
Leave ppt devices in the host domain when they are not attached to a VM.

This allows a pass through device to be reset to a normal device driver
on the host and reused on the host.  ppt devices are now always active in
some I/O MMU domain when the I/O MMU is active, either the host domain
or the domain of a VM they are attached to.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306472 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 305248: Remove warning about pci_addr_t being different sizes.
jhb [Fri, 30 Sep 2016 01:16:09 +0000 (01:16 +0000)]
MFC 305248: Remove warning about pci_addr_t being different sizes.

pci_addr_t has always been 64-bits since r163805.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306470 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303881: Reliably return PCI_GETCONF_LAST_DEVICE from PCIOCGETCONF.
jhb [Fri, 30 Sep 2016 01:13:57 +0000 (01:13 +0000)]
MFC 303881: Reliably return PCI_GETCONF_LAST_DEVICE from PCIOCGETCONF.

Previously the loop in PCIIOCGETCONF would terminate as soon as it
found enough matches.  Now it will continue iterating through the
PCI device list and only terminate if it finds another matching device
for which it has no room to store a conf structure.  This means that
PCI_GETCONF_LAST_DEVICE is reliably returned when the number of
matching devices is equal to the number of slots in the matches
buffer.  For example, if a program requests the conf structure for a
single PCI function with a specified domain/bus/slot/function it will
now get PCI_GETCONF_LAST_DEVICE instead of PCI_GETCONF_MORE_DEVS.

While here, simplify the loop conditional a bit more by explicitly
breaking out of the loop if copyout() fails and removing a redundant
i < pci_numdevs check.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@306469 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f