]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r318822: MFC r316913: 7869 panic in bpobj_space(): null pointer dereference
mav [Wed, 26 Jul 2017 16:42:32 +0000 (16:42 +0000)]
MFC r318822: MFC r316913: 7869 panic in bpobj_space(): null pointer dereference

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

https://www.illumos.org/issues/7869
  The issue fixed by this patch is a race condition in the deadlist code.
  A thread executing an administrative command that uses
  `dsl_deadlist_space_range()` holds the lock of the whole `deadlist_t` to
  protect the access of all its entries that the deadlist contains in an
  avl tree.
  Sync threads trying to insert a new entry in the deadlist
  (through `dsl_deadlist_insert()` -> `dle_enqueue()`) do not hold the
  deadlist lock at that moment. If the `dle_bpobj` is the empty bpobj (our
  sentinel value), we close and reopen it. Between these two operations,
  it is possible for the `dsl_deadlist_space_range()` thread to dereference
  that bpobj which is `NULL` during that window.
  Threads should hold the a deadlist's `dl_lock` when they manipulate its
  internal data so scenarios like the one above are avoided. In addition,
  threads should also hold the bpobj lock whenever they are allocating the
  subobj list of a bpobj, and not just when they actually insert the subobj
  to the list. This way we can avoid potential memory leaks.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: George Melikov <mail@gmelikov.ru>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Serapheim Dimitropoulos <serapheim@delphix.com>

6 years agoMFC r318821: MFV r316912: 7793 ztest fails assertion in dmu_tx_willuse_space
mav [Wed, 26 Jul 2017 16:35:17 +0000 (16:35 +0000)]
MFC r318821: MFV r316912: 7793 ztest fails assertion in dmu_tx_willuse_space

illumos/illumos-gate@61e255ce7267b52208af9daf434b77d37fb75622
https://github.com/illumos/illumos-gate/commit/61e255ce7267b52208af9daf434b77d37
fb75622

https://www.illumos.org/issues/7793
  Background information: This assertion about tx_space_* verifies that we
  are not dirtying more stuff than we thought we would. We “need” to know
  how much we will dirty so that we can check if we should fail this
  transaction with ENOSPC/EDQUOT, in dmu_tx_assign(). While the
  transaction is open (i.e. between dmu_tx_assign() and dmu_tx_commit() —
  typically less than a millisecond), we call dbuf_dirty() on the exact
  blocks that will be modified. Once this happens, the temporary
  accounting in tx_space_* is unnecessary, because we know exactly what
  blocks are newly dirtied; we call dnode_willuse_space() to track this
  more exact accounting.
  The fundamental problem causing this bug is that dmu_tx_hold_*() relies
  on the current state in the DMU (e.g. dn_nlevels) to predict how much
  will be dirtied by this transaction, but this state can change before we
  actually perform the transaction (i.e. call dbuf_dirty()).
  This bug will be fixed by removing the assertion that the tx_space_*
  accounting is perfectly accurate (i.e. we never dirty more than was
  predicted by dmu_tx_hold_*()). By removing the requirement that this
  accounting be perfectly accurate, we can also vastly simplify it, e.g.
  removing most of the logic in dmu_tx_count_*().
  The new tx space accounting will be very approximate, and may be more or
  less than what is actually dirtied. It will still be used to determine
  if this transaction will put us over quota. Transactions that are marked
  by dmu_tx_mark_netfree() will be excepted from this check. We won’t make
  an attempt to determine how much space will be freed by the transaction
  — this was rarely accurate enough to determine if a transaction should
  be permitted when we are over quota, which is why dmu_tx_mark_netfree()
  was introduced in 2014.
  We also won’t attempt to give “credit” when overwriting existing blocks,
  if those blocks may be freed. This allows us to remove the
  do_free_accounting logic in dbuf_dirty(), and associated routines. This

Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

6 years agoMFC r318819: MFV r316908: 7541 zpool import/tryimport ioctl returns ENOMEM because...
mav [Wed, 26 Jul 2017 16:33:58 +0000 (16:33 +0000)]
MFC r318819: MFV r316908: 7541 zpool import/tryimport ioctl returns ENOMEM because provided buffer is too small for config

illumos/illumos-gate@8b65a70b763232c90a91f31eb2010314c02ed338
https://github.com/illumos/illumos-gate/commit/8b65a70b763232c90a91f31eb2010314c02ed338

https://www.illumos.org/issues/7541
  When calling zpool import, zpool does a few ioctls to ZFS.
  zpool allocates a buffer in userland and passes it to the kernel so that ZFS
  can copy info into it. ZFS will use it to put the nvlist that describes the
  pool configuration.
  If the allocated buffer is too small, ZFS will return ENOMEM and the call will
  have to be redone. This wastes CPU time and slows down the import process. This
  happens very often for the ZFS_IOC_POOL_TRYIMPORT call.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Pavel Zakharov <pavel.zakharov@delphix.com>

6 years agoMFC r318818: MFV r316907: 1300 filename normalization doesn't work for removes
mav [Wed, 26 Jul 2017 16:32:17 +0000 (16:32 +0000)]
MFC r318818: MFV r316907: 1300 filename normalization doesn't work for removes

illumos/illumos-gate@1c17160ac558f98048951327f4e9248d8f46acc0
https://github.com/illumos/illumos-gate/commit/1c17160ac558f98048951327f4e9248d8f46acc0

https://www.illumos.org/issues/1300

FreeBSD note: recent FreeBSD was not affected by the issue fixed as the
name cache is completely bypassed when normalization is enabled.
The change is imported for the sake of ZAP infrastructure modifications.

Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Kevin Crowe <kevin.crowe@nexenta.com>

6 years agoMFC r318814: MFC r316904: 7729 libzfs_core`lzc_rollback() leaks result nvl
mav [Wed, 26 Jul 2017 16:30:57 +0000 (16:30 +0000)]
MFC r318814: MFC r316904: 7729 libzfs_core`lzc_rollback() leaks result nvl

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

https://www.illumos.org/issues/7729
  libzfs_core`lzc_rollback() doesn't free the result nvl after lzc_ioctl() call.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Yuri Pankov <yuri.pankov@nexenta.com>

6 years agoMFC r318812: MFV r316860: 7545 zdb should disable reference tracking
mav [Wed, 26 Jul 2017 16:30:09 +0000 (16:30 +0000)]
MFC r318812: MFV r316860: 7545 zdb should disable reference tracking

illumos/illumos-gate@4dd77f9e38ef05b39db128ff7608d926fd3218c6
https://github.com/illumos/illumos-gate/commit/4dd77f9e38ef05b39db128ff7608d926fd3218c6

https://www.illumos.org/issues/7545
  When evicting from the ARC, we manipulate some refcount_t's, e.g. arcs_size.
  When using zdb to examine a large amount of data (e.g. zdb -bb on a large pool
  with small blocks), the ARC may have a large number of entries. If reference
  tracking is enabled, there will be ~1 reference for each block in the ARC. When
  evicting, we decrement the refcount and have to search all the references to
  find the one that we are removing, which is very slow.
  Since zdb is typically used to find problems with the on-disk format, and not
  with the code it is running, we should disable reference tracking in zdb.

Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

6 years agoMFC r317648: Fix misport of compressed ZFS send/recv from 317414
mav [Wed, 26 Jul 2017 16:28:05 +0000 (16:28 +0000)]
MFC r317648: Fix misport of compressed ZFS send/recv from 317414

Reported by:    Michael Jung <mikej@mikej.com>

6 years agoMFC r317541: MFV 316905
mav [Wed, 26 Jul 2017 16:27:20 +0000 (16:27 +0000)]
MFC r317541: MFV 316905

7740 fix for 6513 only works in hole punching case, not truncation

illumos/illumos-gate@7de35a3ed0c2e6d4256bd2fb05b48b3798aaf553
https://github.com/illumos/illumos-gate/commit/7de35a3ed0c2e6d4256bd2fb05b48b3798aaf553

https://www.illumos.org/issues/7740
  The problem is that dbuf_findbp will return ENOENT if the block it's
  trying to find is beyond the end of the file. If that happens, we assume
  there is no birth time, and so we lose that information when we write
  out new blkptrs. We should teach dbuf_findbp to look for things that are
  beyond the current end, but not beyond the absolute end of the file.
  To verify, create a large file, truncate it to a short length, and then
  write beyond the end. Check with zdb to make sure that there are no
  holes with birth time zero (will appear as gaps).

Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Paul Dagnelie <pcd@delphix.com>

6 years agoMFC r317533: MFV 316900
mav [Wed, 26 Jul 2017 16:26:34 +0000 (16:26 +0000)]
MFC r317533: MFV 316900

7743 per-vdev-zaps have no initialize path on upgrade

illumos/illumos-gate@555da5111b0f2552c42d057b211aba89c9c79f6c
https://github.com/illumos/illumos-gate/commit/555da5111b0f2552c42d057b211aba89c9c79f6c

https://www.illumos.org/issues/7743
  When loading a pool that had been created before the existance of
  per-vdev zaps, on a system that knows about per-vdev zaps, the
  per-vdev zaps will not be allocated and initialized.
  This appears to be because the logic that would have done so, in
  spa_sync_config_object(), is not reached under normal operation. It is
  only reached if spa_config_dirty_list is non-empty.
  The fix is to add another `AVZ_ACTION_` enum that will allow this code
  to be reached when we detect that we're loading an old pool, even when
  there are no dirty configs.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Don Brady <don.brady@intel.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Paul Dagnelie <pcd@delphix.com>

6 years agoMFC r317527: MFV 316898
mav [Wed, 26 Jul 2017 16:25:46 +0000 (16:25 +0000)]
MFC r317527: MFV 316898

7613 ms_freetree[4] is only used in syncing context

illumos/illumos-gate@5f145778012b555e084eacc858ead9e1e42bd149
https://github.com/illumos/illumos-gate/commit/5f145778012b555e084eacc858ead9e1e42bd149

https://www.illumos.org/issues/7613
  metaslab_t:ms_freetree[TXG_SIZE] is only used in syncing context. We should
  replace it with two trees: the freeing tree (ranges that we are freeing this
  syncing txg) and the freed tree (ranges which have been freed this txg).

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>

6 years agoMFC r317522: MFV 316897
mav [Wed, 26 Jul 2017 16:24:53 +0000 (16:24 +0000)]
MFC r317522: MFV 316897

7586 remove #ifdef __lint hack from dmu.h

illumos/illumos-gate@4ba5b9616327ef64e8abc737d29b3faabc6ae68c
https://github.com/illumos/illumos-gate/commit/4ba5b9616327ef64e8abc737d29b3faabc6ae68c

https://www.illumos.org/issues/7586
  The #ifdef __lint in dmu.h is ugly, and it would be nice not to duplicate it if
  we add other inline functions into header files in ZFS, especially since it is
  difficult to make any other solution work across all compilation targets. We
  should switch to disabling the lint flags that are failing instead.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Dan Kimmel <dan.kimmel@delphix.com>

6 years agoMFC r317511: MFV 316896
mav [Wed, 26 Jul 2017 16:24:11 +0000 (16:24 +0000)]
MFC r317511: MFV 316896

7580 ztest failure in dbuf_read_impl

illumos/illumos-gate@1a01181fdc809f40c64d5c6881ae3e4521a9d9c7
https://github.com/illumos/illumos-gate/commit/1a01181fdc809f40c64d5c6881ae3e4521a9d9c7

https://www.illumos.org/issues/7580
  We need to prevent any reader whenever we're about the zero out all the
  blkptrs. To do this we need to grab the dn_struct_rwlock as writer in
  dbuf_write_children_ready and free_children just prior to calling bzero.

Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: George Wilson <george.wilson@delphix.com>

6 years agoMFC r317507: MFV 316895
mav [Wed, 26 Jul 2017 16:23:30 +0000 (16:23 +0000)]
MFC r317507: MFV 316895

7606 dmu_objset_find_dp() takes a long time while importing pool

illumos/illumos-gate@7588687e6ba67c47bf7c9805086dec4a97fcac7b
https://github.com/illumos/illumos-gate/commit/7588687e6ba67c47bf7c9805086dec4a97fcac7b

https://www.illumos.org/issues/7606
  When importing a pool with a large number of filesystems within the same
  parent filesystem, we see that dmu_objset_find_dp() takes a long time.
  It is called from 3 places: spa_check_logs(), spa_ld_claim_log_blocks(),
  and spa_load_verify().
  There are several ways to improve performance here:
  1. We don't really need to do spa_check_logs() or
         spa_ld_claim_log_blocks() if the pool was closed cleanly.
  2. spa_load_verify() uses dmu_objset_find_dp() to check that no
         datasets have too long of names.
  3. dmu_objset_find_dp() is slow because it's doing
         zap_value_search() (which is O(N sibling datasets)) to determine
         the name of each dsl_dir when it's opened. In this case we
         actually know the name when we are opening it, so we can provide
         it and avoid the lookup.
  This change implements fix #3 from the above list; i.e. make
  dmu_objset_find_dp() provide the name of the dataset so that we don't
  have to search for it.

Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prashanth Sreenivasa <prashksp@gmail.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Matthew Ahrens <mahrens@delphix.com>

6 years agoMFC r317414: MFV 316894
mav [Wed, 26 Jul 2017 16:21:32 +0000 (16:21 +0000)]
MFC r317414: MFV 316894

7252 7628 compressed zfs send / receive

illumos/illumos-gate@5602294fda888d923d57a78bafdaf48ae6223dea
https://github.com/illumos/illumos-gate/commit/5602294fda888d923d57a78bafdaf48ae6223dea

https://www.illumos.org/issues/7252
  This feature includes code to allow a system with compressed ARC enabled to
  send data in its compressed form straight out of the ARC, and receive data in
  its compressed form directly into the ARC.

https://www.illumos.org/issues/7628
  We should have longer, more readable versions of the ZFS send / recv options.

7628 create long versions of ZFS send / receive options

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: David Quigley <dpquigl@davequigley.com>
Reviewed by: Thomas Caputi <tcaputi@datto.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Dan Kimmel <dan.kimmel@delphix.com>

6 years agoMFC r317267: MFV 316891
mav [Wed, 26 Jul 2017 16:20:19 +0000 (16:20 +0000)]
MFC r317267: MFV 316891

7386 zfs get does not work properly with bookmarks

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

https://www.illumos.org/issues/7386
  The zfs get command does not work with the bookmark parameter while it works
  properly with both filesystem and snapshot:
  # zfs get -t all -r creation rpool/test
  NAME               PROPERTY  VALUE                  SOURCE
  rpool/test         creation  Fri Sep 16 15:00 2016  -
  rpool/test@snap    creation  Fri Sep 16 15:00 2016  -
  rpool/test#bkmark  creation  Fri Sep 16 15:00 2016  -
  # zfs get -t all -r creation rpool/test@snap
  NAME             PROPERTY  VALUE                  SOURCE
  rpool/test@snap  creation  Fri Sep 16 15:00 2016  -
  # zfs get -t all -r creation rpool/test#bkmark
  cannot open 'rpool/test#bkmark': invalid dataset name
  #
  The zfs get command should be modified to work properly with bookmarks too.

Reviewed by: Simon Klinkert <simon.klinkert@gmail.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Marcel Telka <marcel@telka.sk>

6 years agoMFC r317238: MFV 316871
mav [Wed, 26 Jul 2017 16:19:04 +0000 (16:19 +0000)]
MFC r317238: MFV 316871

7490 real checksum errors are silenced when zinject is on

illumos/illumos-gate@6cedfc397d92d64e442f0aae4445ac507beaf58f
https://github.com/illumos/illumos-gate/commit/6cedfc397d92d64e442f0aae4445ac507beaf58f

https://www.illumos.org/issues/7490
  When zinject is on, error codes from zfs_checksum_error() can be overwritten
  due to an incorrect and overly-complex if condition.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Pavel Zakharov <pavel.zakharov@delphix.com>

6 years agoMFC r317237: MFV 316870
mav [Wed, 26 Jul 2017 16:18:19 +0000 (16:18 +0000)]
MFC r317237: MFV 316870

7448 ZFS doesn't notice when disk vdevs have no write cache

illumos/illumos-gate@295438ba3230419314faaa889a2616f561658bd5
https://github.com/illumos/illumos-gate/commit/295438ba3230419314faaa889a2616f56
1658bd5

https://www.illumos.org/issues/7448
       I built a SmartOS image with all the NVMe commits including 7372
       (support NVMe volatile write cache) and repeated my dd testing:
       > #!/bin/bash
       > for i in `seq 1 1000`; do
       > dd if=/dev/zero of=file00 bs=1M count=102400 oflag=sync &
       > dd if=/dev/zero of=file01 bs=1M count=102400 oflag=sync &
       > wait
       > rm file00 file01
       > done
       >
       Previously each dd command took ~145 seconds to finish, now it takes
       ~400 seconds.
       Eventually I figured out it is 7372 that causes unnecessary
       nvme_bd_sync() executions which wasted CPU cycles.
  If a NVMe device doesn't support a write cache, the nvme_bd_sync function will
  return ENOTSUP to indicate this to upper layers.
  It seems this returned value is ignored by ZFS, and as such this bug is not
  really specific to NVMe. In vdev_disk_io_start() ZFS sends the flush to the
  disk driver (blkdev) with a callback to vdev_disk_ioctl_done(). As nvme filled
  in the bd_sync_cache function pointer, blkdev will not return ENOTSUP, as the
  nvme driver in general does support cache flush. Instead it will issue an
  asynchronous flush to nvme and immediately return 0, and hence ZFS will not se
t
  vdev_nowritecache here. The nvme driver will at some point process the cache
  flush command, and if there is no write cache on the device it will return
  ENOTSUP, which will be delivered to the vdev_disk_ioctl_done() callback. This
  function will not check the error code and not set nowritecache.
  The right place to check the error code from the cache flush is in
  zio_vdev_io_assess(). This would catch both cases, synchronous and asynchronous
  cache flushes. This would also be independent of the implementation detail that
  some drivers can return ENOTSUP immediately.

Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Hans Rosenfeld <hans.rosenfeld@nexenta.com>

6 years agoMFC r317235: MFV 316868
mav [Wed, 26 Jul 2017 16:16:43 +0000 (16:16 +0000)]
MFC r317235: MFV 316868

7430 Backfill metadnode more intelligently

illumos/illumos-gate@af346df58864e8fe897b1ff1a3a4c12f9294391b
https://github.com/illumos/illumos-gate/commit/af346df58864e8fe897b1ff1a3a4c12f9
294391b

https://www.illumos.org/issues/7430
  Description and patch from brought over from the following ZoL commit: https:/
/
  github.com/zfsonlinux/zfs/commit/68cbd56e182ab949f58d004778d463aeb3f595c6
  Only attempt to backfill lower metadnode object numbers if at least
  4096 objects have been freed since the last rescan, and at most once
  per transaction group. This avoids a pathology in dmu_object_alloc()
  that caused O(N^2) behavior for create-heavy workloads and
  substantially improves object creation rates. As summarized by
  @mahrens in #4636:
  "Normally, the object allocator simply checks to see if the next
  object is available. The slow calls happened when dmu_object_alloc()
  checks to see if it can backfill lower object numbers. This happens
  every time we move on to a new L1 indirect block (i.e. every 32 *
  128 = 4096 objects). When re-checking lower object numbers, we use
  the on-disk fill count (blkptr_t:blk_fill) to quickly skip over
  indirect blocks that don?t have enough free dnodes (defined as an L2
  with at least 393,216 of 524,288 dnodes free). Therefore, we may
  find that a block of dnodes has a low (or zero) fill count, and yet
  we can?t allocate any of its dnodes, because they've been allocated
  in memory but not yet written to disk. In this case we have to hold
  each of the dnodes and then notice that it has been allocated in
  memory.
  The end result is that allocating N objects in the same TXG can
  require CPU usage proportional to N^2."
  Add a tunable dmu_rescan_dnode_threshold to define the number of
  objects that must be freed before a rescan is performed. Don't bother
  to export this as a module option because testing doesn't show a
  compelling reason to change it. The vast majority of the performance
  gain comes from limit the rescan to at most once per TXG.

Reviewed by: Alek Pinchuk <alek@nexenta.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Ned Bass <bass6@llnl.gov>

6 years agoMFC r316037: MFV: 315989
mav [Wed, 26 Jul 2017 16:14:57 +0000 (16:14 +0000)]
MFC r316037: MFV: 315989

7603 xuio_stat_wbuf_* should be declared (void)

illumos/illumos-gate@99aa8b55058e512798eafbd71f72f916bdc10181
https://github.com/illumos/illumos-gate/commit/99aa8b55058e512798eafbd71f72f916bdc10181

https://www.illumos.org/issues/7603

  The funcs are declared k&r style, where the args are not specified:

  void xuio_stat_wbuf_copied();
  They should be declared to take no arguments:

  void xuio_stat_wbuf_copied(void);
  Need to change both .c and .h.

Author: Prashanth Sreenivasa <pks@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

6 years agoMFC r315896: MFV r315290, r315291: 7303 dynamic metaslab selection
mav [Wed, 26 Jul 2017 16:14:05 +0000 (16:14 +0000)]
MFC r315896: MFV r315290, r315291: 7303 dynamic metaslab selection

illumos/illumos-gate@8363e80ae72609660f6090766ca8c2c18aa53f0c
https://github.com/illumos/illumos-gate/commit/8363e80ae72609660f6090766ca8c2c18

https://www.illumos.org/issues/7303

  This change introduces a new weighting algorithm to improve metaslab selection
.
  The new weighting algorithm relies on the SPACEMAP_HISTOGRAM feature. As a res
ult,
  the metaslab weight now encodes the type of weighting algorithm used
  (size-based vs segment-based).

  This also introduce a new allocation tracing facility and two new dcmds to hel
p
  debug allocation problems. Each zio now contains a zio_alloc_list_t structure
  that is populated as the zio goes through the allocations stage. Here's an
  example of how to use the tracing facility:

c5ec000::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
  MSID    DVA    ASIZE      WEIGHT             RESULT               VDEV
     -      0      400           0    NOT_ALLOCATABLE           ztest.0a
     -      0      400           0    NOT_ALLOCATABLE           ztest.0a
     -      0      400           0             ENOSPC           ztest.0a
     -      0      200           0    NOT_ALLOCATABLE           ztest.0a
     -      0      200           0    NOT_ALLOCATABLE           ztest.0a
     -      0      200           0             ENOSPC           ztest.0a
     1      0      400      1 x 8M            17b1a00           ztest.0a

1ff2400::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
  MSID    DVA    ASIZE      WEIGHT             RESULT               VDEV
     -      0      200           0    NOT_ALLOCATABLE           mirror-2
     -      0      200           0    NOT_ALLOCATABLE           mirror-0
     1      0      200      1 x 4M            112ae00           mirror-1
     -      1      200           0    NOT_ALLOCATABLE           mirror-2
     -      1      200           0    NOT_ALLOCATABLE           mirror-0
     1      1      200      1 x 4M            112b000           mirror-1
     -      2      200           0    NOT_ALLOCATABLE           mirror-2

  If the metaslab is using segment-based weighting then the WEIGHT column will
  display the number of segments available in the bucket where the allocation
  attempt was made.

Author: George Wilson <george.wilson@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Don Brady <don.brady@intel.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

6 years agoMFC r314280: MFV 314276
mav [Wed, 26 Jul 2017 16:12:20 +0000 (16:12 +0000)]
MFC r314280: MFV 314276

7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL

illumos/illumos-gate@1c9272b861cd640a8342f4407da026ed98615517
https://github.com/illumos/illumos-gate/commit/1c9272b861cd640a8342f4407da026ed98615517

https://www.illumos.org/issues/7570

  Based on the discovery that every unmap waits for the commit of the txn to the ZIL,
  introducing a very high latency to unmap commands, this behavior was made into a
  tunable zvol_unmap_sync_enabled and set to false. The net impact of this change is
  that by default SCSI unmap commands will result in space being freed within the zvol
  (today they are ignored and returned with good status). However, unlike the code
  today, instead of 18+ms per unmap, they take about 30us.

  With the testing done on NTFS against a Win2k12 target, the new behavior should work
  seamlessly. Files on the zvol that have already been set with the zfree application
  will continue to write 0's when deleted, and any new files created since zvol
  creation will send unmap commands when deleted. This behavior exists today, but with
  this change the unmap commands will be processed and result in reclaim of space.

Author: Stephen Blinick <stephen.blinick@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Robert Mustacchi <rm@joyent.com>

6 years agoMFC r314267: MFV 314243
mav [Wed, 26 Jul 2017 16:11:08 +0000 (16:11 +0000)]
MFC r314267: MFV 314243

6676 Race between unique_insert() and unique_remove() causes ZFS fsid change

illumos/illumos-gate@40510e8eba18690b9a9843b26393725eeb0f1dac
https://github.com/illumos/illumos-gate/commit/40510e8eba18690b9a9843b26393725ee
b0f1dac

https://www.illumos.org/issues/6676

  The fsid of zfs filesystems might change after reboot or remount. The problem
seems to
  be caused by a race between unique_insert() and unique_remove(). The unique_re
move()
  is called from dsl_dataset_evict() which is now an asynchronous thread. In a c
ase the
  dsl_dataset_evict() thread is very slow and calls unique_remove() too late we
will end
  up with changed fsid on zfs mount.

  This problem is very likely caused by #5056.

  Steps to Reproduce
  Note: I'm able to reproduce this always on a single core (virtual) machine. On
 multicore
  machines it is not so easy to reproduce.

# uname -a
SunOS openindiana 5.11 illumos-633aa80 i86pc i386 i86pc Solaris
# zfs create rpool/TEST
# FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
# echo $FS::print vfs_t vfs_fsid | mdb -k
vfs_fsid = {
    vfs_fsid.val = [ 0x54d7028a, 0x70311508 ]
}
# zfs umount rpool/TEST
# zfs mount rpool/TEST
# FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
# echo $FS::print vfs_t vfs_fsid | mdb -k
vfs_fsid = {
    vfs_fsid.val = [ 0xd9454e49, 0x6b36d08 ]
}
#

  Impact
  The persistent fsid (filesystem id) is essential for proper NFS functionality.
  If the fsid of a filesystem changes on remount (or after reboot) the NFS
  clients might not be able to automatically recover from such event and the
  manual remount of the NFS filesystems on every NFS client might be needed.

Author: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Dan Vatca <dan.vatca@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>

6 years agoFix mismerge in r321525.
mav [Wed, 26 Jul 2017 15:52:51 +0000 (15:52 +0000)]
Fix mismerge in r321525.

6 years agoMFC r314112 (by tsoome): loader: update symlink support in zfs reader
mav [Wed, 26 Jul 2017 15:29:56 +0000 (15:29 +0000)]
MFC r314112 (by tsoome): loader: update symlink support in zfs reader

As the current zfs file system is providing symlink via system attributes,
need to update the code accordingly.

Note, as the zfsboot code does not free the memory at this time, the
object list will put some stress on the boot2 heap, eventually we should
address the issue.

Differential Revision:  https://reviews.freebsd.org/D9706

6 years agoMFC r313813: MFV 313786
mav [Wed, 26 Jul 2017 15:24:17 +0000 (15:24 +0000)]
MFC r313813: MFV 313786

7500 Simplify dbuf_free_range by removing dn_unlisted_l0_blkid

illumos/illumos-gate@653af1b809998570c7e89fe7a0d3f90992bf0216
https://github.com/illumos/illumos-gate/commit/653af1b809998570c7e89fe7a0d3f90992bf0216

https://www.illumos.org/issues/7500
  With the integration of:

    commit 0f6d88aded0d165f5954688a9b13bac76c38da84
    Author: Alex Reece <alex@delphix.com>
    Date:   Sat Jul 26 13:40:04 2014 -0800
    4873 zvol unmap calls can take a very long time for larger datasets

  the dnode's dn_bufs field was changed from a list to a tree. As a result,
  the dn_unlisted_l0_blkid field is no longer necessary.

Author: Stephen Blinick <stephen.blinick@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>

6 years agoMFC r312535: MFV 312436
mav [Wed, 26 Jul 2017 15:23:01 +0000 (15:23 +0000)]
MFC r312535: MFV 312436

 6569 large file delete can starve out write ops

  illumos/illumos-gate@ff5177ee8bf9a355131ce2cc61ae2da6a5a6fdd6
  https://github.com/illumos/illumos-gate/commit/ff5177ee8bf9a355131ce2cc61ae2da
6a5a6fdd6

  https://www.illumos.org/issues/6569
    The core issue I've found is that there is no throttle for how many
    deletes get assigned to one TXG. As a results when deleting large files
    we end up filling consecutive TXGs with deletes/frees, then write
    throttling other (more important) ops.

    There is an easy test case for this problem. Try deleting several
    large files (at least 1/2 TB) while you do write ops on the same
    pool. What we've seen is performance of these write ops (let's
    call it sideload I/O) would drop to zero.

    More specifically the problem is that dmu_free_long_range_impl()
    can/will fill up all of the dirty data in the pool "instantly",
    before many of the sideload ops can get in. So sideload
    performance will be impacted until all the files are freed.

    The solution we have tested at Nexenta (with positive results)
    creates a relatively simple throttle for how many "free" ops we let
    into one TXG.

    However this solution exposes other problems that should also be
    addressed. If we are to slow down freeing of data that means one
    has to wait even longer (assuming vnode ref count of 1) to get shell
    back after an rm or for NFS thread to finish the free-ing op.
    To avoid this the proposed solution is to call zfs_inactive() async
    for "large" files. Async freeing then begs for the reclaimed space
    to be accounted for in the zpool's "freeing" prop.

    The other issue with having a longer delete is the inability to
    export/unmount for a longer period of time. The proposed solution
    is to interrupt freeing of blocks when a fs is unmounted.

  Author: Alek Pinchuk <alek@nexenta.com>
  Reviewed by: Matt Ahrens <mahrens@delphix.com>
  Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
  Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
  Approved by: Dan McDonald <danmcd@omniti.com>

6 years agoMFC r309096 (by avg): MFV r308989:
mav [Wed, 26 Jul 2017 15:19:34 +0000 (15:19 +0000)]
MFC r309096 (by avg): 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.

6 years agoMFC r305701 (by allanjude): MFV r268120:
mav [Wed, 26 Jul 2017 15:15:20 +0000 (15:15 +0000)]
MFC r305701 (by allanjude): MFV r268120:
4936 lz4 could theoretically overflow a pointer with a certain input

illumos/illumos-gate@58d0718061c87e3d647c891ec5281b93c08dba4e

6 years agoAdd a note regarding VirtualBox vboxguest panics during 11.1-RC2.
gjb [Wed, 26 Jul 2017 14:56:03 +0000 (14:56 +0000)]
Add a note regarding VirtualBox vboxguest panics during 11.1-RC2.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r303630 (by allanjude):
mav [Wed, 26 Jul 2017 14:55:47 +0000 (14:55 +0000)]
MFC r303630 (by allanjude):
Make boot code and loader check for unsupported ZFS feature flags

OpenZFS uses feature flags instead of a zpool version number to track
features since the split from Oracle. In addition to avoiding confusion
on ZFS vs OpenZFS version numbers, this also allows features to be added
to different operating systems that use OpenZFS in different order.

The previous zfs boot code (gptzfsboot) and loader (zfsloader) blindly
tries to read the pool, and if failed provided only a vague error message.

With this change, both the boot code and loader check the MOS features
list in the ZFS label and compare it against the list of features that
the loader supports. If any unsupported feature is active, the pool is
not considered as a candidate for booting, and a helpful diagnostic
message is printed to the screen. Features that are merely enabled via
zpool upgrade, but not in use, do not block booting from the pool.

Submitted by:   Toomas Soome <tsoome@me.com>
Reviewed by:    delphij, mav
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D6857

6 years agoMFC r321203:
ae [Wed, 26 Jul 2017 11:04:30 +0000 (11:04 +0000)]
MFC r321203:
  Add HPE FlexFabric 10Gb 4-port 536FLR-T device id to the bxe(4) driver.

6 years agoMFC r321217:
kib [Wed, 26 Jul 2017 07:00:27 +0000 (07:00 +0000)]
MFC r321217:
Remove unused function swap_pager_isswapped().

6 years agoMFC r321247:
kib [Wed, 26 Jul 2017 06:52:45 +0000 (06:52 +0000)]
MFC r321247:
Add pctrie_init() and vm_radix_init() to initialize generic pctrie and
vm_radix trie.

6 years agoMFC 321233
davidcs [Wed, 26 Jul 2017 01:19:49 +0000 (01:19 +0000)]
MFC 321233
  Raise the watchdog timer interval to 2 ticks, there by guaranteeing
  that it fires between 1ms and 2ms. `
  Treat two consecutive occurrences of Heartbeat failures as a legitimate
  Heartbeat failure

6 years agoMFC 320705
davidcs [Wed, 26 Jul 2017 01:15:31 +0000 (01:15 +0000)]
MFC 320705
  Release mtx hw_lock before calling pause() in qla_stop() and
  qla_error_recovery()

6 years agoMFC 320694
davidcs [Wed, 26 Jul 2017 01:12:28 +0000 (01:12 +0000)]
MFC 320694
Allow MTU changes without ifconfig down/up

6 years agoreadelf: fix printing of DT_FILTER and some other DT_* values
emaste [Tue, 25 Jul 2017 17:24:50 +0000 (17:24 +0000)]
readelf: fix printing of DT_FILTER and some other DT_* values

MFC r321045: readelf: fix printing of DT_FILTER and some other DT_* values

Some non-processor-specific DT_* values overlap the range DT_LOPROC to
DT_HIPROC.  Handle common ones first, then the processor-specific ones.

MFC r321046: readelf: correct printing of DT_FILTER and DT_AUXILIARY values

Previously these were shown only for MIPS objects.

Obtained from: ELF Tool Chain r3563, r3564
Sponsored by: The FreeBSD Foundation

6 years agoDocument a late-discovered issue where 'root on ZFS' installations
gjb [Tue, 25 Jul 2017 14:46:13 +0000 (14:46 +0000)]
Document a late-discovered issue where 'root on ZFS' installations
on arm64 fail to find the root pool.

Sponsored by: The FreeBSD Foundation

6 years agoMention arm64 lacking EFI RTC support, and a workaround.
gjb [Tue, 25 Jul 2017 14:35:44 +0000 (14:35 +0000)]
Mention arm64 lacking EFI RTC support, and a workaround.

Submitted by: emaste
Sponsored by: The FreeBSD Foundation

6 years agoTrim stale entries from 11.0.
gjb [Tue, 25 Jul 2017 13:43:51 +0000 (13:43 +0000)]
Trim stale entries from 11.0.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoFix a typo.
gjb [Tue, 25 Jul 2017 13:43:14 +0000 (13:43 +0000)]
Fix a typo.

PR: 220917 (related)
Submitted by: fbsdbugs4 _at_ sentry dot org
Sponsored by: The FreeBSD Foundation

6 years agoMFC r320077
alc [Tue, 25 Jul 2017 03:43:00 +0000 (03:43 +0000)]
MFC r320077
  Change blist_alloc()'s allocation policy from first-fit to next-fit so
  that disk writes are more likely to be sequential.  This change is
  beneficial on both the solid state and mechanical disks that I've
  tested.  (A similar change in allocation policy was made by DragonFly
  BSD in 2013 to speed up Poudriere with "stressful memory parameters".)

  Increase the width of blst_meta_alloc()'s parameter "skip" and the local
  variables whose values are derived from it to 64 bits.  (This matches the
  width of the field "skip" that is stored in the structure "blist" and
  passed to blst_meta_alloc().)

  Eliminate a pointless check for a NULL blist_t.

  Simplify blst_meta_alloc()'s handling of the ALL-FREE case.

  Address nearby style errors.

MFC r320417
  Address the remaining integer overflow issues with the "skip" parameters
  and "next_skip" variables.  The "skip" value in struct blist has long been
  a 64-bit quantity but various functions have implicitly truncated this
  value to 32 bits.  Now, all arithmetic involving the "skip" value is 64
  bits wide.  (This should allow us to relax the size limit on a swap device
  in the swap pager.)

  Maintain the ability to test this allocator as a user-space application by
  including <stdbool.h>.

  Remove an unused variable from blst_radix_print().

MFC r320527
  Change blst_leaf_alloc() to handle a cursor argument, and to improve
  performance.

  To find in the leaf bitmap all ranges of sufficient length, use a doubling
  strategy with shift-and-and until each bit still set represents a bit
  sequence of length 'count', or until the bitmask is zero.  In the latter
  case, update the hint based on the first bit sequence length not found to
  be available.  For example, seeking an interval of length 12, the set bits
  of the bitmap would represent intervals of length 1, then 2, then 3, then
  6, then 12.  If no bits are set at the point when each bit represents an
  interval of length 6, then the hint can be updated to 5 and the search
  terminated.

  If long-enough intervals are found, discard those before the cursor.  If
  any remain, use binary search to find the position of the first of them,
  and allocate that interval.

6 years agoInclude stdbool.h for r321447.
markj [Tue, 25 Jul 2017 00:30:25 +0000 (00:30 +0000)]
Include stdbool.h for r321447.

This is a direct commit to stable/11.

6 years agoMFC r320896:
markj [Tue, 25 Jul 2017 00:28:29 +0000 (00:28 +0000)]
MFC r320896:
Add a subroutine for comparing kerneldump identifiers.

6 years agoMFC r321356:
markj [Mon, 24 Jul 2017 16:24:22 +0000 (16:24 +0000)]
MFC r321356:
Fix top(1) output when zfs.ko is loaded but ZFS is not in use.

6 years agoMFC r320918, r321035:
markj [Mon, 24 Jul 2017 16:23:28 +0000 (16:23 +0000)]
MFC r320918, r321035:
Have mkdumpheader() handle version string truncation.

6 years agoMFC r321207:
ken [Mon, 24 Jul 2017 14:42:43 +0000 (14:42 +0000)]
MFC r321207:
  ------------------------------------------------------------------------
  r321207 | ken | 2017-07-19 09:39:01 -0600 (Wed, 19 Jul 2017) | 14 lines

  Fix spurious timeouts on commands sent to mps(4) and mpr(4) controllers.

  mps_wait_command() and mpr_wait_command() were using getmicrotime() to
  determine elapsed time when checking for a timeout in polled mode.
  getmicrotime() isn't guaranteed to monotonically increase, and that
  caused spurious timeouts occasionally.

  Switch to using getmicrouptime(), which does increase monotonically.
  This fixes the spurious timeouts in my test case.

  ------------------------------------------------------------------------
Reviewed by: slm, scottl
Sponsored by: Spectra Logic

6 years agoMFC r302843:
mav [Mon, 24 Jul 2017 06:49:57 +0000 (06:49 +0000)]
MFC r302843:
Increase number of I/O APIC pins from 24 to 32 to give PCI up to 16 IRQs.

Move HPET to the top of the supported 0-31 range.

6 years agoMFC r305898, r309120, r309121 (by jceel):
mav [Mon, 24 Jul 2017 06:19:04 +0000 (06:19 +0000)]
MFC r305898, r309120, r309121 (by jceel):
Add virtio-console support to bhyve.

Adds virtio-console device support to bhyve, allowing to create
bidirectional character streams between host and guest.

Syntax:
-s <slotnum>,virtio-console,port1=/path/to/port1.sock,anotherport=...

Maximum of 16 ports per device can be created. Every port is named
and corresponds to an Unix domain socket created by bhyve. bhyve
accepts at most one connection per port at a time.

Limitations:
- due to lack of destructors of in bhyve, sockets on the filesystem
  must be cleaned up manually after bhyve exits
- there's no way to use "console port" feature, nor the console port
  resize as of now
- emergency write is advertised, but no-op as of now

6 years agoRevert unexpected changes leaked into r321411.
mav [Mon, 24 Jul 2017 06:07:44 +0000 (06:07 +0000)]
Revert unexpected changes leaked into r321411.

6 years agoMFC r302850: Make PCI interupts allocation static when using bootrom (UEFI).
mav [Mon, 24 Jul 2017 05:52:10 +0000 (05:52 +0000)]
MFC r302850: Make PCI interupts allocation static when using bootrom (UEFI).

This makes factual interrupt routing match one shipped with UEFI firmware.
With old firmware this make legacy interrupts work reliable for functions 0
of PCI slots 3-6.  Updated UEFI image fixes problem completely.

6 years agoMFC 321286
sephe [Mon, 24 Jul 2017 01:39:58 +0000 (01:39 +0000)]
MFC 321286

    hyperv/storvsc: Force SPC3 for CDROM attached.

    This unbreaks the CDROM attaching on GEN2 VMs.  On GEN1 VMs, CDROM is
    attached to emulated ATA controller.

    PR:             220790
    Submitted by:   Hongjiang Zhang <honzhan microsoft com>
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11634

6 years agoMFC r316603,r321214:
ngie [Sun, 23 Jul 2017 18:13:19 +0000 (18:13 +0000)]
MFC r316603,r321214:

r316603:

META_MODE: add additional reachover relative paths to DIRDEPS_BUILD

These additional entries are being added, after their addition to the
source tree.

r321214:

Update targets/pseudo/tests/Makefile.depend after recent additions/subtractions
from the FreeBSD test suite.

MFC with: r316603

6 years agoMFC r321240:
ngie [Sun, 23 Jul 2017 18:00:03 +0000 (18:00 +0000)]
MFC r321240:

cron(8) manpage updates

- Document /etc/cron.d and /usr/local/etc/cron.d under FILES.
- Reword documentation for -n: add appropriate soft-stop and remove
  contraction to appease igor.

6 years agoMFC r319905
alc [Sat, 22 Jul 2017 17:23:13 +0000 (17:23 +0000)]
MFC r319905

Reduce the frequency of hint updates on allocation without incurring
additional allocation overhead.  Previously, blst_meta_alloc() updated the
hint after every successful allocation.  However, these "eager" hint
updates are of no actual benefit if, instead, the "lazy" hint update at
the start of blst_meta_alloc() is generalized to handle all cases where
the number of available blocks is less than the requested allocation.
Previously, the lazy hint update at the start of blst_meta_alloc() only
handled the ALL-FULL case.  (I would also note that this change provides
consistency between blist_alloc() and blist_fill() in that their hint
maintenance is now entirely lazy.)

Eliminate unnecessary checks for terminators in blst_meta_alloc() and
blst_meta_fill() when handling ALL-FREE meta nodes.

Eliminate the field "bl_free" from struct blist.  It is redundant.  Unless
the entire radix tree is a single leaf, the count of free blocks is stored
in the root node.  Instead, provide a function blist_avail() for obtaining
the number of free blocks.

In blst_meta_alloc(), perform a sanity check on the allocation once rather
than repeating it in a loop over the meta node's children.

In blst_leaf_fill(), use the optimized bitcount*() function instead of a
loop to count the blocks being allocated.

Add or improve several comments.

Address some nearby style errors.

6 years agoMFC r320319
alc [Sat, 22 Jul 2017 16:58:47 +0000 (16:58 +0000)]
MFC r320319
  Increase the pageout cluster size to 32 pages.

  Decouple the pageout cluster size from the size of the hash table entry
  used by the swap pager for mapping (object, pindex) to a block on the
  swap device(s), and keep the size of a hash table entry at its current
  size.

  Eliminate a pointless macro.

6 years agoMFC r320240:
ed [Sat, 22 Jul 2017 14:03:20 +0000 (14:03 +0000)]
MFC r320240:

  Use __ISO_C_VISIBLE, as opposed to testing __STDC_VERSION__.

  FreeBSD's C library uses __STDC_VERSION__ to determine whether the
  compiler provides language features specific to a certain version of the
  C standard. __ISO_C_VISIBLE is used to specify which library features
  need to be exposed.

  max_align_t currently uses __STDC_VERSION__, even though it should be
  using __ISO_C_VISIBLE to remain consistent with the rest of the headers
  in include/.

6 years agoMFC r321023:
bcr [Sat, 22 Jul 2017 10:15:11 +0000 (10:15 +0000)]
MFC r321023:

The ctladm man page incorrectly duplicated the text for the
delete subcommand in the modify section. Rewrite the
modify description text in two places to say modify/modified
instead of remove/removed.

PR: 220710
Submitted by: sseekamp@risei.net
Reviewed by: mav@
Differential Revision: https://reviews.freebsd.org/D11608

6 years agoMFC r319756
alc [Sat, 22 Jul 2017 07:09:38 +0000 (07:09 +0000)]
MFC r319756
  Style and comment fixes

6 years agoMFC r320546
alc [Sat, 22 Jul 2017 06:36:27 +0000 (06:36 +0000)]
MFC r320546
  When "force" is specified to pmap_invalidate_cache_range(), the given
  start address is not required to be page aligned.  However, the loop
  within pmap_invalidate_cache_range() that performs the actual cache
  line invalidations requires that the starting address be truncated to
  a multiple of the cache line size.  This change corrects an error in
  that truncation.

6 years agoMFC r315621
alc [Sat, 22 Jul 2017 05:26:29 +0000 (05:26 +0000)]
MFC r315621
  Use IDX_TO_OFF(), not ptoa(), when converting the difference between two
  vm_pindex_t's into a vm_ooffset_t.

  The length given to shm_dotruncate() must never be negative.  Assert this.

  Tidy up a comment.

6 years agoMFC r320498
alc [Sat, 22 Jul 2017 04:20:08 +0000 (04:20 +0000)]
MFC r320498
  Clear the MAP_WIREFUTURE flag on the vm map in exec_new_vmspace() when it
  recycles the current vm space.  Otherwise, an mlockall(MCL_FUTURE) could
  still be in effect on the process after an execve(2), which violates the
  specification for mlockall(2).

  It's pointless for vm_map_stack() to check the MEMLOCK limit.  It will
  never be asked to wire the stack.  Moreover, it doesn't even implement
  wiring of the stack.

6 years agoMFC r315597
alc [Sat, 22 Jul 2017 03:54:04 +0000 (03:54 +0000)]
MFC r315597
  Style fixes.  In particular, the variable "bogus" is used like a Boolean.
  Define it as such.

6 years agoMFC r319876:
kib [Fri, 21 Jul 2017 18:14:06 +0000 (18:14 +0000)]
MFC r319876:
Update scescx test to print syscall number and arguments.

6 years agoMFC r319875:
kib [Fri, 21 Jul 2017 18:12:35 +0000 (18:12 +0000)]
MFC r319875:
Add ptrace(PT_GET_SC_ARGS) command to return debuggee' current syscall
arguments.

6 years agoMFC r319874:
kib [Fri, 21 Jul 2017 18:10:46 +0000 (18:10 +0000)]
MFC r319874:
Print unimplemented syscall number to the ctty on SIGSYS, if enabled
by the knob kern.lognosys.

6 years agoMFC r319873:
kib [Fri, 21 Jul 2017 18:06:57 +0000 (18:06 +0000)]
MFC r319873:
Move struct syscall_args syscall arguments parameters container into
struct thread.

6 years agoMFC r320273:
bdrewery [Fri, 21 Jul 2017 17:57:59 +0000 (17:57 +0000)]
MFC r320273:

  Allow ALWAYS_BOOTSTRAP_MAKE to force bmake bootstrapping.

6 years agoMFC r320292:
bdrewery [Fri, 21 Jul 2017 17:57:10 +0000 (17:57 +0000)]
MFC r320292:

  NO_ROOT: Remove excessive // when DESTDIR/DISTDIR are empty.

6 years agoMFC r320883:
bdrewery [Fri, 21 Jul 2017 17:56:22 +0000 (17:56 +0000)]
MFC r320883:

  Fix INSTALL_AS_USER after r319020.

6 years agoMFC r320806:
bdrewery [Fri, 21 Jul 2017 17:55:40 +0000 (17:55 +0000)]
MFC r320806:

  SYSTEM_COMPILER: Ensure there is not a stale compiler in WORLDTMP.

6 years agoMFC r319871:
kib [Fri, 21 Jul 2017 06:56:06 +0000 (06:56 +0000)]
MFC r319871:
Make struct syscall_args visible to userspace compilation environment
from machine/proc.h, consistently on all architectures.

6 years agoMFC r321173:
kib [Fri, 21 Jul 2017 06:52:40 +0000 (06:52 +0000)]
MFC r321173:
Convert assertion that only vmspace owner grows the stack, into a
check blocking grow from other processes accesses.

MFC r321230:
Disable stack growth when accessed by AIO daemons.

6 years agoMFC r320982:
kib [Fri, 21 Jul 2017 06:48:47 +0000 (06:48 +0000)]
MFC r320982:
Correct sysent flags for dynamically loaded syscalls.

6 years agoPrune one more missed entry from 11.0-RELEASE.
gjb [Thu, 20 Jul 2017 23:57:01 +0000 (23:57 +0000)]
Prune one more missed entry from 11.0-RELEASE.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years ago- Fix the 'release.prev' entity for the 11.1-RELEASE errata.
gjb [Thu, 20 Jul 2017 23:54:18 +0000 (23:54 +0000)]
- Fix the 'release.prev' entity for the 11.1-RELEASE errata.
- Prune stale entries from 11.0-RELEASE.
- Bump copyright year.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years ago- Set stable/11 from -PRERELEASE back to -STABLE.
gjb [Thu, 20 Jul 2017 23:44:39 +0000 (23:44 +0000)]
- Set stable/11 from -PRERELEASE back to -STABLE.
- Update version entities in release.ent.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r320927,320931,320932:
mm [Thu, 20 Jul 2017 20:15:38 +0000 (20:15 +0000)]
MFC r320927,320931,320932:
Bump libarchive to 3.3.2

Vendor changes:
  PR #901: don't depend on stdin in a testcase

Relnotes: yes

6 years agoRevert r316779:
pfg [Thu, 20 Jul 2017 17:22:10 +0000 (17:22 +0000)]
Revert r316779:
Remove (yet again) the definition for the GCC __nonnull() attribute.

While GCC's __nonnull__ attribute is generally useful to prevent misuse of
some functions it also tends to do rather dangerous "optimizations". Now
that we have replaced all such uses with the clang nullability qualifiers,
the GCC attribute is unnecessary.

The version was left around and kept for 11.1-Release for old
versions of GCC from ports. Newer versions of GCC are not attempting to
"fix" the system includes so this should not have any side effect and
matches what we do in -current.

6 years agoMFC r312943
kp [Thu, 20 Jul 2017 17:15:18 +0000 (17:15 +0000)]
MFC r312943

Do not run the pf purge thread while the VNET variables are not
initialized, this can cause a divide by zero (if the VNET initialization
takes to long to complete).

PR: 220830

6 years agoMFC r320729: Add GEOM::descr attribute for symmetry with GEOM::ident.
mav [Thu, 20 Jul 2017 11:36:25 +0000 (11:36 +0000)]
MFC r320729: Add GEOM::descr attribute for symmetry with GEOM::ident.

6 years agoMFC r320267, r320270-r320271, r320478
bapt [Thu, 20 Jul 2017 08:11:06 +0000 (08:11 +0000)]
MFC r320267, r320270-r320271, r320478

r320267:
Do not use sprintf(3) when not needed, while here,
prefer snprintf(3) over sprintf(3)

r320270:
Directly print the extra status instead of filling a buffer
then printing it.

This prepares the code to make it libxo friendly

Reviewed by: manu, Nikita Kozlov (nikita elyzion.net)
Sponsored by: Gandi.net

r320271:
sesutil no longer depends on libsbuf

Sponsored by: Gandi.net

r320478:
Add libxo(3) support to sesutil(8)

This is useful to simplify parsing "sesutil map"

Submitted by: nikita.kozlov@blade-group.com
Relnotes: yes
Reviewed by: Allanjude, bapt
Differential revision: https://reviews.freebsd.org/D11372
Sponsored by: blade

6 years agoMFC r320936,r320937,r320938:
kib [Thu, 20 Jul 2017 06:54:58 +0000 (06:54 +0000)]
MFC r320936,r320937,r320938:
Fix size argument to vm_pager_allocate().

6 years agoMFC r314543:
ngie [Thu, 20 Jul 2017 01:07:51 +0000 (01:07 +0000)]
MFC r314543:

Add missing section when referencing ctl(4) via .Xr macro

6 years agoMFC r314475:
ngie [Thu, 20 Jul 2017 01:07:15 +0000 (01:07 +0000)]
MFC r314475:

Simplify idioms in usr.sbin/lpr Makefiles

Use :H instead of .CURDIR-relative pathing to simplify make output, etc.

6 years agoMFC r314454,r314455:
ngie [Thu, 20 Jul 2017 01:03:43 +0000 (01:03 +0000)]
MFC r314454,r314455:

r314454:

Use .ALLSRC instead of RPCSRC

This is a trivial simplification in the Makefile, meant to serve as
a good example for what to do with rules like this.

r314455:

Use .ALLSRC instead of RPCSRC

This is a trivial simplification in the Makefile, meant to serve as
a good example for what to do with rules like this.

6 years agoMFC r314479:
ngie [Thu, 20 Jul 2017 01:02:30 +0000 (01:02 +0000)]
MFC r314479:

Use :H to manipulate .CURDIR-relative paths instead of ../

This simplifies make output

6 years agoMFC r314653:
ngie [Thu, 20 Jul 2017 00:58:19 +0000 (00:58 +0000)]
MFC r314653:

libexec: normalize paths using SRCTOP-relative paths or :H when possible

This simplifies make logic/output

6 years agoMFC r314654:
ngie [Thu, 20 Jul 2017 00:53:50 +0000 (00:53 +0000)]
MFC r314654:

cddl: normalize paths using SRCTOP-relative paths or :H when possible

This simplifies make logic/output

While here, remove bogus CFLAGS which look for headers in cddl/lib/libumem.
There aren't any source files there (just Makefiles)

6 years agoMFC r314893:
ngie [Thu, 20 Jul 2017 00:50:01 +0000 (00:50 +0000)]
MFC r314893:

usr.bin/fortune: convert to OBJTOP/SRCTOP idioms

- Use OBJTOP/SRCTOP-relative paths when looking for include files and
  strfile.
- Add FORTUNES_OBJ and FORTUNES_SRC to abbreviate usr.bin/fortune
  pathing.

This is being done to simplify make output/idioms.

6 years agoMFC r316102:
ngie [Thu, 20 Jul 2017 00:47:50 +0000 (00:47 +0000)]
MFC r316102:

Wrap bootcamp DEBUG statement with curly braces

This fixes a -Wempty-body warning with gcc 6.3.0 when PART_DEBUG is undefined.

Tested with: amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)

6 years agoMFC r318960,r319545,r319546,r319548,r321261:
ngie [Thu, 20 Jul 2017 00:41:46 +0000 (00:41 +0000)]
MFC r318960,r319545,r319546,r319548,r321261:

r318960 (by dab):

Add newsyslog capability to write RFC5424 compliant rotation message.

This modification adds the capability to newsyslog to write the
rotation message in a format that is compliant with RFC5424. This
capability is enabled on a per-log file basis through a new value
("T") in the flags field in newsyslog.conf. This is useful on systems
that use the RFC5424 format for log files so that the rotation message
format matches that of the other log messages. There has been recent
mention of adding an RFC5424 compliant mode to syslogd and at least
one alternative system log daemon (rsyslogd) that already has the
capability to use that format.

Relnotes: yes

r319545:

Don't execute the TODO cases in a subshell

This messes up the testcase counter, as seen in bug 219756.

PR: 212160, 219756

r319546:

Fix the testplan after ^/head@r318960

The number of executed testcases is 128, not 126.

MFC with: r318960

r319548:

Remove TODO for sub testcases added for bug 212160

On closer inspection, the past failures no longer occur on ^/head.

PR: 212160

r321261:

Clean up leading whitespace (convert single column spaces to hard tabs)

6 years agoMFC r320135:
ngie [Thu, 20 Jul 2017 00:33:04 +0000 (00:33 +0000)]
MFC r320135:

periodic(8): delete trailing whitespace

6 years agoMFC note: only the newsyslog.conf.d change has been backported to unbreak
ngie [Wed, 19 Jul 2017 21:06:31 +0000 (21:06 +0000)]
MFC note: only the newsyslog.conf.d change has been backported to unbreak
"make distribution" with etc/newsyslog.conf.d/opensm.conf
installation. The cron.d and syslog.d changes were omitted by
request to avoid churn on ^/stable/{10,11}.
Requested by: jhb, peter

MFC r318545:

Install {cron.d,newsyslog.conf.d,syslog.d} via `make distribution`, not `make install`

I incorrectly started this pattern in r277541 with the opensm newsyslog.conf.d file,
and continued using it in r318441 and r318443.

This will fix the files being handled improperly via installworld, preventing tools like
etcupdate, mergemaster, etc from functioning properly when comparing the installed
contents on a system vs the contents in a source tree when doing merges.

PR: 219404
MFC with: r277541, r318441, r318443

6 years agoMFC note: content changes of r317315 were reversed. .Dd is being updated
ngie [Wed, 19 Jul 2017 20:58:45 +0000 (20:58 +0000)]
MFC note: content changes of r317315 were reversed. .Dd is being updated
for diff reduction purposes.

MFC r317315,r317437:

r317315:

Note that getpagesize(3) can return -1 on failure

r317437 (by kib):

getpagesize(3) cannot fail.

6 years agoMFC r316818:
ngie [Wed, 19 Jul 2017 20:49:04 +0000 (20:49 +0000)]
MFC r316818:

Conditionally install /etc/pam.d/ftp* and /etc/pam.d/telnetd

/etc/pam.d/ftp* should be installed with MK_FTP != no and
/etc/pam.d/telnetd should be installed when MK_TELNET != no.

6 years agoMFC r310329:
ngie [Wed, 19 Jul 2017 20:22:16 +0000 (20:22 +0000)]
MFC r310329:
r310329 (by cem):

Add a 'force' option for non-interactive crontab removal

Add a '-f' option to force crontab '-r' to be non-interactive.

6 years agoMFC r321235:
ngie [Wed, 19 Jul 2017 19:39:26 +0000 (19:39 +0000)]
MFC r321235:

Fix trivial whitespace bug introduced in usage message changes for -n
support (r304570).

6 years agoMFC r316076:
ngie [Wed, 19 Jul 2017 19:06:19 +0000 (19:06 +0000)]
MFC r316076:

sys/boot/common: Make geli(4) support optional in MI sources

This saves a negligible amount of memory for non-geli enabled
bootloaders.

6 years agoMFC note: content changes based on r309745 not included.
ngie [Wed, 19 Jul 2017 19:02:06 +0000 (19:02 +0000)]
MFC note: content changes based on r309745 not included.

MFC r315799:

counter(9): fix igor/manlint warnings

- Reword description of `counter_enter` slightly to fix
  wordiness [1].
- Expand "isn't" as "is not" [1].
- Add missing section number with .Xr sysctl calls [2].