Don't validate cache/spares for readonly pools

When a pool is imported read-only avoid validating any hot spare
and l2arc vdevs.  The validation process can result in the vdev
being reinitialized and a new label being written.  Since the pool
must never be written to the unexpected write IO correctly triggers
a VERIFY in the IO pipeline.

  zpool import -o readonly <pool>
  ...
  VERIFY(zio->io_type != ZIO_TYPE_WRITE || spa_writeable(spa)) failed
  SPLError: 9415:0:(zio.c:2613:zio_vdev_io_start()) SPL PANIC

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #1863
Some nvlist allocations in hold processing need to use KM_PUSHPAGE.

Commit 95fd54a1c5b93bb2aa3e7dffc28c784b1e21a8bb restructured the
hold/release processing and moved some of the work into the sync task.
A number of nvlist allocations now need to use KM_PUSHPAGE.
Fix rollback of mounted filesystems as broken by Illumos #3875 patch.

The Illumos #3875 patch reverted a part of ZoL's 7b3e34b which added
special-case error handling for zfs_rezget().  The error handling dealt
with the case  in which an all-ones object number ended up being passed
to dnode_hold() and causing an EINVAL to be returned from zfs_rezget().
Bump release to indicate some cherry-picking.
ZFS Crypto now checks for checksum errors which was caused by
odler version of zfs-crypto. Disable this by setting the optional
module parameter 'zfs_crypto_ignore_checksum_errors'.
Document the change in verifying MAC checksums and how to
mount a previously created crypted filesystem.
More details around this at https://github.com/zfsrogue/zfs-crypto/issues/34
Fix rollback of mounted filesystem regression

The Illumos #3875 patch reverted a part of ZoL's 7b3e34b which added
special-case error handling for zfs_rezget().  The error handling dealt
with the case in which an all-ones object number ended up being passed
to dnode_hold() and causing an EINVAL to be returned from zfs_rezget().

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1859
Closes #1861
Some nvlist allocations in hold processing need to use KM_PUSHPAGE.

Commit 95fd54a1c5b93bb2aa3e7dffc28c784b1e21a8bb restructured the
hold/release processing and moved some of the work into the sync task.
A number of nvlist allocations now need to use KM_PUSHPAGE.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1852
Closes #1855
Reduce stack for traverse_visitbp() recursion

During pool import stack overflows may still occur due to the
potentially deep recursion of traverse_visitbp().  This is most
likely to occur when additional layers are added to the block
device stack such as DM multipath.  To minimize the stack usage
for this call path the following changes were made:

1) Added the keywork 'noinline' to the vdev_*_map_alloc() functions
   to prevent them from being inlined by gcc.  This reduced the
   stack usage of vdev_raidz_io_start() from 208 to 128 bytes, and
   vdev_mirror_io_start() from 144 to 128 bytes.

2) The 'saved_poolname' charater array in zfsdev_ioctl() was moved
   from the stack to the heap.  This reduced the stack usage of
   zfsdev_ioctl() from 368 to 112 bytes.

3) The major saving came from slimming down traverse_visitbp() from
   from 224 to 144 bytes.  Since this function is called recursively
   the 80 bytes saved per invokation adds up.  The following changes
   were made:

  a) The 'hard' local variable was replaced by a TD_HARD() macro.

  b) The 'pd' local variable was replaced by 'td->td_pfd' references.

  c) The zbookmark_t was moved to the heap.  This does cost us an
     additional memory allocation per recursion by that cost should
     still be minimal.  The cost could be further reduced by adding
     a dedicated zbookmark_t slab cache.

  d) The variable declarations in 'if (BP_GET_LEVEL()) { }' were
     restructured to use the minimum amount of stack.  This includes
     removing the 'cbp' local variable.

Overall for the offending use case roughly 1584 of total stack space
has been saved.  This is enough to avoid overflowing the stack on
stock kernels with 8k stacks.  See #1778 for additional details.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Closes #1778
Fixes (extends) support for selinux xattrs to more inode types

Properly initialize SELinux xattrs for all inode types.  The
initial implementation accidentally only did this for files.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1832
Tighten zfs dependency on zfs-kmod

Make zfs depend on the same version of zfs-kmod, rather than on same or
better. When yum repository contains a number of versions the dependency
resolution breaks on trying to install non-latest version.

Signed-off-by: Cyril Plisko <cyril.plisko@mountall.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1677
Remove the slog restriction on bootfs pools

Under Linux this restriction does not apply because we have access
to all the required devices.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1631
Merge branch 'master' of git://github.com/zfsonlinux/zfs into 0.6.3_turbo

Conflicts:

	module/zfs/dsl_userhold.c
	rpm/generic/zfs.spec.in
Accept user specified spl and kernel source dir.
Document ZFS module parameters.
Closes: #1856
Add support for options to 'sharesmb'.
Fixes: #1182
+ Move nfs.c:foreach_nfs_shareopt() to libshare.c:foreach_shareopt()
  so that it can be (re)used in smb.c (and later iscsi.c).
+ Call net(8) with the guest_ok option.
+ Rewrite the sharesmb part of the zfs(8) manpage.
  + Add more examples
  + Inform about the (new) options to sharesmb.
+ Add STDERR_VERBOSE to libzfs_run_process() so that we
  can catch any errors from net(8).
+ Don't call smb_retrieve_shares() after enabling a share.
  No point, it's done when really needed anyway.
+ Support 'y', 'yes' and 'true' for guest_ok.
* If sharesmb=on, just exit cleanly directly at the top of
  get_smb_shareopts_cb().
* Remove param 2 and 3 from smb_enable_share_one(). That is
  availible in the first param - the impl_share struct.
* Extra debugging added in smb_enable_share_one() - print
  all our options just before we call net(8).
Add support for optional, extra script /sbin/zfs_share_smb
to run after shareing is done.
Make sure 'everyone' knows about changes to the sharetab.
+ Instead of opening a temporary sharetab and then renaming
  it, just open it with freopen() writeable and write the info.
Don't open sharetab in parse_sharetab() - it's already open!
+ Reuse the handle, fseek to beginning and read...
The option sharesmb should not be inherited by childs.
Samba is perfectly able to show child file systems...
Use dataset name in comment, not the smb share name.