All callers of static method load_nvlist() in spa.c handles error case,
so there is no reason to assert that we won't hit an error, instead,
just return that error to caller and have the upper layer handle it.
Explicitly compare with 0.

Suggested by:	Matthew Ahrens
Fix missing unlock in persistent reservations code, which resulted in panics
with Hyper-V Failover Cluster.

Reviewed by:	ken@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Disable libwrap (TCP wrappers) support in rpcbind by default, introducing
new command line options -W, to enable it when needed.

On my tests this change by almost ten times improves rpcbind performance.

No objections:	many, net@

(cherry picked from commit 1e800dd8ab05cb2ace3c61684e7d9ece5dc68e9e)

Conflicts:
	UPDATING
Fix support for increased logical sector size (4K-native drives).

- Logical sector size is measured in words, not bytes.
- If physical sector is not bigger then logical sector, it does not mean
it should be set equal to 512 bytes, but set to logical sector.

PR:		misc/187269
Submitted by:	Ravi Pokala <rpokala@panasas.com>
MFC after:	1 week

(cherry picked from commit fe221d29bf0f99dc465137bf6fea3a92d8306375)
Do not retry on CAM_FUNC_NOTAVAIL error, but return immediately.

MFC after:	2 weeks

(cherry picked from commit 0ccab05dca8db600f308e9d70c0e91a7f2144ba3)
Print remote IP address when we hit an error.
Return proper error code for missing device.

This suppresses numerous error messages in boot logs.
Block support for Gen-I chips in mvs(4) drivers.

I hope legacy ata(4) may work better with those relict pieces, which
I would not find on market even several years ago.

Ticket:	#4524
Use strlcpy().  There should be no functional change.
The issue will be hit when a file has more than 2 variable-length SA
and the total SA size is larger than the bonus buffer's
length -  sizeof (blkptr_t), but less the bonus buffer's length.

In sa_find_sizes(), 'done' is set to TRUE if the SA size + header > the
bonus buffer's length - sizeof (blkptr_t), then hdrsize += sizeof(uint16_t)
will be skipped for the second variable-length SA.  If finally all SA can
fit in the bonus buffer and no spill block is needed, we will get a wrong
hdrsize.

Reproduction case:

touch 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
ln -s 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 file
setfacl -h -m u:root:rwx:allow,g:wheel:rwx:allow file

would trigger an assertion in zdb -vvv:

Assertion failed: (IS_SA_BONUSTYPE(bonustype) && SA_HDR_SIZE_MATCH_LAYOUT(hdr, tb) || !IS_SA_BONUSTYPE(bonustype) || (IS_SA_BONUSTYPE(bonustype) && hdr->sa_layout_info == 0)), file /usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c, line 1509.

Submitted by:	James Pan <jiaming.pan@yahoo.com>
Export the maxio field in the CAM XPT_PATH_INQ CCB in the isp(4)
driver.

This tells consumers up the stack the maximum I/O size that the
controller can handle.

The I/O size is bounded by the number of scatter/gather segments
the controller can handle and the page size.  For an amd64 system,
it works out to around 5MB.

Reviewed by:	mjacob
MFC after:	3 days
Sponsored by:	Spectra Logic

(cherry picked from commit c6e2041529c9c69f395d4780ca05dbd3a9d186e5)
Optimize isp(4) to reduce CPU usage, especially in target mode:
 - Remove two excessive and slow register reads from isp_intr().  Instead
of rereading value every time, assume that registers contain what we have
written there.
 - Avoid sequential search through 4096 array elements when looking for
command tag.  Use hash of lists to store active tags separately from free
ones and so greatly speedup the searches.

Reviewed by:	mjacob

(cherry picked from commit 15c0a70328aa63ca3449f90fd6f9bd79f6a2d3ca)
Partial MFproject/camlock r256671:
Fix several target mode SIMs to not blindly clear ccb_h.flags field of
ATIO CCBs.  Not all CCB flags there belong to them.

(cherry picked from commit c13057cda99bb0e6f77b03f2a0722df6a9aaba82)
Save one more register read per command by not reading rqstoutrp register
every time.  The purpose of that register is unlikely output queue overflow
detection, so read it only when its last known (and probably stale now)
value signals overflow.

This reduces CPU load and lock congestion and rises bottleneck in CTL
while doing target mode via two 8Gbps ports from 100K to 120K IOPS.

(cherry picked from commit f3e02a23492c8e53ed0e8e8231fba7406c24b4dc)
Some more registers access optimizations:
 - Process ATIO queue only if interrupt status tells so;
 - Do not update queue out pointers after each processed command, do it
only once at the end of the loop.

(cherry picked from commit 963d7e1a2a5801201ee0279e94acdb3d2ab5d308)
Use relaxed (write-only) memory barriers when writing some of queue index
registers (for now on ISP2400+).  We never read those registers back and
AFAIK their semantics does not require any immediate reaction on write.

(cherry picked from commit b5ebe2e35e78b419af1fd73654a125ae8a4b14de)
Harvest one no longer used constant string.

Remove another and place it into play in the
normally ifdef protected zone it would be used
int.

Noticed by:	dim

(cherry picked from commit 258c0be375414a2ecddb9f8db57bb16625ef7ca0)
Fix I/O freezes in some cases, caused by r257916.

Delaying isp_reqodx update, we should be ready to update it every time
we read it.  Otherwise requests using several indexes may be requeued
ndefinitely without ever updating the variable.

MFC after:	3 days

(cherry picked from commit 19aa67ecd2dcb656dae87384e2cdf4aed4ef6e69)
cxgbe(4): Assume that CSUM_TSO in the transmit path implies CSUM_IP and
CSUM_TCP too.  They are all set explicitly by the kernel usually.

While here, fix an unrelated bug where hardware L4 checksum calculation
was accidentally disabled for some IPv6 packets.

Reported by:	alfred@
MFC after:	3 days

(cherry picked from commit c37d6a03084a22b73b4dd7bfee296ef9cd6054e4)