Illumos #2619 and #2747

2619 asynchronous destruction of ZFS file systems
2747 SPA versioning with zfs feature flags
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <gwilson@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>

NOTE: The grub specific changes were not ported.  This change
must be made to the Linux grub packages.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Revert "Temporarily disable the reguid test."

This reverts commit d13524579162b35189804c357a63993be758b84c.
Since feature flags have now been merged we can apply the real
upstream fix from Illumos.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Illumos #3090 and #3102

3090 vdev_reopen() during reguid causes vdev to be treated as corrupt
3102 vdev_uberblock_load() and vdev_validate() may read the wrong label

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #939
Illumos #2762

2762 zpool command should have better support for feature flags
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>
Illumos #3086

3086 unnecessarily setting DS_FLAG_INCONSISTENT on async
destroyed datasets
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>
Illumos #3349

3349 zpool upgrade -V bumps the on disk version number, but leaves
the in version
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@nexenta.com>
Illumos #2619 and #2747

2619 asynchronous destruction of ZFS file systems
2747 SPA versioning with zfs feature flags
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <gwilson@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>

NOTE: The grub specific changes were not ported.  This change
must be made to the Linux grub packages.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Revert "Temporarily disable the reguid test."

This reverts commit d13524579162b35189804c357a63993be758b84c.
Since feature flags have now been merged we can apply the real
upstream fix from Illumos.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Illumos #3090 and #3102

3090 vdev_reopen() during reguid causes vdev to be treated as corrupt
3102 vdev_uberblock_load() and vdev_validate() may read the wrong label

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #939
Illumos #2762

2762 zpool command should have better support for feature flags
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>
Illumos #3086

3086 unnecessarily setting DS_FLAG_INCONSISTENT on async
destroyed datasets
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>
Illumos #3349

3349 zpool upgrade -V bumps the on disk version number, but leaves
the in version
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@nexenta.com>
Fix __zio_execute() asynchronous dispatch

To save valuable stack all zio's were made asynchronous when in the
tgx_sync_thread context or during pool initialization.  See commit
2fac4c2 for the original patch and motivation.

Unfortuantely, the changes to dsl_pool_sync_context() made by the
feature flags broke this logic causing in __zio_execute() to dispatch
itself infinitely when called during pool initialization.  This
commit refines the existing logic to specificly target only the two
cases we care about.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Merge remote-tracking branch 'behlendorf/feature-flags' into feature

Conflicts:
	cmd/ztest/ztest.c
	include/sys/dmu.h
	include/sys/fs/zfs.h
	include/sys/spa_impl.h
	lib/libzpool/Makefile.am
	module/zfs/Makefile.in
	module/zfs/dmu.c
	module/zfs/dsl_dataset.c
	module/zfs/spa.c
	module/zfs/zio.c
Add feature@encryption to crypto branch

Merge branch 'feature-flags' of https://github.com/behlendorf/zfs into feature

Conflicts:
	cmd/ztest/ztest.c
	include/sys/dmu.h
	include/sys/fs/zfs.h
	include/sys/spa_impl.h
	include/zfeature_common.h
	lib/libzpool/Makefile.am
	module/zfs/Makefile.in
	module/zfs/dmu.c
	module/zfs/dsl_dataset.c
	module/zfs/spa.c
	module/zfs/zfeature_common.c
	module/zfs/zio.c
Merge branch 'feature' of git://github.com/lundman/zfs-crypto into feature
Merge branch 'feature'