Fix lock recursion on LUN shutdown, introduced on r269497.

MFC after:	3 days

(cherry picked from commit bc970eb078f3bbfb60da1074abd8a91769460e7d)
(cherry picked from commit 32bfb213d6b442233d4f93e07d672257150896e8)
Invert AHCI_Q_NOBSYRES quirk meaning, waiting for readiness by default.

I gave up to update list of Marvell chips that require this quirk.
The final nail was growing number of PCIe/M.2 SSDs where Marvell chips
have PCI IDs of different vendors.

(cherry picked from commit 2d35361d6e3c70661d2e3016e9974c83b89a6b67)
Fix typo in comments.

Submitted by:	Benedict Reuschling <bcr@FreeBSD.org>
MFC after:	6 days

(cherry picked from commit 1091f6dff6c692ae8f8b224db3057a6c1b3619a8)
(cherry picked from commit 94b46f60e7809a861269a0630a1da582adc40783)
Make ZVOL writes in device mode support IO_SYNC flag.

MFC after:	1 month

(cherry picked from commit 7797473e53b8c3ee6bd6692fdc9210ec96d2cb14)
(cherry picked from commit 34d08ca87462d2032dd25235e05b677f0f3ddc45)
Improve cache control support, including DPO/FUA flags and the mode page.

At this moment it works only for files and ZVOLs in device mode since BIOs
have no respective respective cache control flags (DPO/FUA).

MFC after:	1 month
Sponsored by:	iXsystems, Inc.

(cherry picked from commit 57ec24a023145729ad2c562ae66559bcc3de8fbd)
(cherry picked from commit 8edce75228df09eb1fc4b3b61fd0af020cc80e64)
Add support for Mode Page Policy (0x87) VPD page.

(cherry picked from commit abf46035ae02b6750dbf028666f3c3711f3bc000)
(cherry picked from commit 483ac0c28c91c21a5aa2f3bbbac364638fa49ffc)
Oops, missed piece of r271311.

(cherry picked from commit fbe6280d13eacb04a9b0c1ec0f36678b1f56f962)
(cherry picked from commit 18dd08c13fb85a9a5dad24e8491382691ff9fc98)
Report that DPO and FUA bits are supported after r271311.

(cherry picked from commit d6b90c0b3c0363c5f1f3a10a561e13dd71e502c0)
(cherry picked from commit dcbffedddf5f1c21e36ace1f7bd8c52fe669f6df)
Make the iSCSI stack use __FBSDID() properly.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 20115760ddbeba4e49dbd911dfda3c3bca98eaa6)
(cherry picked from commit a1c06429cd7ee15adce61910b8ea4d73522311ee)
Fix typo.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit fe5ebc01ac813633bd578410ab0c3fd0123b2928)
(cherry picked from commit 4e738302fff15e010d80cb2e8ba5a26b46033be9)
Turn two errors, which are possible to trigger only by bugs,
into assertions.

Discussed with:	mav@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 81a94cc5e93c3806b9d83fabc04996fc5dacdbd0)
(cherry picked from commit 05901f91cac4a35ce18e838033c29cb938079489)
Document initiator-portal netmask support.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ca6e87735466b49e624fca023d7c8aade7025e62)
(cherry picked from commit 1f6841b53f8f3a8e29c08cb6f8159f2e0994ff17)
Avoid ctld(8) crash on getaddrinfo(3) failure.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 730358ef21de594cb90284d71ff820f259df0259)
(cherry picked from commit 3db6537b2466e6831a463e1121625c2282f7641d)
Fix ctld(8) to not forget to send TargetPortalGroupTag and TargetAlias
when the initiator skips security negotiation.  This fixes interoperability
with Xtend SAN initiator.

PR:		193021
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7fd1fb1a76aadeb024658f5ce1300d2c0c011e2d)
(cherry picked from commit cf8219c7aec00a4026e444bc211f2ebcfbc9653e)
Use keys_add_int() where appropriate.  No functional changes.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit b7774f528d7e78c3d2effd31fdfdffacf0089492)
(cherry picked from commit f81940a42b1f9096e4829e617c23f6aea6b0f959)
MFV r271223:

In dnode_sync(), do dnode_increase_indirection() before processing
the dn_next_nblkptr.

Illumos issue:
    5117 space map reallocation can cause corruption

MFC after:	3 days

(cherry picked from commit 52c704852742f9802a8ed19c1ecec396033abf60)
MFV r270193:

Illumos issues:
    5042 stop using deprecated atomic functions

MFC after:	2 weeks

(cherry picked from commit b248e9b18fdaada9f61497e89c6ba18345afa577)
MFC r270195:

Illumos issue:
    5045 use atomic_{inc,dec}_* instead of atomic_add_*

MFC after:	2 weeks

(cherry picked from commit d8cd2ff335ea494491e728683099dfbcc5502d71)
MFV r270196:

Illumos issue:
    5047 don't use atomic_*_nv if you discard the return value

MFC after:	2 weeks

(cherry picked from commit 5a3c4456e4a24ce683d6fec1c12c9798c20c9ba4)
Provide compatibility shim for atomic_dec_64_nv.

X-MFC-with:	r270247
MFC after:	13 days

(cherry picked from commit 6922e3fedfe7e11c6808594c671afc73ffc3c768)