=> 3693: turbo/illumos-3693 - restore_object uses at least two transactions to restore an object

restore_object uses at least two transactions to restore an object:

  * one transaction is used for dmu_object_claim
  * another transaction is used to set compression, checksum and most
    importantly bonus data
  * furthermore dmu_object_reclaim internally uses multiple transactions
  * dmu_free_long_range frees chunks in separate transactions
  * dnode_reallocate is executed in a distinct transaction

The fact the dnode_allocate/dnode_reallocate are executed in one
transaction and bonus (re-)population is executed in a different
transaction may lead to violation of ZFS consistency assertions if the
transactions are assigned to different transaction groups.  Also, if
the first transaction group is successfully written to a permanent
storage, but the second transaction is lost, then an invalid dnode may
be created on the stable storage.

Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: George Wilson george.wilson@delphix.com

Original authors: Matthew Ahrens and Andriy Gapon

References:
  https://www.illumos.org/projects/illumos-gate//issues/3693
  https://reviews.csiden.org/r/90

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5116: turbo/illumos-5116 - zpool history -i goes into infinite loop

5116 zpool history -i goes into infinite loop
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Richard Elling <richard.elling@gmail.com>
Reviewed by: Boris Protopopov <boris.protopopov@me.com>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/5116
  https://github.com/illumos/illumos-gate/commit/3339867

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5134: turbo/illumos-5134 - if ZFS_DEBUG or debug= is set, libzpool should enable debug prints

Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: Adam Leventhal adam.leventhal@delphix.com

References:
  https://www.illumos.org/projects/illumos-gate/issues/5134
  https://github.com/illumos/illumos-gate/commit/7fa49ea

Porting notes:
  Run dprintf_setup() in main.

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5135: turbo/illumos-5135 - zpool_find_import_cached() can use fnvlist_*

Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Richard Elling <richard.elling@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/5135
  https://github.com/illumos/illumos-gate/commit/b18d6b0

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5138: turbo/illumos-5138 - add tunable for maximum number of blocks freed in one txg

Reviewed by: Mattew Ahrens mahrens@delphix.com
Reviewed by: Adam Leventhal adam.leventhal@delphix.com

References:
  https://www.illumos.org/projects/illumos-gate//issues/5138
  https://reviews.csiden.org/r/85/

Porting notes:

Look for it (param_ops_ullong) and depending on that use uint64_t/ullong
for kernels >= v3.17-rc1 where it was introduced and ulong/ulong otherwise
for the zfs_free_max_blocks variable.

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5139: turbo/illumos-5139 - SEEK_HOLE failed to report a hole at end of file

5139 SEEK_HOLE failed to report a hole at end of file
Reviewed by: Adam Leventhal <adam.leventhal@delphix.com>
Reviewed by: Alex Reece <alex.reece@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Peng Dai <peng.dai@delphix.com>
Reviewed by: Richard Elling <richard.elling@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/5139
  https://github.com/illumos/illumos-gate/commit/0fbc0cd

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5140: turbo/illumos-5140 - message about "%recv could not be opened" is printed when booting after crash

Reviewed by: George Wilson george.wilson@delphix.com
Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: Max Grossman max.grossman@delphix.com

References:
  https://www.illumos.org/projects/illumos-gate//issues/5140
  https://github.com/illumos/illumos-gate/commit/2243853

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5147: turbo/illumos-5147 - zpool list -v should show individual disk capacity

The 'zpool list -v' command displays lots of info but excludes the
capacity of each disk. This should be added.

Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: Adam Leventhal adam.leventhal@delphix.com
Reviewed by: Matthew Ahrens matthew.ahrens@delphix.com

References:
  https://www.illumos.org/projects/illumos-gate//issues/5147
  https://reviews.csiden.org/r/89

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5150: turbo/illumos-5150 - zfs clone of a defer_destroy snapshot causes strangeness

When a clone is created of a snapshot that has been marked for
deferred destroy (with "zfs destroy -d"), the clone "inherits" the
defer_destroy flag from the origin, and any snapshots of the clone
"inherit" the defer_destroy flag from the clone. This causes a strange
situation where the clone's snapshots are marked for defer_destroy but
they have no holds or clones. If the clone's snapshot gets a hold or
clone, which is then deleted, we will honor the incorrectly-set
defer_destroy flag and delete the snapshot!

Steps to reproduce:

  * zpool create test c1t1d0
  * zfs create test/fs
  * zfs snapshot test/fs@a
  * zfs clone test/fs@a test/clone
  * zfs destroy -d test/fs@a
  * zfs clone test/fs@a test/clone2
  * zfs snapshot test/clone2@a
  * zfs hold hld test/clone2@a
  * zfs release hld test/clone2@a
  * zfs list -r -t all test

  <test/clone2@a has been destroyed>

We noticed that this causes dcenter to get very confused, because it
treats snapshots that are marked defer_destroy as not existing. So it
won't see any snapshots of the clone that's marked defer_destroy.

Reviewed by: George Wilson george.wilson@delphix.com
Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: Max Grossman max.grossman@delphix.com

Original author: Matthew Ahrens

References:
  https://www.illumos.org/projects/illumos-gate//issues/5150
  https://reviews.csiden.org/r/93/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5161: turbo/illumos-5161 - add tunable for number of metaslabs per vdev

5161 add tunable for number of metaslabs per vdev
Reviewed by: Alex Reece alex.reece@delphix.com\
Reviewed by: George Wilson george.wilson@delphix.com\
Reviewed by: Christopher Siden christopher.siden@delphix.com\
Reviewed by: Paul Dagnelie paul.dagnelie@delphix.com\

References:
  https://www.illumos.org/issues/5161
  https://reviews.csiden.org/r/95/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5162: turbo/illumos-5162 - zfs recv should use loaned arc buffer to avoid copy

5162 zfs recv should use loaned arc buffer to avoid copy
Reviewed by: George Wilson george.wilson@delphix.com\
Reviewed by: Christopher Siden christopher.siden@delphix.com\

References:
  https://www.illumos.org/issues/5162
  https://reviews.csiden.org/r/96/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5164+5165: turbo/illumos-5164+5165 - space_map fixes

5164 space_map_max_blksz causes panic, does not work
5165 zdb fails assertion when run on pool with recently-enabled spacemap_histogram feature
Reviewed by: George Wilson george.wilson@delphix.com
Reviewed by: Christopher Siden christopher.siden@delphix.com

References:
  https://www.illumos.org/issues/5164
  https://www.illumos.org/issues/5165
  https://reviews.csiden.org/r/98/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5169-5171: turbo/illumos-5169-5171 - zdb fixes

5169 zdb should limit its ARC size
5170 zdb -c should create more scrub i/os by default
5171 zdb should print status while loading metaslabs for leak detection
Reviewed by: George Wilson george.wilson@delphix.com\
Reviewed by: Paul Dagnelie paul.dagnelie@delphix.com\
Reviewed by: Christopher Siden christopher.siden@delphix.com\

References:
  https://www.illumos.org/issues/5169
  https://www.illumos.org/issues/5170
  https://www.illumos.org/issues/5171
  https://reviews.csiden.org/r/100/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5174: turbo/illumos-5174 - add sdt probe for blocked read in dbuf_read()

5174 add sdt probe for blocked read in dbuf_read()
Reviewed by: Matthew Ahrens mahrens@delphix.com
Reviewed by: Basil Crow basil.crow@delphix.com

References:
  https://www.illumos.org/issues/5174
  https://reviews.csiden.org/r/101/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5176: turbo/illumos-5176 - lock contention on godfather zio

5176 lock contention on godfather zio
Reviewed by: Alex Reece alex.reece@delphix.com
Reviewed by: George Wilson george.wilson@delphix.com
Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: Adam Leventhal ahl@delphix.com

References:
  https://www.illumos.org/issues/5176
  https://reviews.csiden.org/r/103/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5177: turbo/illumos-5177 - remove dead code from dsl_scan.c

5177 remove dead code from dsl_scan.c
Reviewed by: George Wilson george.wilson@delphix.com
Reviewed by: Christopher Siden christopher.siden@delphix.com

References:
  https://www.illumos.org/issues/5177
  https://reviews.csiden.org/r/104/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5178: turbo/illumos-5178 - zdb -vvvvv on old-format pool fails in dump_deadlist()

5178 zdb -vvvvv on old-format pool fails in dump_deadlist()
Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: George Wilson george.wilson@delphix.com

References:
  https://www.illumos.org/issues/5178
  https://reviews.csiden.org/r/105/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 1350: behlendorf/issue-1350 - Adds support for property overrides

Adds support for property overrides (-o property=value), property
excludes (-x property) and dataset limits (-l <volume|filesystem>)
to zfs receive.

Both -o and -x options mirror the functionality already available
in Oracle's ZFS implementation which is also mentioned in the
upstream feature request #2745:

The -l option allows receive to be limited to specific datasets within
the stream effectively allowing partial restores from a multi dataset
stream.

References:
  https://www.illumos.org/issues/2745

Ported-by: Milan-Benes
Issue #1350

NOTES: Man page updates missing and must be added, see patch:
http://blog.multiplay.co.uk/dropzone/freebsd/zfs-recv-properties.patch
=> 2338: hybridcluster/zfs-send-p-fix-71011260 - zfs send -p send properties only for snapshots that are actually sent.

zfs send -p send properties only for snapshots that are actually sent

... as opposed to sending properties of all snapshots of the relevant
filesystem.  The previous behavior results in properties being set on
all snapshots on the receiving side, which is quite slow.
More details are here:
  http://thread.gmane.org/gmane.comp.file-systems.openzfs.devel/346

Behavior of zfs send -R is not changed.

send_iterate_fs: orderly iterate snapshots

The previous commit depends on ordered iteration of the snapshots,
otherwise the code won't be able to correctly detect snapshots
that fall into the requested snapshot range.

This commit can be considered a partial cherry-pick of commit
freebsd/freebsd@4995789cde5 where ordered iteration was introduced
to fix a different problem.
We might want to pick up the complete fix eventually.
=> 2479: bprotopopov/zvol-scale - zvol_create_minors(): check snapdev before traversing snapshots