MFV r261619:

4574 get_clones_stat does not call zap_count in non-debug kernel

zap_count(...) is never called in non-DEBUG kernel.
As result "count" variable is always 0, and "goto fail" is always
reached.  This means get_clones_stat function never makes up list
of clones for "clones" properties.

MFC after:	2 weeks

(cherry picked from commit 1dfe96a0666d48596f1932917c8135ad1f3c69c7)
- Allow to change vfs.zfs.arc_meta_limit at runtime.
- Change vfs.zfs.arc_meta_used from CTLFLAG_RDTUN to CTLFLAG_RD, as it is
  not a tunable.

MFC after:	3 days

(cherry picked from commit 6cd4b91f813aa3c0e4d3486fddf5dac445965cd2)
In ue_attach_post_task(), initialize curvnet to vnet0 before calling if_attach().
Before this patch, curvnet was NULL.
When the VIMAGE kernel option is enabled, this eliminates
kernel panics when USB ethernet devices are plugged in.

PR: 183835
Submitted by: Hiroo Oono <hiroo.ono at gmail dot com>

(cherry picked from commit 3e3bcb42369fce6f32aa711d1cb579ee8f374b37)
Juggle some internal symbols from our antique zlib (that originally came
in from kernel-pppd which is long gone) so that ZFS and DTRACE play nice.

This is a horrible hack to get freefall to compile, and is in dire need
of reconciliation.  This antique zlib-1.04 code needs to go away.
Fix build with 'crypto' and 'zfs' in the same kernel.  This was the path
of least pain I could find.
Chase down cryptodeflate.c change from r259109.
Allow (with a license warning) "options ZFS" to work in static kernels.

The 'make depend' rules have to use custom -I paths for the special compat
includes for the opensolaris/zfs headers.

This option will pull in the couple of files that are shared with dtrace,
but they appear to correctly use the MODULE_VERSION/MODULE_DEPEND rules
so loader should do the right thing, as should kldload.

Reviewed by:	pjd (glanced at)

Conflicts:
	sys/conf/files.amd64
	sys/conf/files.mips
	sys/conf/kern.pre.mk
Unbreak options ZFS after r236884.
Fix kernel build with options ZFS after r24571 (libzfs_core).

Submitted by:	Bjoern A. Zeeb <bz@FreeBSD.org>
Fix kernel build with options ZFS after r240868.
Add some more ZFS files.
In dmu_zfetch_stream_reclaim() replace division with multiplication and
move it out of the loop and lock.

(cherry picked from commit 8e1d7be31e296f665fdd2f296e636b0f48df92b9)
Include <vm/vm_param.h> for PA_LOCK_COUNT in order to fix kernel build
with options ZFS after r239065.
Make CTL block backend return proper error code for operations unsupposed
by the underlying device.

MFC after:	2 weeks

(cherry picked from commit a6a173909d79f12a0c86dcc0d1be7164392c427f)
Fix extremely slow operation with data digests enabled.  This was caused
by receive code waiting for data digest even when the data segment was
empty.  It didn't actually read it, but it waited until those four bytes
become available in the socket buffer, i.e. until any other PDU (such as NOP)
came in.

PR:		kern/185240
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 379b2b0f9aa593406dd96b85f183e2f1e49a9aab)
Fix a rare "truncated checksums" problem, which manifested like this:

WARNING: icl_pdu_check_data_digest: data digest check failed; got 0xf23b,
    should be 0xdb7f23b

Tested by:	Darcy Birkbeck
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d0cf88a92be080f09cbd053fbe48534485a2e377)
Fail connection upon receiving too large data segment.

Approved by:	re (glebius)
Sponsored by:	FreeBSD Foundation

(cherry picked from commit a111dd548bde80502ea143ef148b2ebf06c8bbc8)
Fix hang on reboot with active iSCSI connections.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 015cdc2535764e4ad04ba03731ed49daf21b0241)
Properly refuse handoff requests on already connected sessions.  Previously
this would result in dropping the session.

MFC after:	2 days
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 47cb60687b1d726069c7831a3ce3ca7cb091fc66)
The log_whatever() routines don't accept NULL for format strings,
so mark them as __printflike instead of __printf0like.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a2246187e5b593b6d37161db2df4ffaa082db84c)